comparison Discovery/Src/tMenuEditXtra.c @ 827:ffb1036c27c2 Evo_2_23

Moved CO2 Menu from Xtra to Hardware: The first CO2 sensor menu implementation was placed within the Xtra menu. In the new version the CO2 options may be accessed using the sensor overview menu of the Hardware page. With this change it is no longer necessary to take care for compile switches in the menus because the menu will only be shown if a CO2 sensor is detected.
author Ideenmodellierer
date Sun, 05 Nov 2023 20:19:08 +0100
parents c4ee952b9425
children 17d9d6eddd8d
comparison
equal deleted inserted replaced
826:a370741a743b 827:ffb1036c27c2
52 static void openEdit_Fallback(void); 52 static void openEdit_Fallback(void);
53 static void openEdit_Scrubber(void); 53 static void openEdit_Scrubber(void);
54 #ifdef ENABLE_PSCR_MODE 54 #ifdef ENABLE_PSCR_MODE
55 static void openEdit_PSCR(void); 55 static void openEdit_PSCR(void);
56 #endif 56 #endif
57 #ifdef ENABLE_CO2_SUPPORT
58 static void openEdit_CO2Sensor(void);
59 #endif
60 57
61 /* Announced function prototypes -----------------------------------------------*/ 58 /* Announced function prototypes -----------------------------------------------*/
62 uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 59 uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
63 uint8_t OnAction_ScrubberTimerId(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 60 uint8_t OnAction_ScrubberTimerId(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
64 static uint8_t OnAction_ScrubberTimerMax(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 61 static uint8_t OnAction_ScrubberTimerMax(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
67 #ifdef ENABLE_PSCR_MODE 64 #ifdef ENABLE_PSCR_MODE
68 static uint8_t OnAction_PSCRO2Drop(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 65 static uint8_t OnAction_PSCRO2Drop(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
69 static uint8_t OnAction_PSCRLungRation(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 66 static uint8_t OnAction_PSCRLungRation(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
70 #endif 67 #endif
71 68
72 #ifdef ENABLE_CO2_SUPPORT
73 static uint8_t OnAction_CO2OnOff(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
74 static uint8_t OnAction_CO2Calib(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
75 #endif
76
77 /* Exported functions --------------------------------------------------------*/ 69 /* Exported functions --------------------------------------------------------*/
78 70
79 71
80 void openEdit_Xtra(uint8_t line) 72 void openEdit_Xtra(uint8_t line)
81 { 73 {
128 break; 120 break;
129 case 3: openEdit_Scrubber(); 121 case 3: openEdit_Scrubber();
130 break; 122 break;
131 #ifdef ENABLE_PSCR_MODE 123 #ifdef ENABLE_PSCR_MODE
132 case 4: openEdit_PSCR(); 124 case 4: openEdit_PSCR();
133 break;
134 #endif
135 #ifdef ENABLE_CO2_SUPPORT
136 case 6: openEdit_CO2Sensor();
137 break; 125 break;
138 #endif 126 #endif
139 default: 127 default:
140 break; 128 break;
141 } 129 }
319 setEvent(StMXTRA_PSCR_O2_Drop, (uint32_t)OnAction_PSCRO2Drop); 307 setEvent(StMXTRA_PSCR_O2_Drop, (uint32_t)OnAction_PSCRO2Drop);
320 setEvent(StMXTRA_PSCR_LUNG_RATIO, (uint32_t)OnAction_PSCRLungRation); 308 setEvent(StMXTRA_PSCR_LUNG_RATIO, (uint32_t)OnAction_PSCRLungRation);
321 } 309 }
322 310
323 311
324 #ifdef ENABLE_CO2_SUPPORT
325 static void openEdit_CO2Sensor()
326 {
327 char text[32];
328
329 resetMenuEdit(CLUT_MenuPageXtra);
330
331 snprintf(text,32,"\001%c",TXT_CO2Sensor);
332 write_topline(text);
333
334 refresh_CO2Data();
335 if(settingsGetPointer()->co2_sensor_active)
336 {
337 text[0] = '\005';
338 }
339 else
340 {
341 text[0] = '\006';
342 }
343 text[0] = TXT_CO2Sensor;
344 text[1] = 0;
345
346 write_field_on_off(StMXTRA_CO2_Sensor, 30, 95, ME_Y_LINE3, &FontT48, text, settingsGetPointer()->co2_sensor_active);
347
348 text[0] = TXT_2BYTE;
349 text[1] = TXT2BYTE_O2Calib;
350 text[2] = 0;
351 write_field_button(StMXTRA_CO2_Sensor_Calib,30, 800, ME_Y_LINE4, &FontT48, text);
352
353 setEvent(StMXTRA_CO2_Sensor, (uint32_t)OnAction_CO2OnOff);
354 setEvent(StMXTRA_CO2_Sensor_Calib, (uint32_t)OnAction_CO2Calib);
355
356 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
357 }
358 #endif
359
360 312
361 static uint8_t OnAction_CompassHeadingClear(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 313 static uint8_t OnAction_CompassHeadingClear(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
362 { 314 {
363 stateUsedWrite->diveSettings.compassHeading = 0; 315 stateUsedWrite->diveSettings.compassHeading = 0;
364 316
682 } 634 }
683 return digitContentNew; 635 return digitContentNew;
684 } 636 }
685 #endif 637 #endif
686 638
687 #ifdef ENABLE_CO2_SUPPORT 639
688 static uint8_t OnAction_CO2OnOff(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
689 {
690 SSettings *pSettings = settingsGetPointer();
691 if(pSettings->co2_sensor_active)
692 {
693 pSettings->co2_sensor_active = 0;
694 tMenuEdit_set_on_off(StMXTRA_CO2_Sensor,0);
695 }
696 else
697 {
698 pSettings->co2_sensor_active = 1;
699 tMenuEdit_set_on_off(StMXTRA_CO2_Sensor,1);
700 }
701 return UPDATE_DIVESETTINGS;
702 }
703
704 static uint8_t OnAction_CO2Calib(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
705 {
706 DataEX_setExtInterface_Cmd(EXT_INTERFACE_CO2_CALIB);
707 return UPDATE_DIVESETTINGS;
708 }
709 #endif