diff Discovery/Src/tMenuSystem.c @ 851:9f487ad38170 Evo_2_23

Added line checks for System Menu: In the previous version the Timer options were always active even if the view was disabled. It is now disabled (grey) in case the view is disabled.
author Ideenmodellierer
date Thu, 07 Mar 2024 21:42:23 +0100
parents ce8f71217f45
children
line wrap: on
line diff
--- a/Discovery/Src/tMenuSystem.c	Fri Mar 01 19:30:29 2024 +0100
+++ b/Discovery/Src/tMenuSystem.c	Thu Mar 07 21:42:23 2024 +0100
@@ -30,6 +30,7 @@
 #include "tMenu.h"
 #include "tMenuSystem.h"
 #include "tHome.h"  // for enum CUSTOMVIEWS and init_t7_compass()
+#include "t7.h"
 
 static uint8_t customviewsSubpage = 0;
 
@@ -183,9 +184,21 @@
         textPointer += 2;
     }
 
-    if (line == 0 || line == 2) {
-        textPointer += snprintf(&text[textPointer], 21, "%c%c\t%u:%02u \016\016[m:ss]\017\n\r", TXT_2BYTE, TXT2BYTE_Timer, data->timerDurationS / 60, data->timerDurationS % 60);
-    } else {
+    if (line == 0 || line == 2)
+    {
+    	if(t7_customview_disabled(CVIEW_Timer))
+    	{
+    		text[textPointer++] = '\031';		/* change text color */
+    	    textPointer += snprintf(&text[textPointer], 21, "%c%c\t%u:%02u \016\016[m:ss]\017\n\r", TXT_2BYTE, TXT2BYTE_Timer, data->timerDurationS / 60, data->timerDurationS % 60);
+    	    disableLine(StMSYS_Timer);
+            text[textPointer++] = '\020';		/* restore text color */
+    	}
+    	else
+    	{
+    		textPointer += snprintf(&text[textPointer], 21, "%c%c\t%u:%02u \016\016[m:ss]\017\n\r", TXT_2BYTE, TXT2BYTE_Timer, data->timerDurationS / 60, data->timerDurationS % 60);
+    	}
+    } else
+    {
         textPointer += snprintf(&text[textPointer], 3, "\n\r");
     }
 
@@ -303,6 +316,19 @@
 
     return StMSYS;
 }
+void tMSystem_checkLineStatus(void)
+{
+	uint8_t localLineMask = 0;
+	uint8_t lineMask = getLineMask(StMSYS);
 
+	if(t7_customview_disabled(CVIEW_Timer))
+    {
+    	localLineMask |= 1 << 2;
+    }
+	if(lineMask != localLineMask)
+	{
+		updateMenu();
+	}
+}
 
 /* Private functions ---------------------------------------------------------*/