diff Discovery/Src/tMenuEditCustom.c @ 531:1721b26335f1

Bugfix custom view selection dialog: Because of missing events / menu states and not resetting the subpage index while switching between cv and bf selection, some display errors occure.
author Ideenmodellierer
date Tue, 15 Sep 2020 20:57:04 +0200
parents e221cf762f45
children 6fbf7cd391cb
line wrap: on
line diff
--- a/Discovery/Src/tMenuEditCustom.c	Tue Sep 15 20:54:54 2020 +0200
+++ b/Discovery/Src/tMenuEditCustom.c	Tue Sep 15 20:57:04 2020 +0200
@@ -313,6 +313,7 @@
     case CVIEW_Profile:
         text = TXT2BYTE_Profile;
         break;
+    case CVIEW_Gaslist:
     case CVIEW_T3_GasList:
         text = TXT2BYTE_Gaslist;
         break;
@@ -528,17 +529,15 @@
     uint8_t i;
 
 	customviewsSubpageMax = (tHome_getNumberOfAvailableCVs(pcv_changelist) / CV_PER_PAGE) + 1;
+
+	if(pcv_curchangelist != pcv_changelist)		/* new selection base? => reset page index */
+	{
+		customviewsSubpage = 0;
+	}
 	pcv_curchangelist = pcv_changelist;
 
 	CustomviewDivemode_refresh(pcv_changelist);
 
-
-    text[0] = '\001';
-    text[1] = TXT_2BYTE;
-    text[2] = TXT2BYTE_SelectCustomviews;
-    text[3] = 0;
-    write_topline(text);
-
      for(i=0; i<5;i++)		/* fill maximum 5 items and leave last one for sub page selection */
      {
     	textPointer = 0;
@@ -701,10 +700,12 @@
 
     uint8_t i;
 
-    text[0] = '\001';
-    text[1] = TXT_2BYTE;
-    text[2] = TXT2BYTE_SelectCustomviews;
-    text[3] = 0;
+    text[textPointer++] = '\001';
+    text[textPointer++] = TXT_2BYTE;
+    text[textPointer++] = TXT2BYTE_SelectCustomviews;
+    text[textPointer++] = ' ';
+    text[textPointer++] = '1' + customviewsSubpage;
+    text[textPointer++] = 0;
     write_topline(text);