mirror of https://github.com/arendst/Tasmota.git
global update fix
This commit is contained in:
parent
15098dae68
commit
5beaea32fd
|
@ -125,7 +125,7 @@ int blinks = 201; // Number of LED blinks
|
|||
uint32_t uptime = 0; // Counting every second until 4294967295 = 130 year
|
||||
uint32_t loop_load_avg = 0; // Indicative loop load average
|
||||
uint32_t global_update = 0; // Timestamp of last global temperature and humidity update
|
||||
float global_temperature = 0; // Provide a global temperature to be used by some sensors
|
||||
float global_temperature = 9999; // Provide a global temperature to be used by some sensors
|
||||
float global_humidity = 0; // Provide a global humidity to be used by some sensors
|
||||
float global_pressure = 0; // Provide a global pressure to be used by some sensors
|
||||
char *ota_url; // OTA url string pointer
|
||||
|
|
|
@ -644,7 +644,7 @@ void ResetGlobalValues(void)
|
|||
{
|
||||
if ((uptime - global_update) > GLOBAL_VALUES_VALID) { // Reset after 5 minutes
|
||||
global_update = 0;
|
||||
global_temperature = 0;
|
||||
global_temperature = 9999;
|
||||
global_humidity = 0;
|
||||
global_pressure = 0;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ void Sgp30Update(void) // Perform every second to ensure proper operation of th
|
|||
}
|
||||
return; // Measurement failed
|
||||
}
|
||||
if (global_update) {
|
||||
if (global_update && global_humidity>0 && global_temperature!=9999) {
|
||||
// abs hum in mg/m3
|
||||
sgp30_abshum=sgp30_AbsoluteHumidity(global_temperature,global_humidity,TempUnit());
|
||||
sgp.setHumidity(sgp30_abshum*1000);
|
||||
|
@ -124,7 +124,7 @@ void Sgp30Show(bool json)
|
|||
if (sgp30_ready) {
|
||||
char abs_hum[33];
|
||||
|
||||
if (global_update) {
|
||||
if (global_update && global_humidity>0 && global_temperature!=9999) {
|
||||
// has humidity + temperature
|
||||
dtostrfd(sgp30_abshum,4,abs_hum);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ void CCS811Update(void) // Perform every n second
|
|||
TVOC = ccs.getTVOC();
|
||||
eCO2 = ccs.geteCO2();
|
||||
CCS811_ready = 1;
|
||||
if (global_update) { ccs.setEnvironmentalData((uint8_t)global_humidity, global_temperature); }
|
||||
if (global_update && global_humidity>0 && global_temperature!=9999) { ccs.setEnvironmentalData((uint8_t)global_humidity, global_temperature); }
|
||||
ecnt = 0;
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue