comparison 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
comparison
equal deleted inserted replaced
378:834e087505ec 379:0dbf550dc743
29 /* Includes ------------------------------------------------------------------*/ 29 /* Includes ------------------------------------------------------------------*/
30 #include "tMenu.h" 30 #include "tMenu.h"
31 #include "tMenuSystem.h" 31 #include "tMenuSystem.h"
32 #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass() 32 #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass()
33 33
34 static uint8_t customviewsSubpage = 0;
35
34 /* Private function prototypes -----------------------------------------------*/ 36 /* Private function prototypes -----------------------------------------------*/
35 char customview_TXT2BYTE_helper(uint8_t customViewId); 37 char customview_TXT2BYTE_helper(uint8_t customViewId);
38
39 void set_CustomsviewsSubpage(uint8_t page)
40 {
41 customviewsSubpage = page;
42 }
36 43
37 /* Exported functions --------------------------------------------------------*/ 44 /* Exported functions --------------------------------------------------------*/
38 45
39 uint32_t tMSystem_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) 46 uint32_t tMSystem_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext)
40 { 47 {
41 SSettings *data; 48 SSettings *data;
49 int i;
42 uint8_t textPointer; 50 uint8_t textPointer;
43 uint8_t dateFormat; 51 uint8_t dateFormat;
44 uint8_t RTEhigh, RTElow; 52 uint8_t RTEhigh, RTElow;
45 RTC_DateTypeDef Sdate; 53 RTC_DateTypeDef Sdate;
46 RTC_TimeTypeDef Stime; 54 RTC_TimeTypeDef Stime;
54 // dive mode 62 // dive mode
55 if(actual_menu_content != MENU_SURFACE) 63 if(actual_menu_content != MENU_SURFACE)
56 { 64 {
57 uint8_t id; 65 uint8_t id;
58 66
59 for(int i=0; i<6;i++) 67 for(i=0; i<5;i++) /* fill maximum 5 items and leave last one for sub page selection */
60 { 68 {
61 id = cv_changelist[i]; 69 id = cv_changelist[customviewsSubpage * 5 + i];
62 text[textPointer++] = '\006' - CHECK_BIT_THOME(data->cv_configuration,id); 70 if(id == CVIEW_END) /* last list item? */
63 text[textPointer++] = ' '; 71 {
64 textPointer += snprintf(&text[textPointer], 60, 72 break;
65 "%c%c\n\r", 73 }
66 TXT_2BYTE, customview_TXT2BYTE_helper(id) 74 else
67 ); 75 {
68 } 76 text[textPointer++] = '\006' - CHECK_BIT_THOME(data->cv_configuration,id);
77 text[textPointer++] = ' ';
78 textPointer += snprintf(&text[textPointer], 60,
79 "%c%c\n\r",
80 TXT_2BYTE, customview_TXT2BYTE_helper(id));
81 }
82 }
83 text[textPointer++] = TXT_2BYTE;
84 text[textPointer++] = TXT2BYTE_ButtonNext;
69 text[textPointer] = 0; 85 text[textPointer] = 0;
86
87 for(;i<5;i++) /* clear empty lines in case menu shows less than 5 entries */
88 {
89 text[textPointer++]='\n';
90 text[textPointer++]='\r';
91 text[textPointer] = 0;
92 }
70 93
71 return StMSYS; 94 return StMSYS;
72 } 95 }
73 96
74 // surface mode 97 // surface mode
298 break; 321 break;
299 case CVIEW_SummaryOfLeftCorner: 322 case CVIEW_SummaryOfLeftCorner:
300 text = TXT2BYTE_Summary; 323 text = TXT2BYTE_Summary;
301 break; 324 break;
302 case CVIEW_noneOrDebug: 325 case CVIEW_noneOrDebug:
326 text = TXT2BYTE_DispNoneDbg;
303 break; 327 break;
304 default: 328 default:
305 break; 329 break;
306 } 330 }
307 return text; 331 return text;