# HG changeset patch
# User Ideenmodellierer
# Date 1709844143 -3600
# Node ID 9f487ad381701b00f6c77aa208602ca94290253d
# Parent  bc2fcd002fc4e871187403da01c6f74b95f6119c
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.

diff -r bc2fcd002fc4 -r 9f487ad38170 Discovery/Inc/tMenuSystem.h
--- a/Discovery/Inc/tMenuSystem.h	Fri Mar 01 19:30:29 2024 +0100
+++ b/Discovery/Inc/tMenuSystem.h	Thu Mar 07 21:42:23 2024 +0100
@@ -44,5 +44,6 @@
 /* Exported functions --------------------------------------------------------*/
 
 uint32_t tMSystem_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext);
+void tMSystem_checkLineStatus(void);
 
 #endif /* TMENU_SYSTEM_H */
diff -r bc2fcd002fc4 -r 9f487ad38170 Discovery/Src/tMenu.c
--- a/Discovery/Src/tMenu.c	Fri Mar 01 19:30:29 2024 +0100
+++ b/Discovery/Src/tMenu.c	Thu Mar 07 21:42:23 2024 +0100
@@ -942,6 +942,8 @@
 {
 	switch(get_globalState())
 	{
+		case StMSYS: tMSystem_checkLineStatus();
+			break;
 		case StMXTRA: tMXtra_checkLineStatus();
 			break;
 		default:
diff -r bc2fcd002fc4 -r 9f487ad38170 Discovery/Src/tMenuSystem.c
--- 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 ---------------------------------------------------------*/