diff Discovery/Src/tMenuSystem.c @ 379:0dbf550dc743 MotionDetection

Added missing customerview selection In the previous version only 6 out of 10 custom views could be configurated => Added a second page for the dive menu system tab In case all views are deactivated the none / debug page will be set as default
author ideenmodellierer
date Mon, 16 Sep 2019 22:49:34 +0200
parents b2a9e9b02df0
children 3485360c5db0
line wrap: on
line diff
--- a/Discovery/Src/tMenuSystem.c	Mon Sep 16 22:46:24 2019 +0200
+++ b/Discovery/Src/tMenuSystem.c	Mon Sep 16 22:49:34 2019 +0200
@@ -31,14 +31,22 @@
 #include "tMenuSystem.h"
 #include "tHome.h"  // for enum CUSTOMVIEWS and init_t7_compass()
 
+static uint8_t customviewsSubpage = 0;
+
 /* Private function prototypes -----------------------------------------------*/
 char customview_TXT2BYTE_helper(uint8_t customViewId);
 
+void set_CustomsviewsSubpage(uint8_t page)
+{
+	customviewsSubpage = page;
+}
+
 /* Exported functions --------------------------------------------------------*/
 
 uint32_t tMSystem_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext)
 {
     SSettings *data;
+    int i;
     uint8_t textPointer;
     uint8_t dateFormat;
     uint8_t RTEhigh, RTElow;
@@ -56,18 +64,33 @@
     {
         uint8_t id;
 
-        for(int i=0; i<6;i++)
+        for(i=0; i<5;i++)		/* fill maximum 5 items and leave last one for sub page selection */
         {
-            id = cv_changelist[i];
-            text[textPointer++] = '\006' - CHECK_BIT_THOME(data->cv_configuration,id);
-            text[textPointer++] = ' ';
-            textPointer += snprintf(&text[textPointer], 60,
-                "%c%c\n\r",
-                TXT_2BYTE, customview_TXT2BYTE_helper(id)
-            );
+        	id = cv_changelist[customviewsSubpage * 5 + i];
+        	if(id == CVIEW_END)		/* last list item? */
+        	{
+        		break;
+        	}
+        	else
+        	{
+				text[textPointer++] = '\006' - CHECK_BIT_THOME(data->cv_configuration,id);
+				text[textPointer++] = ' ';
+				textPointer += snprintf(&text[textPointer], 60,
+					"%c%c\n\r",
+					TXT_2BYTE, customview_TXT2BYTE_helper(id));
+        	}
         }
+        text[textPointer++] = TXT_2BYTE;
+        text[textPointer++] = TXT2BYTE_ButtonNext;
         text[textPointer] = 0;
 
+        for(;i<5;i++)	/* clear empty lines in case menu shows less than 5 entries */
+        {
+        	text[textPointer++]='\n';
+        	text[textPointer++]='\r';
+        	text[textPointer] = 0;
+        }
+
         return StMSYS;
     }
 
@@ -300,6 +323,7 @@
         text = TXT2BYTE_Summary;
         break;
     case CVIEW_noneOrDebug:
+    	text = TXT2BYTE_DispNoneDbg;
         break;
     default:
         break;