Mercurial > public > ostc4
comparison Discovery/Src/tMenuEditSystem.c @ 999:ac25c35a3c97 GasConsumption
New Tab for dynamic configuration:
since more and more functions are added to the OSTC the space in the menus is getting short. To avoid problems a new Tab within the SYS menu has been added which shall focus an functions / views which are configuration dependend. In future this menu may have dynamic content dependend on which views are active or which sensors are connected. The Cview for compass and Timer have been moved to the new tab in the first step
| author | Ideenmodellierer |
|---|---|
| date | Mon, 28 Apr 2025 19:47:41 +0200 |
| parents | d9290c76b840 |
| children | fa1af49319e5 |
comparison
equal
deleted
inserted
replaced
| 998:5a690195b6b7 | 999:ac25c35a3c97 |
|---|---|
| 107 uint8_t OnAction_TestCLog (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 107 uint8_t OnAction_TestCLog (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 108 */ | 108 */ |
| 109 | 109 |
| 110 /* Exported functions --------------------------------------------------------*/ | 110 /* Exported functions --------------------------------------------------------*/ |
| 111 | 111 |
| 112 static uint8_t OnAction_Timer(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 113 { | |
| 114 SSettings *settings = settingsGetPointer(); | |
| 115 uint8_t digitContentNew; | |
| 116 switch (action) { | |
| 117 case ACTION_BUTTON_ENTER: | |
| 118 | |
| 119 return digitContent; | |
| 120 case ACTION_BUTTON_ENTER_FINAL: | |
| 121 { | |
| 122 uint32_t timerM; | |
| 123 uint32_t timerS; | |
| 124 evaluateNewString(editId, &timerM, &timerS, 0, 0); | |
| 125 if (timerM > 9) { | |
| 126 timerM = 9; | |
| 127 } | |
| 128 if (timerS > 59) { | |
| 129 timerS = 59; | |
| 130 } | |
| 131 | |
| 132 uint16_t timerDurationS = 60 * timerM + timerS; | |
| 133 | |
| 134 if (timerDurationS < 1) { | |
| 135 timerDurationS = 1; | |
| 136 } | |
| 137 | |
| 138 if (timerDurationS != settings->timerDurationS) { | |
| 139 settings->timerDurationS = timerDurationS; | |
| 140 | |
| 141 disableTimer(); | |
| 142 | |
| 143 tMenuEdit_newInput(editId, settings->timerDurationS / 60, settings->timerDurationS % 60, 0, 0); | |
| 144 } | |
| 145 | |
| 146 return EXIT_TO_MENU; | |
| 147 } | |
| 148 case ACTION_BUTTON_NEXT: | |
| 149 digitContentNew = digitContent + 1; | |
| 150 if ((blockNumber == 1 && digitNumber == 0 && digitContentNew > '5') || digitContentNew > '9') { | |
| 151 digitContentNew = '0'; | |
| 152 } | |
| 153 | |
| 154 return digitContentNew; | |
| 155 case ACTION_BUTTON_BACK: | |
| 156 digitContentNew = digitContent - 1; | |
| 157 if (digitContentNew < '0') { | |
| 158 if (blockNumber == 1 && digitNumber == 0) { | |
| 159 digitContentNew = '5'; | |
| 160 } else { | |
| 161 digitContentNew = '9'; | |
| 162 } | |
| 163 } | |
| 164 | |
| 165 return digitContentNew; | |
| 166 } | |
| 167 | |
| 168 return EXIT_TO_MENU; | |
| 169 } | |
| 170 | |
| 171 | |
| 172 static void openEdit_Timer(void) | |
| 173 { | |
| 174 SSettings *settings = settingsGetPointer(); | |
| 175 | |
| 176 char text[32]; | |
| 177 snprintf(text, 32, "\001%c%c", TXT_2BYTE, TXT2BYTE_Timer); | |
| 178 write_topline(text); | |
| 179 | |
| 180 uint16_t yPos = ME_Y_LINE_BASE + get_globalState_Menu_Line() * ME_Y_LINE_STEP; | |
| 181 snprintf(text, 32, "%c%c", TXT_2BYTE, TXT2BYTE_Timer); | |
| 182 write_label_var(30, 299, yPos, &FontT48, text); | |
| 183 write_field_udigit(StMSYS_Timer, 300, 392, yPos, &FontT48, "#:##", settings->timerDurationS / 60, settings->timerDurationS % 60, 0, 0); | |
| 184 write_label_var(393, 800, yPos, &FontT48, "\016\016 [m:ss]\017"); | |
| 185 | |
| 186 write_buttonTextline(TXT2BYTE_ButtonMinus, TXT2BYTE_ButtonEnter, TXT2BYTE_ButtonPlus); | |
| 187 | |
| 188 setEvent(StMSYS_Timer, (uint32_t)OnAction_Timer); | |
| 189 startEdit(); | |
| 190 } | |
| 191 | |
| 192 | |
| 193 void openEdit_System(uint8_t line) | 112 void openEdit_System(uint8_t line) |
| 194 { | 113 { |
| 195 set_globalState_Menu_Line(line); | 114 set_globalState_Menu_Line(line); |
| 196 resetMenuEdit(CLUT_MenuPageSystem); | 115 resetMenuEdit(CLUT_MenuPageSystem); |
| 197 | 116 |
| 202 case 1: | 121 case 1: |
| 203 default: | 122 default: |
| 204 openEdit_DateTime(); | 123 openEdit_DateTime(); |
| 205 break; | 124 break; |
| 206 case 2: | 125 case 2: |
| 207 openEdit_Timer(); | 126 openEdit_Language(); |
| 208 break; | 127 break; |
| 209 case 3: | 128 case 3: |
| 210 openEdit_Language(); | 129 openEdit_Design(); |
| 211 break; | 130 break; |
| 212 case 4: | 131 case 4: |
| 213 openEdit_Design(); | 132 openEdit_Information(); |
| 214 break; | 133 break; |
| 215 case 5: | 134 case 5: |
| 216 openEdit_Information(); | |
| 217 break; | |
| 218 case 6: | |
| 219 openEdit_Reset(); | 135 openEdit_Reset(); |
| 220 break; | 136 break; |
| 221 /* | |
| 222 case 3: | |
| 223 openEdit_DecoFutureTTS(); | |
| 224 break; | |
| 225 case 4: | |
| 226 openEdit_DecoLastStop(); | |
| 227 break; | |
| 228 */ | |
| 229 } | 137 } |
| 230 } | 138 } |
| 231 else | 139 else |
| 232 { | 140 { |
| 233 openEdit_CustomviewDivemodeMenu(line); | 141 openEdit_CustomviewDivemodeMenu(line); |
