comparison Discovery/Src/tMenuCvOption.c @ 1071:b4a79464caf7 Icon_Integration

Dynamic menu creation for CV views: Because of the increasing features of the OSTC the maintenance of the the menus becomes difficult. Some are not available because of HW version or connected sensors. To keep the "legacy" menus stable the functionality of the cv options page has been increased. Based on enabled cv views and connected sensors the page will be filled dynamically. The page items allow quick acces to the view related options. For the first implementation the views: compass, timer, sensor O2 and sensor CO2 are supported.
author Ideenmodellierer
date Thu, 19 Feb 2026 13:28:37 +0100
parents 33b91584d827
children
comparison
equal deleted inserted replaced
1070:4499227a2db8 1071:b4a79464caf7
27 ////////////////////////////////////////////////////////////////////////////// 27 //////////////////////////////////////////////////////////////////////////////
28 28
29 /* Includes ------------------------------------------------------------------*/ 29 /* Includes ------------------------------------------------------------------*/
30 #include "tMenu.h" 30 #include "tMenu.h"
31 #include "tMenuCvOption.h" 31 #include "tMenuCvOption.h"
32 #include "tMenuCvOptionText.h"
32 #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass() 33 #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass()
33 #include "t7.h" 34 #include "t7.h"
34 35
35 /* Private function prototypes -----------------------------------------------*/ 36 /* Private function prototypes -----------------------------------------------*/
36 37
37 /* Exported functions --------------------------------------------------------*/ 38 /* Exported functions --------------------------------------------------------*/
38 39
40
39 uint32_t tMCvOption_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) 41 uint32_t tMCvOption_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext)
40 { 42 {
41 SSettings *data;
42 uint8_t textPointer; 43 uint8_t textPointer;
43 44 refreshFunc_t* pRefreshTable;
44 data = settingsGetPointer(); 45 uint8_t activeLines;
46 uint8_t index = 0;
45 textPointer = 0; 47 textPointer = 0;
46 *tab = 300; 48 *tab = 450;
47 *subtext = 0; 49 *subtext = 0;
48 50
49 resetLineMask(StMOption); 51 resetLineMask(StMOption);
50 52
51 if((line == 0) || (line == 1)) 53 activeLines = tMCvOptText_GetTableItemCnt();
52 { 54 pRefreshTable = tMCvOptText_GetTable();
53 text[textPointer++] = TXT_2BYTE;
54 text[textPointer++] = TXT2BYTE_Compass;
55 text[textPointer++] = '\t';
56 55
57 if(settingsGetPointer()->compassBearing != 0) 56 for(index = 1; index <= activeLines; index++)
58 { 57 {
59 textPointer += snprintf(&text[textPointer], 20, "(%03u`)", settingsGetPointer()->compassBearing % 360); 58 if((line == 0) || (index == line))
60 } 59 {
61 text[textPointer] = 0; 60 textPointer += pRefreshTable[index - 1](&text[textPointer]);
62 } 61 }
63 nextline(text,&textPointer); 62 nextline(text,&textPointer);
64 if (line == 0 || line == 2) 63 }
65 { 64 text[textPointer] = 0;
66 if(t7_customview_disabled(CVIEW_Timer))
67 {
68 text[textPointer++] = '\031'; /* change text color */
69 textPointer += snprintf(&text[textPointer], 21, "%c%c\t%u:%02u \016\016[m:ss]\017", TXT_2BYTE, TXT2BYTE_Timer, data->timerDurationS / 60, data->timerDurationS % 60);
70 text[textPointer++] = '\020'; /* restore text color */
71 }
72 else
73 {
74 textPointer += snprintf(&text[textPointer], 21, "%c%c\t%u:%02u \016\016[m:ss]\017", TXT_2BYTE, TXT2BYTE_Timer, data->timerDurationS / 60, data->timerDurationS % 60);
75 }
76 }
77 nextline(text,&textPointer);
78
79 #ifdef ENABLE_PULSE_SENSOR_BT
80 if (line == 0 || line == 3)
81 {
82 textPointer += snprintf(&text[textPointer], 21, "%c%c", TXT_2BYTE, TXT2BYTE_Pulse);
83 }
84 nextline(text,&textPointer);
85
86 #endif
87 65
88 return StMOption; 66 return StMOption;
89 } 67 }
90 void tMCvOption_checkLineStatus(void) 68 void tMCvOption_checkLineStatus(void)
91 { 69 {