Mercurial > public > ostc4
comparison Discovery/Src/tMenuEditDeco.c @ 288:ba229a012ac7 div-fixes-6
cleanup: no useless checks for simulator state
and some more in the style of commit 74a8296a2318. And in addition
more cleanup like removing commented and unused code, and making
things static.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Mon, 29 Apr 2019 19:43:05 +0200 |
parents | b7689d9e888a |
children | 1b995079c045 |
comparison
equal
deleted
inserted
replaced
287:ba9d99a2e310 | 288:ba229a012ac7 |
---|---|
32 #include "gfx_fonts.h" | 32 #include "gfx_fonts.h" |
33 #include "tMenuEdit.h" | 33 #include "tMenuEdit.h" |
34 #include "unit.h" | 34 #include "unit.h" |
35 | 35 |
36 /* Private variables ---------------------------------------------------------*/ | 36 /* Private variables ---------------------------------------------------------*/ |
37 uint8_t lineSelected = 0; | 37 static uint8_t lineSelected = 0; |
38 | 38 |
39 /* Private function prototypes -----------------------------------------------*/ | 39 /* Private function prototypes -----------------------------------------------*/ |
40 | 40 |
41 void openEdit_DiveMode(void); | 41 static void openEdit_DiveMode(void); |
42 void openEdit_CCRModeSensorOrFixedSP(void); | 42 static void openEdit_CCRModeSensorOrFixedSP(void); |
43 void openEdit_ppO2max(void); | 43 static void openEdit_ppO2max(void); |
44 void openEdit_SafetyStop(void); | 44 static void openEdit_SafetyStop(void); |
45 void openEdit_FutureTTS(void); | 45 static void openEdit_FutureTTS(void); |
46 void openEdit_Salinity(void); | 46 static void openEdit_Salinity(void); |
47 | 47 |
48 /* Announced function prototypes -----------------------------------------------*/ | 48 /* Announced function prototypes -----------------------------------------------*/ |
49 | 49 |
50 uint8_t OnAction_OC (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 50 static uint8_t OnAction_OC (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
51 uint8_t OnAction_CC (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 51 static uint8_t OnAction_CC (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
52 uint8_t OnAction_Apnea (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 52 static uint8_t OnAction_Apnea (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
53 uint8_t OnAction_Gauge (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 53 static uint8_t OnAction_Gauge (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
54 uint8_t OnAction_FutureTTS (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 54 static uint8_t OnAction_FutureTTS (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
55 uint8_t OnAction_ppO2Max (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 55 static uint8_t OnAction_ppO2Max (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
56 uint8_t OnAction_SafetyStop (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 56 static uint8_t OnAction_SafetyStop (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
57 uint8_t OnAction_Salinity (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 57 static uint8_t OnAction_Salinity (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
58 /* Exported functions --------------------------------------------------------*/ | 58 /* Exported functions --------------------------------------------------------*/ |
59 | 59 |
60 void openEdit_Deco(uint8_t line) | 60 void openEdit_Deco(uint8_t line) |
61 { | 61 { |
62 set_globalState_Menu_Line(line); | 62 set_globalState_Menu_Line(line); |
94 } | 94 } |
95 | 95 |
96 /* Private functions ---------------------------------------------------------*/ | 96 /* Private functions ---------------------------------------------------------*/ |
97 | 97 |
98 | 98 |
99 void openEdit_DiveMode(void) | 99 static void openEdit_DiveMode(void) |
100 { | 100 { |
101 #define APNEAANDGAUGE | 101 #define APNEAANDGAUGE |
102 | 102 |
103 char text[32]; | 103 char text[32]; |
104 uint8_t actualDiveMode, active; | 104 uint8_t actualDiveMode, active; |
151 #endif | 151 #endif |
152 | 152 |
153 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | 153 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
154 } | 154 } |
155 | 155 |
156 uint8_t OnAction_OC (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | 156 static uint8_t OnAction_OC (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
157 { | 157 { |
158 SSettings *pSettings = settingsGetPointer(); | 158 SSettings *pSettings = settingsGetPointer(); |
159 if(pSettings->dive_mode == DIVEMODE_OC) | 159 if(pSettings->dive_mode == DIVEMODE_OC) |
160 return EXIT_TO_MENU; | 160 return EXIT_TO_MENU; |
161 pSettings->dive_mode = DIVEMODE_OC; | 161 pSettings->dive_mode = DIVEMODE_OC; |
166 tMenuEdit_set_on_off(StMDECO1_Gauge, 0); | 166 tMenuEdit_set_on_off(StMDECO1_Gauge, 0); |
167 return UPDATE_DIVESETTINGS; | 167 return UPDATE_DIVESETTINGS; |
168 } | 168 } |
169 | 169 |
170 | 170 |
171 uint8_t OnAction_CC (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | 171 static uint8_t OnAction_CC (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
172 { | 172 { |
173 SSettings *pSettings = settingsGetPointer(); | 173 SSettings *pSettings = settingsGetPointer(); |
174 if(pSettings->dive_mode == DIVEMODE_CCR) | 174 if(pSettings->dive_mode == DIVEMODE_CCR) |
175 return EXIT_TO_MENU; | 175 return EXIT_TO_MENU; |
176 pSettings->dive_mode = DIVEMODE_CCR; | 176 pSettings->dive_mode = DIVEMODE_CCR; |
181 tMenuEdit_set_on_off(StMDECO1_Gauge, 0); | 181 tMenuEdit_set_on_off(StMDECO1_Gauge, 0); |
182 return UPDATE_DIVESETTINGS; | 182 return UPDATE_DIVESETTINGS; |
183 } | 183 } |
184 | 184 |
185 | 185 |
186 uint8_t OnAction_Apnea (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | 186 static uint8_t OnAction_Apnea (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
187 { | 187 { |
188 SSettings *pSettings = settingsGetPointer(); | 188 SSettings *pSettings = settingsGetPointer(); |
189 if(pSettings->dive_mode == DIVEMODE_Apnea) | 189 if(pSettings->dive_mode == DIVEMODE_Apnea) |
190 return EXIT_TO_MENU; | 190 return EXIT_TO_MENU; |
191 pSettings->dive_mode = DIVEMODE_Apnea; | 191 pSettings->dive_mode = DIVEMODE_Apnea; |
196 tMenuEdit_set_on_off(StMDECO1_Gauge, 0); | 196 tMenuEdit_set_on_off(StMDECO1_Gauge, 0); |
197 return UPDATE_DIVESETTINGS; | 197 return UPDATE_DIVESETTINGS; |
198 } | 198 } |
199 | 199 |
200 | 200 |
201 uint8_t OnAction_Gauge (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | 201 static uint8_t OnAction_Gauge (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
202 { | 202 { |
203 SSettings *pSettings = settingsGetPointer(); | 203 SSettings *pSettings = settingsGetPointer(); |
204 if(pSettings->dive_mode == DIVEMODE_Gauge) | 204 if(pSettings->dive_mode == DIVEMODE_Gauge) |
205 return EXIT_TO_MENU; | 205 return EXIT_TO_MENU; |
206 pSettings->dive_mode = DIVEMODE_Gauge; | 206 pSettings->dive_mode = DIVEMODE_Gauge; |
211 tMenuEdit_set_on_off(StMDECO1_OC, 0); | 211 tMenuEdit_set_on_off(StMDECO1_OC, 0); |
212 return UPDATE_DIVESETTINGS; | 212 return UPDATE_DIVESETTINGS; |
213 } | 213 } |
214 | 214 |
215 | 215 |
216 void openEdit_CCRModeSensorOrFixedSP(void) | 216 static void openEdit_CCRModeSensorOrFixedSP(void) |
217 { | 217 { |
218 SSettings *pSettings = settingsGetPointer(); | 218 SSettings *pSettings = settingsGetPointer(); |
219 | 219 |
220 if(pSettings->CCR_Mode == CCRMODE_Sensors) | 220 if(pSettings->CCR_Mode == CCRMODE_Sensors) |
221 pSettings->CCR_Mode = CCRMODE_FixedSetpoint; | 221 pSettings->CCR_Mode = CCRMODE_FixedSetpoint; |
224 | 224 |
225 exitEditWithUpdate(); | 225 exitEditWithUpdate(); |
226 } | 226 } |
227 | 227 |
228 | 228 |
229 void openEdit_SafetyStop(void) | 229 static void openEdit_SafetyStop(void) |
230 { | 230 { |
231 uint32_t safetystopDuration, safetystopDepth; | 231 uint32_t safetystopDuration, safetystopDepth; |
232 char text[64]; | 232 char text[64]; |
233 uint16_t y_line; | 233 uint16_t y_line; |
234 | 234 |
282 setEvent(StMDECO4_SafetyStop, (uint32_t)OnAction_SafetyStop); | 282 setEvent(StMDECO4_SafetyStop, (uint32_t)OnAction_SafetyStop); |
283 startEdit(); | 283 startEdit(); |
284 } | 284 } |
285 | 285 |
286 | 286 |
287 uint8_t OnAction_SafetyStop (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | 287 static uint8_t OnAction_SafetyStop (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
288 { | 288 { |
289 uint8_t digitContentNew; | 289 uint8_t digitContentNew; |
290 uint32_t newSafetystopDuration, newSafetystopDepth; | 290 uint32_t newSafetystopDuration, newSafetystopDepth; |
291 | 291 |
292 if(action == ACTION_BUTTON_ENTER) | 292 if(action == ACTION_BUTTON_ENTER) |
370 } | 370 } |
371 return EXIT_TO_MENU; | 371 return EXIT_TO_MENU; |
372 } | 372 } |
373 | 373 |
374 | 374 |
375 void openEdit_Salinity(void) | 375 static void openEdit_Salinity(void) |
376 { | 376 { |
377 char text[32]; | 377 char text[32]; |
378 uint16_t y_line; | 378 uint16_t y_line; |
379 | 379 |
380 text[0] = '\001'; | 380 text[0] = '\001'; |
394 setEvent(StMDECO6_SALINITY, (uint32_t)OnAction_Salinity); | 394 setEvent(StMDECO6_SALINITY, (uint32_t)OnAction_Salinity); |
395 startEdit(); | 395 startEdit(); |
396 } | 396 } |
397 | 397 |
398 | 398 |
399 uint8_t OnAction_Salinity(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | 399 static uint8_t OnAction_Salinity(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
400 { | 400 { |
401 SSettings *pSettings; | 401 SSettings *pSettings; |
402 uint8_t digitContentNew; | 402 uint8_t digitContentNew; |
403 uint32_t salinity; | 403 uint32_t salinity; |
404 | 404 |
437 | 437 |
438 return EXIT_TO_MENU; | 438 return EXIT_TO_MENU; |
439 } | 439 } |
440 | 440 |
441 | 441 |
442 void openEdit_ppO2max(void) | 442 static void openEdit_ppO2max(void) |
443 { | 443 { |
444 uint8_t maxL_std, maxL_deco; | 444 uint8_t maxL_std, maxL_deco; |
445 uint16_t y_line; | 445 uint16_t y_line; |
446 char text[32]; | 446 char text[32]; |
447 SSettings *pSettings = settingsGetPointer(); | 447 SSettings *pSettings = settingsGetPointer(); |
478 setEvent(StMDECO3_PPO2Max, (uint32_t)OnAction_ppO2Max); | 478 setEvent(StMDECO3_PPO2Max, (uint32_t)OnAction_ppO2Max); |
479 startEdit(); | 479 startEdit(); |
480 } | 480 } |
481 | 481 |
482 | 482 |
483 uint8_t OnAction_ppO2Max(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | 483 static uint8_t OnAction_ppO2Max(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
484 { | 484 { |
485 SSettings *pSettings; | 485 SSettings *pSettings; |
486 uint8_t digitContentNew; | 486 uint8_t digitContentNew; |
487 uint32_t newPPO2LStd, newPPO2LDeco; | 487 uint32_t newPPO2LStd, newPPO2LDeco; |
488 | 488 |
523 } | 523 } |
524 return EXIT_TO_MENU; | 524 return EXIT_TO_MENU; |
525 } | 525 } |
526 | 526 |
527 | 527 |
528 void openEdit_FutureTTS(void) | 528 static void openEdit_FutureTTS(void) |
529 { | 529 { |
530 uint8_t futureTTS; | 530 uint8_t futureTTS; |
531 uint16_t y_line; | 531 uint16_t y_line; |
532 | 532 |
533 char text[32]; | 533 char text[32]; |
553 setEvent(StMDECO5_FUTURE, (uint32_t)OnAction_FutureTTS); | 553 setEvent(StMDECO5_FUTURE, (uint32_t)OnAction_FutureTTS); |
554 startEdit(); | 554 startEdit(); |
555 } | 555 } |
556 | 556 |
557 | 557 |
558 uint8_t OnAction_FutureTTS(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | 558 static uint8_t OnAction_FutureTTS(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
559 { | 559 { |
560 SSettings *pSettings; | 560 SSettings *pSettings; |
561 int8_t digitContentNew; | 561 int8_t digitContentNew; |
562 uint32_t newFutureTTS; | 562 uint32_t newFutureTTS; |
563 | 563 |
590 digitContentNew = digitContent - 1; | 590 digitContentNew = digitContent - 1; |
591 if(digitContentNew < '0') | 591 if(digitContentNew < '0') |
592 digitContentNew = '0' + 15; | 592 digitContentNew = '0' + 15; |
593 return digitContentNew; | 593 return digitContentNew; |
594 } | 594 } |
595 /* | |
596 if(action == ACTION_BUTTON_NEXT) | |
597 { | |
598 digitContentNew = digitContent + 1; | |
599 if((digitNumber == 0) && (digitContentNew > '1')) | |
600 digitContentNew = '0'; | |
601 else | |
602 if(digitContentNew > '9') | |
603 digitContentNew = '0'; | |
604 return digitContentNew; | |
605 } | |
606 if(action == ACTION_BUTTON_BACK) | |
607 { | |
608 digitContentNew = digitContent - 1; | |
609 if((digitNumber == 0) && (digitContentNew < '0')) | |
610 digitContentNew = '1'; | |
611 else | |
612 if(digitContentNew < '0') | |
613 digitContentNew = '9'; | |
614 return digitContentNew; | |
615 } | |
616 */ | |
617 return EXIT_TO_MENU; | 595 return EXIT_TO_MENU; |
618 } | 596 } |
619 | |
620 |