diff Discovery/Src/t7.c @ 701:8c48553a0176

Bugfix display of deactivated sensors: In the previous version disabled sensors had been show after startup. Rootcause was that the deactivation state was taken from the divesettings instead of the common setting. After startup divesettings are not initialized and therefore all three sensors were displayed even if one or more were disabled. This has been fixed by using the common settings in case that the OSTC is not in divemode.
author Ideenmodellierer
date Fri, 28 Oct 2022 19:39:20 +0200
parents 79ce499e26aa
children 8adf9b8fc7fa
line wrap: on
line diff
--- a/Discovery/Src/t7.c	Tue Oct 18 21:21:32 2022 +0200
+++ b/Discovery/Src/t7.c	Fri Oct 28 19:39:20 2022 +0200
@@ -1733,6 +1733,17 @@
 	SSettings* pSettings;
 	pSettings = settingsGetPointer();
 
+	uint8_t local_ppo2sensors_deactivated = 0;
+
+	if(stateUsed->mode == MODE_DIVE)	/* show sensors based on current dive settings */
+	{
+		local_ppo2sensors_deactivated = stateUsed->diveSettings.ppo2sensors_deactivated;
+	}
+	else
+	{
+			local_ppo2sensors_deactivated = pSettings->ppo2sensors_deactivated;
+	}
+
 	if(last_customview != selection_customview)		/* check if current selection is disabled and should be skipped */
 	{
 		if(t7_customview_disabled(selection_customview))
@@ -2040,7 +2051,7 @@
         text[textpointer++] = '\030'; // main color
         for(int i=0;i<3;i++)
         {
-            if((stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) || (stateUsed->lifeData.ppO2Sensor_bar[i] == 0.0))
+            if((local_ppo2sensors_deactivated & (1<<i)) || (stateUsed->lifeData.ppO2Sensor_bar[i] == 0.0))
             {
 #ifdef ENABLE_PSCR_MODE
             	if((stateUsed->diveSettings.diveMode == DIVEMODE_PSCR) && (showSimPPO2) && (stateUsed->mode == MODE_DIVE))	/* display ppo2 sim in blue letters in case a slot is not used in the ppo2 custom view */
@@ -2089,7 +2100,7 @@
         text[textpointer++] = '\030';
         for(int i=0;i<3;i++)
         {
-            if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i))
+            if(local_ppo2sensors_deactivated & (1<<i))
             {
                 text[textpointer++] = '\031';
                 text[textpointer++] = '\001';