Browse Source

Use NaN to signal no sensor values

The InfluxDB client will filter NaNs
Florian Eitel 1 year ago
parent
commit
01d6737d60
No account linked to committer's email address
2 changed files with 3 additions and 3 deletions
  1. 2
    2
      firmware/firmware.ino
  2. 1
    1
      firmware/sensor_battery.ino

+ 2
- 2
firmware/firmware.ino View File

@@ -47,7 +47,7 @@
47 47
 //*************************************************************************//
48 48
 
49 49
 const uint8_t VALUES = 8;
50
-float currentSensorData[VALUES] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
50
+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")};
51 51
 float (*sensors[VALUES])() = {};
52 52
 
53 53
 uint16_t update_sensor_cnt      = 0;
@@ -233,7 +233,7 @@ void _loop() {
233 233
     if (sensors[i]) {
234 234
       currentSensorData[i] = sensors[i]();
235 235
     } else {
236
-      currentSensorData[i] = 0xFFFFFFFF;
236
+      currentSensorData[i] = nan("no value");
237 237
     }
238 238
   }
239 239
 

+ 1
- 1
firmware/sensor_battery.ino View File

@@ -1,4 +1,4 @@
1
-float _sensor_battery_saveMode = 0;
1
+float _sensor_battery_saveMode = nan("no battery");
2 2
 uint16_t energySavingIterations = 0;
3 3
 
4 4
 // Copied from https://arduinodiy.wordpress.com/2016/12/25/monitoring-lipo-battery-voltage-with-wemos-d1-minibattery-shield-and-thingspeak/

Loading…
Cancel
Save