changeset 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 bc2fcd002fc4
children b2aad621aeb0
files Discovery/Inc/tMenuSystem.h Discovery/Src/tMenu.c Discovery/Src/tMenuSystem.c
diffstat 3 files changed, 32 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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 */
--- 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:
--- 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 ---------------------------------------------------------*/