Fix issue in lastUpdate logic and implement some more debug output
This commit is contained in:
parent
828877e0fb
commit
ac81705a29
@ -114,11 +114,17 @@ long lastMsg = 0;
|
||||
|
||||
void publish (Sensor &sensor){
|
||||
bool force = false;
|
||||
Serial.println("Sample " + sensor.desc + ": " + String(sensor.value).c_str());
|
||||
Serial.print("Sample " + sensor.desc + " : ");
|
||||
Serial.print(String(sensor.value).c_str());
|
||||
Serial.print(" last : ");
|
||||
Serial.print(String(sensor.lastValue).c_str());
|
||||
Serial.print(" samples since last update : ");
|
||||
Serial.println(String(sensor.lastUpdate).c_str());
|
||||
|
||||
// check if first sample, set lastValue and return
|
||||
if (sensor.lastUpdate == -1){
|
||||
sensor.lastValue = sensor.value;
|
||||
sensor.lastUpdate = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user