diff --git a/.gitignore b/.gitignore index 96ceea6..e3c1dd0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ env.h build/ .vscode/ +node_modules/ diff --git a/metesp.ino b/metesp.ino index b9874e1..f6687ab 100644 --- a/metesp.ino +++ b/metesp.ino @@ -50,10 +50,10 @@ static TimedFun* tf = new TimedFun(); static bool time_update = true, view_update = true, view_refresh = false; -static const int8_t views_size = 6; +static const int8_t views_size = 5; static DisplayWrapper* views[views_size] = { new MainDisplay(), - new WeatherDisplay(owm[0]), + // new WeatherDisplay(owm[0]), new WeatherDisplay(owm[1]), new TempDisplay(sensor), new AirDisplay(sensor), @@ -124,11 +124,10 @@ void setup_TIMEDFUN() { REGISTER_TIMEDFUN_CALL(SENSOR_MEASURE_TF,5); // 5s LOCAL SYNC REGISTER_TIMEDFUN_CALL(OWM_MEASURE_TF,5*60); // 5m WEATHER SYNC REGISTER_TIMEDFUN_CALL(RECORD_LOCAL_TF,1*60); // 1m LOCAL DB - // REGISTER_TIMEDFUN_CALL(RECORD_WEATHER_TF,5*60); // 5m WEATHER DB + REGISTER_TIMEDFUN_CALL(RECORD_WEATHER_TF,5*60); // 5m WEATHER DB } void setup_POWER() { - } /* Setup Functions --------------------------------------------------------------*/ diff --git a/src/sensor/dev/bme280.cpp b/src/sensor/dev/bme280.cpp index e3707d4..706894d 100644 --- a/src/sensor/dev/bme280.cpp +++ b/src/sensor/dev/bme280.cpp @@ -40,16 +40,9 @@ bool BME280::ReadChipID() { /****************************************************************/ void BME280::WriteSettings() { - // ctrl_hum register. (ctrl_hum[2:0] = Humidity oversampling rate.) - uint8_t ctrlHum = (uint8_t)OSR_X1; - // ctrl_meas register. (ctrl_meas[7:5] = temperature oversampling rate, ctrl_meas[4:2] = pressure oversampling rate, ctrl_meas[1:0] = mode.) - uint8_t ctrlMeas = ((uint8_t)OSR_X1 << 5) | ((uint8_t)OSR_X1 << 2) | (uint8_t)Mode_Forced; - // config register. (config[7:5] = standby time, config[4:2] = filter, ctrl_meas[0] = spi enable.) - uint8_t config = ((uint8_t)StandbyTime_1000ms << 5) | ((uint8_t)Filter_Off << 2) | 0; - - WriteRegister(CTRL_HUM_ADDR, ctrlHum); - WriteRegister(CTRL_MEAS_ADDR, ctrlMeas); - WriteRegister(CONFIG_ADDR, config); + WriteRegister(CTRL_HUM_ADDR, OSR_X1); + WriteRegister(CTRL_MEAS_ADDR, (OSR_X1 << 5) | (OSR_X1 << 2) | (Mode_Forced)); + WriteRegister(CONFIG_ADDR, StandbyTime_1000ms << 5) | (Filter_Off << 2); } diff --git a/src/sensor/sensor.cpp b/src/sensor/sensor.cpp index 6f7b103..526e395 100644 --- a/src/sensor/sensor.cpp +++ b/src/sensor/sensor.cpp @@ -31,8 +31,13 @@ void Sensor::PMS_init(void) { void Sensor::BME_measure() { - bme->read(pres, temp, hum); + float t_temp = 0; + float t_pres = 0; + bme->read(t_pres, t_temp, hum); + + temp = t_temp - 5.0; // Correct heating offset heatidx = EnvironmentCalculations::HeatIndex(temp,hum); + pres = EnvironmentCalculations::EquivalentSeaLevelPressure(100,temp, t_pres); } void Sensor::LTR_measure() { ltr->read(uv, uvi);