changeset 792:25103f5c7e29

Avoid a configuration warning after the firmware upgrade by disabling automatic setpoint switching. This makes sure the user's automatic setpoint configuration is not overwritten by the validity checks if the settings are not in the correct spots for the new configuration. Users will have to manually re-create the automatic setpoint switching configuration in the new format; Add a checkbox to 'SPdeco' in the menu - this will make it obvious to users that this setpoint can be disabled. (mikeller)
author heinrichsweikamp
date Sat, 05 Aug 2023 11:52:08 +0200
parents 92ac192e98d5
children 9da81033ad44
files Discovery/Src/settings.c Discovery/Src/tMenuSetpoint.c
diffstat 2 files changed, 16 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Src/settings.c	Wed Aug 02 08:41:03 2023 +0200
+++ b/Discovery/Src/settings.c	Sat Aug 05 11:52:08 2023 +0200
@@ -538,6 +538,9 @@
     case 0xFFFF0025:
         pSettings->compassDeclinationDeg = pStandard->compassDeclinationDeg;
         pSettings->delaySetpointLow = pStandard->delaySetpointLow;
+        // Disable auto setpoint to avoid a configuration warning being triggered by the new auto setpoint validation
+        // This ensures that users don't lose setpoint information if it is not in the right spot for the new configuration
+        pSettings->autoSetpoint = false;
 
     	// no break;
     default:
--- a/Discovery/Src/tMenuSetpoint.c	Wed Aug 02 08:41:03 2023 +0200
+++ b/Discovery/Src/tMenuSetpoint.c	Sat Aug 05 11:52:08 2023 +0200
@@ -77,17 +77,19 @@
 			depthUp = pSetpointLine[spId].depth_meter;
 			first = pSetpointLine[spId].note.ub.first;
 
+            char colour;
             if (settings->autoSetpoint && spId == SETPOINT_INDEX_AUTO_DECO  && !pSetpointLine[spId].note.ub.active) {
-			    strcpy(&text[textPointer++],"\031");
+			    colour = '\031';
             } else {
-			    strcpy(&text[textPointer++],"\020");
+				colour = '\020';
             }
 
 			uint8_t setpointBar = setpoint_cbar / 100;
 
-            textPointer += snprintf(&text[textPointer], 4, "%c%c", TXT_2BYTE, TXT2BYTE_SetpointShort);
+            textPointer += snprintf(&text[textPointer], 4, "%c%c%c", colour, TXT_2BYTE, TXT2BYTE_SetpointShort);
             textPointer += printSetpointName(&text[textPointer], spId, settings, true);
-			text[textPointer++] = '\t';
+
+            text[textPointer++] = '\t';
 
 			if (first == 0 || actual_menu_content != MENU_SURFACE) {
 				strcpy(&text[textPointer++],"\177");
@@ -95,13 +97,15 @@
 
 			textPointer += snprintf(&text[textPointer], 40, "* %u.%02u\016\016 bar\017\034   \016\016 \017", setpointBar, setpoint_cbar - (100 * setpointBar));
             if (!settings->autoSetpoint || spId < SETPOINT_INDEX_AUTO_DECO) {
-			    char color = '\031';
-			    if(depthUp)
-				    color = '\020';
+			    if (depthUp) {
+				    colour = '\020';
+                } else {
+			        colour = '\031';
+                }
 
-			    textPointer += snprintf(&text[textPointer], 40, "%c%3u\016\016 %c%c\017\035\n\r", color, unit_depth_integer(depthUp), unit_depth_char1(), unit_depth_char2());
+			    textPointer += snprintf(&text[textPointer], 40, "%c%3u\016\016 \035%c%c\017\n\r", colour, unit_depth_integer(depthUp), unit_depth_char1(), unit_depth_char2());
             } else {
-			    textPointer += snprintf(&text[textPointer], 3, "\n\r");
+			    textPointer += snprintf(&text[textPointer], 14, " %c\016\016 \035%c%c\017\n\r", pSetpointLine[spId].note.ub.active ? '\005' : '\006', TXT_2BYTE, TXT2BYTE_Enabled);
             }
 		}
     }