changeset 854:48b6a3b1f3f8 Evo_2_23

Development bugfix menu id handling: Fixed some issues which showed up after cleanup of the menu id handling
author Ideenmodellierer
date Sat, 09 Mar 2024 20:05:33 +0100
parents de6023cc0580
children 012f94ec2fe0
files Discovery/Inc/tStructure.h Discovery/Src/tMenuEdit.c Discovery/Src/tMenuEditHardware.c Discovery/Src/tMenuEditSystem.c Discovery/Src/tMenuXtra.c
diffstat 5 files changed, 27 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Inc/tStructure.h	Thu Mar 07 21:51:18 2024 +0100
+++ b/Discovery/Inc/tStructure.h	Sat Mar 09 20:05:33 2024 +0100
@@ -269,6 +269,7 @@
 
 #define StMHARD1_Bluetooth			_MB(2,7,1,1,0)
 
+#define StMHARD2_Compass				_MB(2,7,2,0,0)
 #define StMHARD2_Compass_SetCourse		_MB(2,7,2,2,0)
 #define StMHARD2_Compass_ResetCourse	_MB(2,7,2,3,0)
 #define StMHARD2_Compass_Calibrate		_MB(2,7,2,4,0)
--- a/Discovery/Src/tMenuEdit.c	Thu Mar 07 21:51:18 2024 +0100
+++ b/Discovery/Src/tMenuEdit.c	Sat Mar 09 20:05:33 2024 +0100
@@ -118,6 +118,10 @@
 static _Bool WriteSettings = 0;
 
 /* Private function prototypes -----------------------------------------------*/
+static void create_newText_for_Id(int8_t localId);
+void clean_content_of_Id(int8_t localId);
+static void write_content_of_Id(int8_t localId);
+
 void draw_tMEdesign(void);
 void set_cursorNew(uint8_t forThisIdentID);
 void startMenuEditFieldSelect(void);
@@ -225,7 +229,7 @@
 	 	 case (StMHARD3_Sensor_Detect):
 	 	 case (StMHARD3_Sensor_Info):							refreshFct = refresh_O2Sensors;
 	 	 	 break;
-		 case (StMHARD2_Compass_SetCourse & MaskFieldDigit):
+		 case (StMHARD2_Compass & MaskFieldDigit):
              refreshFct = refresh_CompassEdit;
 			 break;
 		 case (StMXTRA_CompassHeading & MaskFieldDigit):
@@ -457,9 +461,9 @@
 
     if((ident[actualId].maintype == FIELD_NUMBERS) && (ident[actualId].subtype == FIELD_3DIGIT))
     {
-        content  = 100 * (	ident[id].newText[ident[actualId].begin[block] + 0] - '0');
-        content +=  10 * (	ident[id].newText[ident[actualId].begin[block] + 1] - '0');
-        content += 				ident[id].newText[ident[actualId].begin[block] + 2];
+        content  = 100 * (	ident[actualId].newText[ident[actualId].begin[block] + 0] - '0');
+        content +=  10 * (	ident[actualId].newText[ident[actualId].begin[block] + 1] - '0');
+        content += 				ident[actualId].newText[ident[actualId].begin[block] + 2];
     }
     else
     if((ident[actualId].maintype == FIELD_NUMBERS) && (ident[actualId].subtype == FIELD_2DIGIT))
@@ -505,7 +509,7 @@
     if(event[actualevid].callerID != ident[actualId].callerID)
         return;
 
-    if(ident[id].maintype == FIELD_NUMBERS)
+    if(ident[actualId].maintype == FIELD_NUMBERS)
     {
         oneCharText[0] = ident[actualId].newText[ident[actualId].begin[block] + 0];
         oneCharText[1] = ident[actualId].newText[ident[actualId].begin[block] + 1];
@@ -549,7 +553,7 @@
         oneCharText[0] = ident[actualId].newText[ident[actualId].begin[block] + subBlockPosition];
         oneCharText[1] = 0;
         positionOffset = GFX_return_offset(ident[actualId].fontUsed, ident[actualId].newText, ident[actualId].begin[block] + subBlockPosition);
-        write_content( ident[actualId].coord[0] + positionOffset, ident[actualId].coord[1], ident[id].coord[2], ident[actualId].fontUsed, oneCharText, CLUT_MenuEditDigit);
+        write_content( ident[actualId].coord[0] + positionOffset, ident[actualId].coord[1], ident[actualId].coord[2], ident[actualId].fontUsed, oneCharText, CLUT_MenuEditDigit);
     }
 }
 
@@ -1017,7 +1021,7 @@
     uint8_t temp_id;
 
     if(editID == ident[actualId].callerID)
-        return id;
+        return actualId;
     else
     {
         temp_id = 0;
@@ -1044,8 +1048,8 @@
     strncpy(ident[id].newText, text, 32);
     ident[id].newText[31] = 0;
 
-    clean_content_of_actual_Id();
-    write_content_of_actual_Id();
+    clean_content_of_Id(id);
+    write_content_of_Id(id);
 
     id = backup_id;
 }
@@ -1069,8 +1073,8 @@
     else
         ident[id].newText[0] = '\006';
 
-    clean_content_of_actual_Id();
-    write_content_of_actual_Id();
+    clean_content_of_Id(id);
+    write_content_of_Id(id);
 
     id = backup_id;
 }
@@ -1141,10 +1145,10 @@
     ident[id].input[2] = int3;
     ident[id].input[3] = int4;
 
-    create_newText_for_actual_Id();
+    create_newText_for_Id(id);
     if(id <= idLast)
         change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldRegular);
-    write_content_of_actual_Id();
+    write_content_of_Id(id);
 
     id = backup_id;
 }
--- a/Discovery/Src/tMenuEditHardware.c	Thu Mar 07 21:51:18 2024 +0100
+++ b/Discovery/Src/tMenuEditHardware.c	Sat Mar 09 20:05:33 2024 +0100
@@ -285,6 +285,10 @@
     char text[10];
     uint8_t textIndex = 0;
 
+
+    set_globalState(StMHARD2_Compass);
+    resetMenuEdit(CLUT_MenuPageHardware);
+
     text[textIndex++] = '\001';
     text[textIndex++] = TXT_2BYTE;
     text[textIndex++] = TXT2BYTE_Compass;
@@ -320,6 +324,8 @@
     setEvent(StMHARD2_Compass_Inertia,	(uint32_t)OnAction_InertiaLevel);
     setEvent(StMHARD2_Compass_Declination, (uint32_t)OnAction_CompassDeclination);
 
+    tMenuEdit_select(StMHARD2_Compass_SetCourse);
+
     write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
 }
 
--- a/Discovery/Src/tMenuEditSystem.c	Thu Mar 07 21:51:18 2024 +0100
+++ b/Discovery/Src/tMenuEditSystem.c	Sat Mar 09 20:05:33 2024 +0100
@@ -838,6 +838,7 @@
     write_field_button(StMSYS4_Info, 30, 800, ME_Y_LINE6,  &FontT48, text);
 
     setEvent(StMSYS4_Info, (uint32_t)OnAction_Information);
+    tMenuEdit_select(StMSYS4_Info);
 }
 
 
--- a/Discovery/Src/tMenuXtra.c	Thu Mar 07 21:51:18 2024 +0100
+++ b/Discovery/Src/tMenuXtra.c	Sat Mar 09 20:05:33 2024 +0100
@@ -52,6 +52,8 @@
 
     SSettings *pSettings = settingsGetPointer();
 
+    resetLineMask(StMXTRA);
+
     /* DIVE MODE */
     if(actual_menu_content != MENU_SURFACE)
     {