changeset 671:b456be1e152d Betatest

Support of unknown charging counter values: The RTE now provides negativ charge counter values in case the counter value has not yet been confirmed by a completed charge cycle. Some condition checks needed to be updated to be compatible with the usage of negativ values.
author Ideenmodellierer
date Sat, 12 Mar 2022 22:58:22 +0100
parents 7a352b449055
children c00a80f26641
files Discovery/Src/check_warning.c Discovery/Src/logbook.c Discovery/Src/tMenuEditSystem.c
diffstat 3 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Src/check_warning.c	Sat Mar 12 22:54:26 2022 +0100
+++ b/Discovery/Src/check_warning.c	Sat Mar 12 22:58:22 2022 +0100
@@ -348,7 +348,7 @@
 
 static int8_t check_Battery(SDiveState * pDiveState)
 {
-	if(pDiveState->lifeData.battery_charge < 10)
+	if((pDiveState->lifeData.battery_charge > 0) && (pDiveState->lifeData.battery_charge < 10))
 		pDiveState->warnings.lowBattery = 1;
 	else
 		pDiveState->warnings.lowBattery = 0;
--- a/Discovery/Src/logbook.c	Sat Mar 12 22:54:26 2022 +0100
+++ b/Discovery/Src/logbook.c	Sat Mar 12 22:58:22 2022 +0100
@@ -1309,7 +1309,14 @@
 		logbook_SetCompartmentDesaturation(pStateReal);
 		logbook_SetLastStop(pStateReal->diveSettings.last_stop_depth_bar);
 		gheader.batteryVoltage = pStateReal->lifeData.battery_voltage * 1000;
-		gheader.batteryCharge = pStateReal->lifeData.battery_charge;
+		if(pStateReal->lifeData.battery_charge > 0.0)
+		{
+			gheader.batteryCharge = pStateReal->lifeData.battery_charge;
+		}
+		else
+		{
+			gheader.batteryCharge = 0.0;
+		}
 		logbook_EndDive();
 		bDiveMode = 0;
 	} else
--- a/Discovery/Src/tMenuEditSystem.c	Sat Mar 12 22:54:26 2022 +0100
+++ b/Discovery/Src/tMenuEditSystem.c	Sat Mar 12 22:58:22 2022 +0100
@@ -1081,7 +1081,7 @@
 #endif
 
 
-        if(stateRealGetPointer()->lifeData.battery_charge == 0)
+        if(stateRealGetPointer()->lifeData.battery_charge <= 0)
         {
             text[0] = TXT_2BYTE;
             text[1] = TXT2BYTE_SetBatteryCharge;