changeset 811:4c41d9a18c7f

Added function to skip lines which are not needed for operation: It was not possible in the previous version to skip lines in the top level menu view which were not used for operation. In the past context sensitive menus as well as layout changes have been introduced which cause the cursor to be placed on lines without function. To avoid this it is not possible to mark a line as not in use by enabling / disabling it by the individual meni Id.
author Ideenmodellierer
date Sun, 27 Aug 2023 20:59:12 +0200
parents e6827fcd7604
children 6670eb11a842
files Discovery/Inc/tMenu.h Discovery/Inc/tStructure.h Discovery/Src/tMenu.c Discovery/Src/tMenuEditXtra.c Discovery/Src/tMenuSetpoint.c Discovery/Src/tMenuXtra.c
diffstat 6 files changed, 63 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Inc/tMenu.h	Sun Aug 27 20:55:57 2023 +0200
+++ b/Discovery/Inc/tMenu.h	Sun Aug 27 20:59:12 2023 +0200
@@ -87,5 +87,8 @@
 
 void selectPage(uint32_t selection);
 
+void disableLine(uint32_t lineId);
+void enableLine(uint32_t lineId);
+
 char *makeGrey(bool isGrey);
 #endif /* TMENU_H */
--- a/Discovery/Inc/tStructure.h	Sun Aug 27 20:55:57 2023 +0200
+++ b/Discovery/Inc/tStructure.h	Sun Aug 27 20:59:12 2023 +0200
@@ -180,6 +180,13 @@
 #define StMSP			_MB(2,3,0,0,0)
 
 /* PAGE 3 EDIT FIELD CONTENT */
+#define StMSP_SPLow		_MB(2,3,1,0,0)
+#define StMSP_SPHigh	_MB(2,3,2,0,0)
+#define StMSP_SPDeco	_MB(2,3,3,0,0)
+#define StMSP_Blank		_MB(2,3,4,0,0)
+#define StMSP_DelayDeco	_MB(2,3,5,0,0)
+#define StMSP_Auto		_MB(2,3,6,0,0)
+
 #define StMSP_ppo2_setting	_MB(2,3,255,1,0)
 #define StMSP_Active				_MB(2,3,255,3,0)
 
--- a/Discovery/Src/tMenu.c	Sun Aug 27 20:55:57 2023 +0200
+++ b/Discovery/Src/tMenu.c	Sun Aug 27 20:59:12 2023 +0200
@@ -59,6 +59,7 @@
 #define KEY_LABEL_HIGH	25	/* Height of the label used for the the user keys */
 
 #define SLOW_UPDATE_CNT	10	/* Some content shall not be update in short intervals => add prescalar */
+#define MAXLINES	6
 
 typedef struct
 {
@@ -70,8 +71,9 @@
     uint8_t 	pageCountNumber[MAXPAGES+1];
     uint8_t 	pageCountTotal;
     uint8_t		modeFlipPages;
-    uint8_t		shadowPage[MAXPAGES+1];		/* the page is switch in the context of another page */
-    uint8_t	    activeShadow;				/* Base page which is used for the shadow */
+    uint8_t		shadowPage[MAXPAGES+1];			/* the page is switched in the context of another page */
+    uint8_t	    activeShadow;					/* Base page which is used for the shadow */
+    uint8_t		disableLineMask[MAXPAGES+1];	/* Bitfield used to disable a line. The line is visible but will not be selected by cursor) */
 } SMenuMemory;
 
 /* Exported variables --------------------------------------------------------*/
@@ -88,6 +90,9 @@
 
 uint8_t actual_menu_content  = MENU_UNDEFINED;
 
+
+
+
 /* Private function prototypes -----------------------------------------------*/
 static void draw_tMheader(uint8_t page);
 static void draw_tMcursorDesign(void);
@@ -149,6 +154,7 @@
         menu.StartAddressForPage[i] = 0;
         menu.linesAvailableForPage[i] = 0;
         menu.shadowPage[i] = 0;
+        menu.disableLineMask[i] = 0;
     }
 
     tMscreen.FBStartAdress = 0;
@@ -234,6 +240,29 @@
     }
 }
 
+void disableLine(uint32_t lineId)
+{
+	SStateList idList;
+
+	get_idSpecificStateList(lineId, &idList);
+
+	if((idList.page < MAXPAGES) && (idList.line < MAXLINES))
+	{
+		menu.disableLineMask[idList.page] |= (1 << idList.line);
+	}
+}
+
+void enableLine(uint32_t lineId)
+{
+	SStateList idList;
+
+	get_idSpecificStateList(lineId, &idList);
+
+	if((idList.page < MAXPAGES) && (idList.line < MAXLINES))
+	{
+		menu.disableLineMask[idList.page] &= ~(1 << idList.line);
+	}
+}
 
 static void clean_line_actual_page(void)
 {
@@ -451,6 +480,11 @@
     if(line == 0)
         line = 1;
 
+    if(menu.disableLineMask[page] & ( 1 << line))
+    {
+    	line++;
+    }
+
     if(line > menu.linesAvailableForPage[page])
         line = 1;
 
--- a/Discovery/Src/tMenuEditXtra.c	Sun Aug 27 20:55:57 2023 +0200
+++ b/Discovery/Src/tMenuEditXtra.c	Sun Aug 27 20:59:12 2023 +0200
@@ -180,9 +180,15 @@
     SSettings *pSettings = settingsGetPointer();
 
     if(pSettings->CCR_Mode == CCRMODE_Sensors)
+    {
         pSettings->CCR_Mode = CCRMODE_FixedSetpoint;
+        disableLine(StMXTRA_O2_Fallback);
+    }
     else
+    {
         pSettings->CCR_Mode = CCRMODE_Sensors;
+        enableLine(StMXTRA_O2_Fallback);
+    }
 
     exitEditWithUpdate();
 }
--- a/Discovery/Src/tMenuSetpoint.c	Sun Aug 27 20:55:57 2023 +0200
+++ b/Discovery/Src/tMenuSetpoint.c	Sun Aug 27 20:59:12 2023 +0200
@@ -55,9 +55,16 @@
 
     if((actual_menu_content == MENU_SURFACE) || (stateUsed->diveSettings.diveMode != DIVEMODE_PSCR))	/* do not show setpoints in PSCR mode */
     {
+    	if (settings->autoSetpoint) {
+    	    disableLine(StMSP_Blank);
+    	}
+        else {
+        	enableLine(StMSP_Blank);
+        }
 		for(int spId=1;spId<=NUM_GASES;spId++)
 		{
             if (settings->autoSetpoint) {
+            	disableLine(StMSP_Blank);
                 if (spId == 5) {
                     if (actual_menu_content == MENU_SURFACE) {
                         textPointer += snprintf(&text[textPointer], 40, "\020%c%c\016\016%c%c\017 %c%c\002%c\n\r", TXT_2BYTE, TXT2BYTE_SetpointShort, TXT_2BYTE, TXT2BYTE_SetpointLow, TXT_2BYTE, TXT2BYTE_SetpointDelayed, settings->delaySetpointLow ? '\005' : '\006');
--- a/Discovery/Src/tMenuXtra.c	Sun Aug 27 20:55:57 2023 +0200
+++ b/Discovery/Src/tMenuXtra.c	Sun Aug 27 20:59:12 2023 +0200
@@ -170,6 +170,10 @@
 
              if (!canDoFallback) {
                  text[textPointer++] = '\020';
+                 disableLine(StMXTRA_O2_Fallback);
+             }
+             else {
+            	 enableLine(StMXTRA_O2_Fallback);
              }
              strcpy(&text[textPointer],"\n\r");
              textPointer += 2;