Use NaN to signal no sensor values
The InfluxDB client will filter NaNs
This commit is contained in:
parent
007d2e4e73
commit
01d6737d60
2 changed files with 3 additions and 3 deletions
|
@ -47,7 +47,7 @@
|
||||||
//*************************************************************************//
|
//*************************************************************************//
|
||||||
|
|
||||||
const uint8_t VALUES = 8;
|
const uint8_t VALUES = 8;
|
||||||
float currentSensorData[VALUES] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
|
float currentSensorData[VALUES] = {nanf("no value"), nanf("no value"), nanf("no value"), nanf("no value"), nanf("no value"), nanf("no value"), nanf("no value"), nanf("no value")};
|
||||||
float (*sensors[VALUES])() = {};
|
float (*sensors[VALUES])() = {};
|
||||||
|
|
||||||
uint16_t update_sensor_cnt = 0;
|
uint16_t update_sensor_cnt = 0;
|
||||||
|
@ -233,7 +233,7 @@ void _loop() {
|
||||||
if (sensors[i]) {
|
if (sensors[i]) {
|
||||||
currentSensorData[i] = sensors[i]();
|
currentSensorData[i] = sensors[i]();
|
||||||
} else {
|
} else {
|
||||||
currentSensorData[i] = 0xFFFFFFFF;
|
currentSensorData[i] = nan("no value");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
float _sensor_battery_saveMode = 0;
|
float _sensor_battery_saveMode = nan("no battery");
|
||||||
uint16_t energySavingIterations = 0;
|
uint16_t energySavingIterations = 0;
|
||||||
|
|
||||||
// Copied from https://arduinodiy.wordpress.com/2016/12/25/monitoring-lipo-battery-voltage-with-wemos-d1-minibattery-shield-and-thingspeak/
|
// Copied from https://arduinodiy.wordpress.com/2016/12/25/monitoring-lipo-battery-voltage-with-wemos-d1-minibattery-shield-and-thingspeak/
|
||||||
|
|
Loading…
Reference in a new issue