Mercurial > public > ostc4
annotate Discovery/Src/tMenuEditXtra.c @ 711:34eb693720eb
Development bugfix number of spare bytes in setting structure
author | Ideenmodellierer |
---|---|
date | Tue, 08 Nov 2022 22:16:56 +0100 |
parents | 8adf9b8fc7fa |
children | 062deb659531 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenuEditXtra.c | |
5 /// \brief Menu Edit Xtra - Specials in Divemode like Reset Stopwatch | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 02-Mar-2015 | |
8 /// | |
9 /// \details | |
10 /// | |
11 /// $Id$ | |
12 /////////////////////////////////////////////////////////////////////////////// | |
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
14 /// | |
15 /// This program is free software: you can redistribute it and/or modify | |
16 /// it under the terms of the GNU General Public License as published by | |
17 /// the Free Software Foundation, either version 3 of the License, or | |
18 /// (at your option) any later version. | |
19 /// | |
20 /// This program is distributed in the hope that it will be useful, | |
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 /// GNU General Public License for more details. | |
24 /// | |
25 /// You should have received a copy of the GNU General Public License | |
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
27 ////////////////////////////////////////////////////////////////////////////// | |
28 | |
29 /* Includes ------------------------------------------------------------------*/ | |
30 #include "tMenuEditXtra.h" | |
31 | |
32 #include "gfx_fonts.h" | |
33 #include "simulation.h" | |
34 #include "timer.h" | |
35 #include "tMenuEdit.h" | |
347
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
36 #include "data_exchange_main.h" |
547 | 37 #include "motion.h" |
662 | 38 #include "configuration.h" |
347
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
39 |
38 | 40 |
41 /* Private function prototypes -----------------------------------------------*/ | |
42 void openEdit_CompassHeading(void); | |
43 void openEdit_ResetStopwatch(void); | |
44 void openEdit_SimFollowDecostops(void); | |
45 void openEdit_SetManualMarker(void); | |
347
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
46 void openEdit_SetEndDive(void); |
552
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
547
diff
changeset
|
47 void openEdit_CalibViewport(void); |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
48 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
49 static void openEdit_CCRModeSensorOrFixedSP(void); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
50 static void openEdit_Fallback(void); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
51 static void openEdit_Scrubber(void); |
662 | 52 #ifdef ENABLE_PSCR_MODE |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
53 static void openEdit_PSCR(void); |
662 | 54 #endif |
55 #ifdef ENABLE_CO2_SUPPORT | |
56 static void openEdit_CO2Sensor(void); | |
57 #endif | |
38 | 58 |
59 /* Announced function prototypes -----------------------------------------------*/ | |
60 uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
710 | 61 uint8_t OnAction_ScrubberTimerId(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
62 static uint8_t OnAction_ScrubberTimerMax(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
63 static uint8_t OnAction_ScrubberReset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
64 static uint8_t OnAction_ScrubberMode(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
662 | 65 #ifdef ENABLE_PSCR_MODE |
66 static uint8_t OnAction_PSCRO2Drop(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
67 static uint8_t OnAction_PSCRLungRation(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
68 #endif | |
69 | |
70 #ifdef ENABLE_CO2_SUPPORT | |
71 static uint8_t OnAction_CO2OnOff(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
72 static uint8_t OnAction_CO2Calib(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
73 #endif | |
38 | 74 |
75 /* Exported functions --------------------------------------------------------*/ | |
76 | |
710 | 77 |
38 | 78 void openEdit_Xtra(uint8_t line) |
79 { | |
80 set_globalState_Menu_Line(line); | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
81 |
38 | 82 |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
83 /* DIVE MODE */ |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
84 if(actual_menu_content != MENU_SURFACE) |
38 | 85 { |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
86 resetMenuEdit(CLUT_MenuPageXtra); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
87 |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
88 switch(line) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
89 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
90 case 1: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
91 default: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
92 openEdit_ResetStopwatch(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
93 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
94 case 2: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
95 openEdit_CompassHeading(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
96 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
97 case 3: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
98 openEdit_SetManualMarker(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
99 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
100 case 4: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
101 openEdit_CalibViewport(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
102 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
103 case 5: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
104 if(is_stateUsedSetToSim()) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
105 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
106 openEdit_SimFollowDecostops(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
107 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
108 else |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
109 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
110 openEdit_SetEndDive(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
111 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
112 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
113 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
114 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
115 else /* surface mode */ |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
116 { |
662 | 117 if((settingsGetPointer()->dive_mode != DIVEMODE_PSCR) && (line > 3)) /* PSCR items are only optional */ |
118 { | |
119 line = 6; | |
120 } | |
121 | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
122 switch(line) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
123 { |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
124 case 1: openEdit_CCRModeSensorOrFixedSP(); |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
125 break; |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
126 case 2: openEdit_Fallback(); |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
127 break; |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
128 case 3: openEdit_Scrubber(); |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
129 break; |
662 | 130 #ifdef ENABLE_PSCR_MODE |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
131 case 4: openEdit_PSCR(); |
662 | 132 break; |
133 #endif | |
134 #ifdef ENABLE_CO2_SUPPORT | |
135 case 6: openEdit_CO2Sensor(); | |
136 break; | |
137 #endif | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
138 default: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
139 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
140 } |
38 | 141 } |
142 } | |
143 | |
144 /* Private functions ---------------------------------------------------------*/ | |
145 void openEdit_ResetStopwatch(void) | |
146 { | |
147 timer_Stopwatch_Restart(); | |
148 exitMenuEdit_to_Home(); | |
149 } | |
150 | |
151 void openEdit_SetManualMarker(void) | |
152 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
272
diff
changeset
|
153 stateUsedWrite->events.manualMarker = 1; |
38 | 154 exitMenuEdit_to_Home(); |
155 } | |
156 | |
347
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
157 void openEdit_SetEndDive(void) |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
158 { |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
159 dataOutGetPointer()->setEndDive = 1; |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
160 exitMenuEdit_to_Home(); |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
161 } |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
162 |
38 | 163 void openEdit_SimFollowDecostops(void) |
164 { | |
165 simulation_set_heed_decostops(!simulation_get_heed_decostops()); | |
166 exitMenuEdit_to_Menu_with_Menu_Update(); | |
167 } | |
168 | |
547 | 169 void openEdit_CalibViewport(void) |
170 { | |
171 calibrateViewport(stateUsed->lifeData.compass_roll, stateUsed->lifeData.compass_pitch, stateUsed->lifeData.compass_heading); | |
648
ff2b393e290f
Motion detection: Enable focus after focus calibration:
Ideenmodellierer
parents:
552
diff
changeset
|
172 suspendMotionDetection(0); /* exit to focus mode directly */ |
547 | 173 exitMenuEdit_to_Home(); |
174 } | |
175 | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
176 |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
177 static void openEdit_CCRModeSensorOrFixedSP(void) |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
178 { |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
179 SSettings *pSettings = settingsGetPointer(); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
180 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
181 if(pSettings->CCR_Mode == CCRMODE_Sensors) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
182 pSettings->CCR_Mode = CCRMODE_FixedSetpoint; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
183 else |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
184 pSettings->CCR_Mode = CCRMODE_Sensors; |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
185 |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
186 exitEditWithUpdate(); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
187 } |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
188 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
189 static void openEdit_Fallback(void) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
190 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
191 /* does not work like this resetEnterPressedToStateBeforeButtonAction(); */ |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
192 |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
193 SSettings *pSettings = settingsGetPointer(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
194 |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
195 if(pSettings->fallbackToFixedSetpoint == 0) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
196 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
197 pSettings->fallbackToFixedSetpoint = 1; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
198 } |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
199 else |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
200 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
201 pSettings->fallbackToFixedSetpoint = 0; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
202 } |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
203 exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only(); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
204 } |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
205 |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
206 |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
207 static void openEdit_Scrubber(void) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
208 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
209 char text[32]; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
210 uint8_t textIndex = 0; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
211 uint16_t localScrubTimer; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
212 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
213 SSettings *pSettings = settingsGetPointer(); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
214 |
710 | 215 localScrubTimer = pSettings->scrubberData[pSettings->scubberActiveId].TimerMax; |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
216 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
217 resetMenuEdit(CLUT_MenuPageXtra); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
218 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
219 |
710 | 220 snprintf(&text[0], 32,"\001%c",TXT_ScrubTime); |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
221 write_topline(text); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
222 |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
223 |
710 | 224 snprintf(&text[0], 32,"%c \002#%d",TXT_ScrubTime,pSettings->scubberActiveId); |
225 write_field_button(StMXTRA_ScrubTimer, 20, 780, ME_Y_LINE1, &FontT48, text); | |
226 | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
227 snprintf(&text[textIndex], 32,\ |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
228 "%c" |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
229 "\016\016(%c)\017" |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
230 ,TXT_ScrubTime |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
231 ,TXT_Maximum); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
232 |
710 | 233 write_label_var( 20, 340, ME_Y_LINE2, &FontT48, text); |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
234 snprintf(&text[textIndex], 32, "\002###\016\016 %c\017",TXT_Minutes); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
235 |
710 | 236 write_field_udigit(StMXTRA_ScrubTimer_Max, 610, 780, ME_Y_LINE2, &FontT48, text,localScrubTimer, 0, 0, 0); |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
237 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
238 snprintf(&text[0], 32,\ |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
239 "%c\002%03u\016\016 %c\017" |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
240 ,TXT_ScrubTimeReset |
710 | 241 ,pSettings->scrubberData[pSettings->scubberActiveId].TimerCur |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
242 ,TXT_Minutes); |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
243 |
710 | 244 write_field_button(StMXTRA_ScrubTimer_Reset, 20, 780, ME_Y_LINE3, &FontT48, text); |
245 | |
246 if(pSettings->scrubberData[pSettings->scubberActiveId].lastDive.WeekDay != 0) | |
247 { | |
248 snprintf(&text[0], 32,"%c%c\002 %02d.%02d.%02d", TXT_2BYTE, TXT2BYTE_SimDiveTime, pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Date, | |
249 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Month, | |
250 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Year); | |
251 } | |
252 else | |
253 { | |
254 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime); | |
255 } | |
256 write_label_var( 20, 780, ME_Y_LINE4, &FontT48, text); | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
257 |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
258 switch(pSettings->scrubTimerMode) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
259 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
260 case SCRUB_TIMER_OFF: |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
261 default: snprintf(&text[0], 32,"%c\002%c%c",TXT_ScrubTimeMode, TXT_2BYTE, TXT2BYTE_MoCtrlNone ); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
262 break; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
263 case SCRUB_TIMER_MINUTES: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Minutes ); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
264 break; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
265 case SCRUB_TIMER_PERCENT: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Percent ); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
266 break; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
267 } |
710 | 268 write_field_button(StMXTRA_ScrubTimer_OP_Mode, 20, 780, ME_Y_LINE5, &FontT48, text); |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
269 |
710 | 270 setEvent(StMXTRA_ScrubTimer, (uint32_t)OnAction_ScrubberTimerId); |
271 setEvent(StMXTRA_ScrubTimer_Max, (uint32_t)OnAction_ScrubberTimerMax); | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
272 setEvent(StMXTRA_ScrubTimer_Reset, (uint32_t)OnAction_ScrubberReset); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
273 setEvent(StMXTRA_ScrubTimer_OP_Mode, (uint32_t)OnAction_ScrubberMode); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
274 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
275 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
276 |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
277 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
278 |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
279 static void openEdit_PSCR(void) |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
280 { |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
281 uint8_t localO2Drop,localLungRatio; |
662 | 282 char text[32]; |
283 SSettings *pSettings = settingsGetPointer(); | |
284 localO2Drop = pSettings->pscr_o2_drop; | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
285 localLungRatio = pSettings->pscr_lung_ratio; |
662 | 286 |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
287 resetMenuEdit(CLUT_MenuPageXtra); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
288 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
289 snprintf(text, 32, "\001%c",TXT_PSClosedCircuit); |
662 | 290 write_topline(text); |
291 | |
292 text[0] = '\002'; | |
293 text[1] = '\016'; | |
294 text[2] = '\016'; | |
295 text[3] = '%'; | |
296 text[4] = 0; | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
297 write_label_fix( 20, 800, ME_Y_LINE1, &FontT48, TXT_PSCRO2Drop); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
298 write_label_var( 435, 780, ME_Y_LINE1, &FontT48, text); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
299 write_field_udigit(StMXTRA_PSCR_O2_Drop, 710, 779, ME_Y_LINE1, &FontT48, "##", (uint32_t)localO2Drop, 0, 0, 0); |
662 | 300 |
301 | |
302 text[0] = '\002'; | |
303 text[1] = '1'; | |
304 text[2] = '/'; | |
305 text[3] = 0; | |
306 | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
307 write_label_fix( 20, 800, ME_Y_LINE2, &FontT48, TXT_PSCRLungRatio); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
308 write_label_var( 435, 710, ME_Y_LINE2, &FontT48, text); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
309 write_field_udigit(StMXTRA_PSCR_LUNG_RATIO, 710, 779, ME_Y_LINE2, &FontT48, "##", (uint32_t)localLungRatio, 0, 0, 0); |
662 | 310 |
311 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus); | |
312 | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
313 setEvent(StMXTRA_PSCR_O2_Drop, (uint32_t)OnAction_PSCRO2Drop); |
662 | 314 setEvent(StMXTRA_PSCR_LUNG_RATIO, (uint32_t)OnAction_PSCRLungRation); |
315 } | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
316 |
662 | 317 |
318 #ifdef ENABLE_CO2_SUPPORT | |
319 static void openEdit_CO2Sensor() | |
320 { | |
321 char text[32]; | |
322 snprintf(text,32,"\001%c",TXT_CO2Sensor); | |
323 write_topline(text); | |
324 | |
325 refresh_CO2Data(); | |
326 if(settingsGetPointer()->co2_sensor_active) | |
327 { | |
328 text[0] = '\005'; | |
329 } | |
330 else | |
331 { | |
332 text[0] = '\006'; | |
333 } | |
334 text[0] = TXT_CO2Sensor; | |
335 text[1] = 0; | |
336 | |
337 write_field_on_off(StMXTRA_CO2_Sensor, 30, 95, ME_Y_LINE3, &FontT48, text, settingsGetPointer()->co2_sensor_active); | |
338 | |
339 text[0] = TXT_2BYTE; | |
340 text[1] = TXT2BYTE_O2Calib; | |
341 text[2] = 0; | |
342 write_field_button(StMXTRA_CO2_Sensor_Calib,30, 800, ME_Y_LINE4, &FontT48, text); | |
343 | |
344 setEvent(StMXTRA_CO2_Sensor, (uint32_t)OnAction_CO2OnOff); | |
345 setEvent(StMXTRA_CO2_Sensor_Calib, (uint32_t)OnAction_CO2Calib); | |
346 | |
347 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
348 } | |
349 #endif | |
350 | |
38 | 351 void refresh_CompassHeading(void) |
352 { | |
353 uint16_t heading; | |
354 char text[32]; | |
355 | |
356 text[0] = '\001'; | |
357 text[1] = TXT_2BYTE; | |
358 text[2] = TXT2BYTE_CompassHeading; | |
359 text[3] = 0; | |
360 write_topline(text); | |
361 | |
362 heading = (uint16_t)stateUsed->lifeData.compass_heading; | |
363 snprintf(text,32,"\001%03i`",heading); | |
364 write_label_var( 0, 800, ME_Y_LINE1, &FontT54, text); | |
365 | |
366 tMenuEdit_refresh_field(StMXTRA_CompassHeading); | |
367 } | |
368 | |
662 | 369 void refresh_CO2Data(void) |
370 { | |
371 char text[32]; | |
372 | |
373 snprintf(text,32,"\001%c",TXT_CO2Sensor); | |
374 write_topline(text); | |
375 | |
376 snprintf(text,32,"CO2: %d ppm",stateUsed->lifeData.CO2_data.CO2_ppm); | |
377 write_label_var( 30, 800, ME_Y_LINE1, &FontT48, text); | |
378 | |
379 snprintf(text,32,"Signal: %d",stateUsed->lifeData.CO2_data.signalStrength); | |
380 write_label_var( 30, 800, ME_Y_LINE2, &FontT48, text); | |
381 | |
382 tMenuEdit_refresh_field(StMXTRA_CO2_Sensor); | |
383 tMenuEdit_refresh_field(StMXTRA_CO2_Sensor_Calib); | |
384 } | |
385 | |
38 | 386 void openEdit_CompassHeading(void) |
387 { | |
388 write_field_button(StMXTRA_CompassHeading,20, 800, ME_Y_LINE4, &FontT48, "Set"); | |
389 setEvent(StMXTRA_CompassHeading, (uint32_t)OnAction_CompassHeading); | |
390 } | |
391 | |
392 | |
393 uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
394 { | |
272
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
395 stateUsedWrite->diveSettings.compassHeading = (uint16_t)stateUsed->lifeData.compass_heading; |
38 | 396 exitMenuEdit_to_Home_with_Menu_Update(); |
397 return EXIT_TO_HOME; | |
398 } | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
399 |
710 | 400 |
401 uint8_t OnAction_ScrubberTimerId(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
402 { | |
403 char text[32]; | |
404 SSettings *pSettings; | |
405 pSettings = settingsGetPointer(); | |
406 | |
407 if(pSettings->scubberActiveId == 0) | |
408 { | |
409 pSettings->scubberActiveId = 1; | |
410 } | |
411 else | |
412 { | |
413 pSettings->scubberActiveId = 0; | |
414 } | |
415 | |
416 | |
417 snprintf(&text[0], 32,"%c \002#%d",TXT_ScrubTime,pSettings->scubberActiveId); | |
418 tMenuEdit_newButtonText(StMXTRA_ScrubTimer, text); | |
419 | |
420 snprintf(&text[0], 32,\ | |
421 "%c\002%03u\016\016 %c\017" | |
422 ,TXT_ScrubTimeReset | |
423 ,pSettings->scrubberData[pSettings->scubberActiveId].TimerCur | |
424 ,TXT_Minutes); | |
425 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_Reset, text); | |
426 | |
427 tMenuEdit_newInput(StMXTRA_ScrubTimer_Max, pSettings->scrubberData[pSettings->scubberActiveId].TimerMax, 0, 0, 0); | |
428 | |
429 if(pSettings->scrubberData[pSettings->scubberActiveId].lastDive.WeekDay != 0) | |
430 { | |
431 snprintf(&text[0], 32,"%c%c\002 %02d.%02d.%02d", TXT_2BYTE, TXT2BYTE_SimDiveTime, pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Date, | |
432 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Month, | |
433 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Year); | |
434 } | |
435 else | |
436 { | |
437 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime); | |
438 } | |
439 clean_content( 20, 780, ME_Y_LINE4, &FontT48); | |
440 write_label_var( 20, 780, ME_Y_LINE4, &FontT48, text); | |
441 | |
442 return UNSPECIFIC_RETURN; | |
443 } | |
444 | |
445 static uint8_t OnAction_ScrubberTimerMax(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
446 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
447 SSettings *pSettings; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
448 uint8_t digitContentNew = EXIT_TO_MENU; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
449 uint32_t newScrubberTime; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
450 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
451 if(action == ACTION_BUTTON_ENTER) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
452 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
453 return digitContent; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
454 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
455 if(action == ACTION_BUTTON_ENTER_FINAL) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
456 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
457 evaluateNewString(editId, &newScrubberTime, 0, 0, 0); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
458 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
459 if(newScrubberTime > MAX_SCRUBBER_TIME) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
460 newScrubberTime = MAX_SCRUBBER_TIME; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
461 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
462 pSettings = settingsGetPointer(); |
710 | 463 pSettings->scrubberData[pSettings->scubberActiveId].TimerMax = newScrubberTime; |
464 if(pSettings->scrubberData[pSettings->scubberActiveId].TimerCur > newScrubberTime) | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
465 { |
710 | 466 pSettings->scrubberData[pSettings->scubberActiveId].TimerCur = newScrubberTime; |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
467 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
468 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
469 tMenuEdit_newInput(editId, newScrubberTime, 0, 0, 0); |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
470 digitContentNew = UNSPECIFIC_RETURN; |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
471 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
472 if(action == ACTION_BUTTON_NEXT) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
473 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
474 digitContentNew = digitContent + 1; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
475 if(digitContentNew > '9') |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
476 digitContentNew = '0'; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
477 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
478 if(action == ACTION_BUTTON_BACK) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
479 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
480 digitContentNew = digitContent - 1; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
481 if(digitContentNew < '0') |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
482 digitContentNew = '9'; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
483 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
484 return digitContentNew; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
485 } |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
486 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
487 uint8_t OnAction_ScrubberReset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
488 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
489 char text[32]; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
490 SSettings *pSettings; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
491 pSettings = settingsGetPointer(); |
710 | 492 pSettings->scrubberData[pSettings->scubberActiveId].TimerCur = pSettings->scrubberData[pSettings->scubberActiveId].TimerMax; |
493 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.WeekDay = 0; /* invalidate date */ | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
494 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
495 snprintf(&text[0], 32,\ |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
496 "%c\002%03u\016\016 %c\017" |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
497 ,TXT_ScrubTimeReset |
710 | 498 ,pSettings->scrubberData[pSettings->scubberActiveId].TimerCur |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
499 ,TXT_Minutes); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
500 |
710 | 501 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_Reset, text); |
502 | |
503 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime); | |
504 clean_content( 20, 780, ME_Y_LINE4, &FontT48); | |
505 write_label_var( 20, 780, ME_Y_LINE4, &FontT48, text); | |
506 | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
507 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
508 return UNSPECIFIC_RETURN; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
509 } |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
510 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
511 uint8_t OnAction_ScrubberMode(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
512 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
513 char text[32]; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
514 uint8_t newMode; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
515 SSettings *pSettings; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
516 pSettings = settingsGetPointer(); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
517 newMode = pSettings->scrubTimerMode + 1; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
518 if(newMode >= SCRUB_TIMER_END) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
519 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
520 newMode = SCRUB_TIMER_OFF; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
521 } |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
522 pSettings->scrubTimerMode = newMode; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
523 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
524 switch(pSettings->scrubTimerMode) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
525 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
526 case SCRUB_TIMER_OFF: |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
527 default: snprintf(&text[0], 32,"%c\002%c%c",TXT_ScrubTimeMode, TXT_2BYTE, TXT2BYTE_MoCtrlNone ); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
528 break; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
529 case SCRUB_TIMER_MINUTES: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Minutes ); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
530 break; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
531 case SCRUB_TIMER_PERCENT: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Percent ); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
532 break; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
533 } |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
534 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_OP_Mode, text); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
535 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
536 return UNSPECIFIC_RETURN; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
537 } |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
538 |
662 | 539 #ifdef ENABLE_PSCR_MODE |
540 static uint8_t OnAction_PSCRO2Drop(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
541 { | |
542 SSettings *pSettings; | |
543 uint8_t digitContentNew = EXIT_TO_MENU; | |
544 uint32_t newO2Drop; | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
545 |
662 | 546 if(action == ACTION_BUTTON_ENTER) |
547 { | |
548 return digitContent; | |
549 } | |
550 if(action == ACTION_BUTTON_ENTER_FINAL) | |
551 { | |
552 evaluateNewString(editId, &newO2Drop, 0, 0, 0); | |
553 | |
554 if(newO2Drop > PSCR_MAX_O2_DROP) | |
555 newO2Drop = PSCR_MAX_O2_DROP; | |
556 | |
557 pSettings = settingsGetPointer(); | |
558 pSettings->pscr_o2_drop = newO2Drop; | |
559 | |
560 tMenuEdit_newInput(editId, newO2Drop, 0, 0, 0); | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
561 digitContentNew = UNSPECIFIC_RETURN; |
662 | 562 } |
563 if(action == ACTION_BUTTON_NEXT) | |
564 { | |
565 digitContentNew = digitContent + 1; | |
566 if(digitContentNew > '9') | |
567 digitContentNew = '0'; | |
568 } | |
569 if(action == ACTION_BUTTON_BACK) | |
570 { | |
571 digitContentNew = digitContent - 1; | |
572 if(digitContentNew < '0') | |
573 digitContentNew = '9'; | |
574 } | |
575 return digitContentNew; | |
576 } | |
577 | |
578 static uint8_t OnAction_PSCRLungRation(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
579 { | |
580 SSettings *pSettings; | |
581 uint8_t digitContentNew = EXIT_TO_MENU; | |
582 uint32_t newLungRatio; | |
583 | |
584 if(action == ACTION_BUTTON_ENTER) | |
585 { | |
586 return digitContent; | |
587 } | |
588 if(action == ACTION_BUTTON_ENTER_FINAL) | |
589 { | |
590 evaluateNewString(editId, &newLungRatio, 0, 0, 0); | |
591 | |
592 if(newLungRatio > PSCR_MAX_LUNG_RATIO) | |
593 newLungRatio = PSCR_MAX_LUNG_RATIO; | |
594 | |
595 if(newLungRatio < PSCR_MIN_LUNG_RATIO) | |
596 newLungRatio = PSCR_MIN_LUNG_RATIO; | |
597 | |
598 pSettings = settingsGetPointer(); | |
599 pSettings->pscr_lung_ratio = newLungRatio; | |
600 | |
601 tMenuEdit_newInput(editId, newLungRatio, 0, 0, 0); | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
602 digitContentNew = UNSPECIFIC_RETURN; |
662 | 603 } |
604 if(action == ACTION_BUTTON_NEXT) | |
605 { | |
606 digitContentNew = digitContent + 1; | |
607 if(digitContentNew > '9') | |
608 digitContentNew = '0'; | |
609 } | |
610 if(action == ACTION_BUTTON_BACK) | |
611 { | |
612 digitContentNew = digitContent - 1; | |
613 if(digitContentNew < '0') | |
614 digitContentNew = '9'; | |
615 } | |
616 return digitContentNew; | |
617 } | |
618 #endif | |
619 | |
620 #ifdef ENABLE_CO2_SUPPORT | |
621 static uint8_t OnAction_CO2OnOff(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
622 { | |
623 SSettings *pSettings = settingsGetPointer(); | |
624 if(pSettings->co2_sensor_active) | |
625 { | |
626 pSettings->co2_sensor_active = 0; | |
627 tMenuEdit_set_on_off(StMXTRA_CO2_Sensor,0); | |
628 } | |
629 else | |
630 { | |
631 pSettings->co2_sensor_active = 1; | |
632 tMenuEdit_set_on_off(StMXTRA_CO2_Sensor,1); | |
633 } | |
634 return UPDATE_DIVESETTINGS; | |
635 } | |
636 | |
637 static uint8_t OnAction_CO2Calib(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
638 { | |
639 DataEX_setExtInterface_Cmd(EXT_INTERFACE_CO2_CALIB); | |
640 return UPDATE_DIVESETTINGS; | |
641 } | |
642 #endif |