fix bug with last_values

This commit is contained in:
2020-06-29 20:10:04 +02:00
parent 2ebcac04b7
commit ddec85f57e
+5 -3
View File
@@ -156,7 +156,7 @@ void setup(void)
setup_platform(); setup_platform();
SetupScales(config_data.debug_level); SetupScales(config_data.debug_level);
ClearLoraData(); ClearLoraData(true);
setup_bme280(); setup_bme280();
setup_flash(); setup_flash();
@@ -382,7 +382,7 @@ void loop()
} }
} }
void ClearLoraData(void) void ClearLoraData(bool clearLastValues)
{ {
lora_data.version = LORA_DATA_VERSION; lora_data.version = LORA_DATA_VERSION;
lora_data.vbat = 0; lora_data.vbat = 0;
@@ -412,6 +412,7 @@ void ClearLoraData(void)
my_position = 0; my_position = 0;
// We initialize last_sensor_reading // We initialize last_sensor_reading
if (clearLastValues) {
last_sensor_reading.vbat = 0; last_sensor_reading.vbat = 0;
last_sensor_reading.weight1 = 0; last_sensor_reading.weight1 = 0;
last_sensor_reading.weight2 = 0; last_sensor_reading.weight2 = 0;
@@ -420,6 +421,7 @@ void ClearLoraData(void)
last_sensor_reading.humidity = 0; last_sensor_reading.humidity = 0;
last_sensor_reading.pressure = 0; last_sensor_reading.pressure = 0;
} }
}
void ShowLORAData(bool firstTime) void ShowLORAData(bool firstTime)
{ {
@@ -859,7 +861,7 @@ void startSendingUplink(bool firstTime, bool confirmed)
} }
} }
ClearLoraData(); ClearLoraData(false);
} }
static void sendBufferDoneCb( static void sendBufferDoneCb(