Compare commits

..

2 commits

2 changed files with 12 additions and 11 deletions

View file

@ -110,10 +110,7 @@ void setup()
#ifdef BATTERY_POWERED #ifdef BATTERY_POWERED
debug("battery powered"); debug("battery powered");
do {
_battery_mode_main(); _battery_mode_main();
} while (fsm_state != FSM_STATE_1);
digitalWrite(STATUS_LED_PIN, LOW); digitalWrite(STATUS_LED_PIN, LOW);
@ -128,9 +125,9 @@ void setup()
// sleep the system will run into the setup routine // sleep the system will run into the setup routine
ESP.deepSleep(POWERSAVING_SLEEP_S * 1000000, WAKE_RF_DEFAULT); ESP.deepSleep(POWERSAVING_SLEEP_S * 1000000, WAKE_RF_DEFAULT);
delay(100); delay(100);
#endif
#ifndef BATTERY_POWERED #else // not in battery mode
#ifdef ENABLE_WATCHDOG #ifdef ENABLE_WATCHDOG
// Enable the internal watchdog // Enable the internal watchdog
ESP.wdtEnable(WATCHDOG_TIMEOUT_MS); ESP.wdtEnable(WATCHDOG_TIMEOUT_MS);
@ -453,7 +450,7 @@ void _fsm_loop()
#ifdef INFLUXDB_FEATURE #ifdef INFLUXDB_FEATURE
for (uint8_t i = 0; i < 5 and validData == false; i++) for (uint8_t i = 0; i < 5 and validData == false; i++)
{ {
if (currentSensorData[i] != 0) if (currentSensorData[i] != 0 and currentSensorData[i] != nanf("no value") and (not isnan(currentSensorData[i])))
{ {
validData = true; validData = true;
} }
@ -485,7 +482,7 @@ void _fsm_loop()
//debug("wait for wind sensor finish"); //debug("wait for wind sensor finish");
fsm_state = FSM_STATE_9; // stay here until the wind measurement is done fsm_state = FSM_STATE_9; // stay here until the wind measurement is done
} else { } else {
debug("wind sensor read finish"); //debug("wind sensor read finish");
fsm_state = FSM_STATE_10; fsm_state = FSM_STATE_10;
} }
#else #else
@ -514,7 +511,7 @@ void _fsm_loop()
//debug("wait for wind sensor finish"); //debug("wait for wind sensor finish");
fsm_state = FSM_STATE_11; // stay here until the wind measurement is done fsm_state = FSM_STATE_11; // stay here until the wind measurement is done
} else { } else {
debug("wind sensor read finish"); //debug("wind sensor read finish");
fsm_state = FSM_STATE_12; fsm_state = FSM_STATE_12;
} }
#else #else

View file

@ -80,7 +80,7 @@ void setSensorData(float sensorValues[])
for (uint8_t i = 0; i < 5 and wuValidData == false; i++) for (uint8_t i = 0; i < 5 and wuValidData == false; i++)
{ {
if (sensorValues[i] != 0) if (sensorValues[i] != 0 and sensorValues[i] != nanf("no value") and (not isnan(sensorValues[i])))
{ {
wuValidData = true; // at least one value is not zero, the data wuValidData = true; // at least one value is not zero, the data
} }
@ -88,8 +88,12 @@ void setSensorData(float sensorValues[])
for (uint8_t i = 0; i < VALUES; i++) for (uint8_t i = 0; i < VALUES; i++)
{ {
if (sensorValues[i] != nanf("no value") and (not isnan(sensorValues[i])))
{
// only copy real float values
_webUpdater_sensValues[i] = sensorValues[i]; _webUpdater_sensValues[i] = sensorValues[i];
} }
}
} }
//*************************************************************************// //*************************************************************************//