Fixes to temp & rec
This commit is contained in:
parent
9f9bb7856d
commit
0708beb49f
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
env.h
|
env.h
|
||||||
build/
|
build/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
node_modules/
|
||||||
|
@ -50,10 +50,10 @@ static TimedFun* tf = new TimedFun();
|
|||||||
|
|
||||||
static bool time_update = true, view_update = true, view_refresh = false;
|
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] = {
|
static DisplayWrapper* views[views_size] = {
|
||||||
new MainDisplay(),
|
new MainDisplay(),
|
||||||
new WeatherDisplay(owm[0]),
|
// new WeatherDisplay(owm[0]),
|
||||||
new WeatherDisplay(owm[1]),
|
new WeatherDisplay(owm[1]),
|
||||||
new TempDisplay(sensor),
|
new TempDisplay(sensor),
|
||||||
new AirDisplay(sensor),
|
new AirDisplay(sensor),
|
||||||
@ -124,11 +124,10 @@ void setup_TIMEDFUN() {
|
|||||||
REGISTER_TIMEDFUN_CALL(SENSOR_MEASURE_TF,5); // 5s LOCAL SYNC
|
REGISTER_TIMEDFUN_CALL(SENSOR_MEASURE_TF,5); // 5s LOCAL SYNC
|
||||||
REGISTER_TIMEDFUN_CALL(OWM_MEASURE_TF,5*60); // 5m WEATHER 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_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() {
|
void setup_POWER() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup Functions --------------------------------------------------------------*/
|
/* Setup Functions --------------------------------------------------------------*/
|
||||||
|
@ -40,16 +40,9 @@ bool BME280::ReadChipID() {
|
|||||||
|
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
void BME280::WriteSettings() {
|
void BME280::WriteSettings() {
|
||||||
// ctrl_hum register. (ctrl_hum[2:0] = Humidity oversampling rate.)
|
WriteRegister(CTRL_HUM_ADDR, OSR_X1);
|
||||||
uint8_t ctrlHum = (uint8_t)OSR_X1;
|
WriteRegister(CTRL_MEAS_ADDR, (OSR_X1 << 5) | (OSR_X1 << 2) | (Mode_Forced));
|
||||||
// ctrl_meas register. (ctrl_meas[7:5] = temperature oversampling rate, ctrl_meas[4:2] = pressure oversampling rate, ctrl_meas[1:0] = mode.)
|
WriteRegister(CONFIG_ADDR, StandbyTime_1000ms << 5) | (Filter_Off << 2);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,8 +31,13 @@ void Sensor::PMS_init(void) {
|
|||||||
|
|
||||||
|
|
||||||
void Sensor::BME_measure() {
|
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);
|
heatidx = EnvironmentCalculations::HeatIndex(temp,hum);
|
||||||
|
pres = EnvironmentCalculations::EquivalentSeaLevelPressure(100,temp, t_pres);
|
||||||
}
|
}
|
||||||
void Sensor::LTR_measure() {
|
void Sensor::LTR_measure() {
|
||||||
ltr->read(uv, uvi);
|
ltr->read(uv, uvi);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user