Mercurial > public > ostc4
annotate Discovery/Src/tMenuEditXtra.c @ 701:8c48553a0176
Bugfix display of deactivated sensors:
In the previous version disabled sensors had been show after startup. Rootcause was that the deactivation state was taken from the divesettings instead of the common setting. After startup divesettings are not initialized and therefore all three sensors were displayed even if one or more were disabled. This has been fixed by using the common settings in case that the OSTC is not in divemode.
author | Ideenmodellierer |
---|---|
date | Fri, 28 Oct 2022 19:39:20 +0200 |
parents | 1b995079c045 |
children | e81afd727993 |
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); |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
48 static void openEdit_ScrubberTimer(uint8_t line); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
49 static void openEdit_ScrubberReset(void); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
50 static void openEdit_ScrubberTimerMode(void); |
662 | 51 #ifdef ENABLE_PSCR_MODE |
52 static void openEdit_PSCRO2Drop(uint8_t line); | |
53 static void openEdit_PSCRLungRatio(uint8_t line); | |
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); | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
61 static uint8_t OnAction_ScrubberTimer(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
662 | 62 #ifdef ENABLE_PSCR_MODE |
63 static uint8_t OnAction_PSCRO2Drop(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
64 static uint8_t OnAction_PSCRLungRation(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
65 #endif | |
66 | |
67 #ifdef ENABLE_CO2_SUPPORT | |
68 static uint8_t OnAction_CO2OnOff(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
69 static uint8_t OnAction_CO2Calib(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
70 #endif | |
38 | 71 |
72 /* Exported functions --------------------------------------------------------*/ | |
73 | |
74 void openEdit_Xtra(uint8_t line) | |
75 { | |
76 set_globalState_Menu_Line(line); | |
77 resetMenuEdit(CLUT_MenuPageXtra); | |
78 | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
79 /* DIVE MODE */ |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
80 if(actual_menu_content != MENU_SURFACE) |
38 | 81 { |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
82 switch(line) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
83 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
84 case 1: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
85 default: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
86 openEdit_ResetStopwatch(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
87 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
88 case 2: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
89 openEdit_CompassHeading(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
90 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
91 case 3: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
92 openEdit_SetManualMarker(); |
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 4: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
95 openEdit_CalibViewport(); |
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 5: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
98 if(is_stateUsedSetToSim()) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
99 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
100 openEdit_SimFollowDecostops(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
101 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
102 else |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
103 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
104 openEdit_SetEndDive(); |
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 break; |
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 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
109 else /* surface mode */ |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
110 { |
662 | 111 if((settingsGetPointer()->dive_mode != DIVEMODE_PSCR) && (line > 3)) /* PSCR items are only optional */ |
112 { | |
113 line = 6; | |
114 } | |
115 | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
116 switch(line) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
117 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
118 case 1: openEdit_ScrubberTimer(line); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
119 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
120 case 2: openEdit_ScrubberReset(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
121 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
122 case 3: openEdit_ScrubberTimerMode(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
123 break; |
662 | 124 #ifdef ENABLE_PSCR_MODE |
125 case 4: openEdit_PSCRO2Drop(line); | |
126 break; | |
127 case 5: openEdit_PSCRLungRatio(line); | |
128 break; | |
129 #endif | |
130 #ifdef ENABLE_CO2_SUPPORT | |
131 case 6: openEdit_CO2Sensor(); | |
132 break; | |
133 #endif | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
134 default: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
135 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
136 } |
38 | 137 } |
138 } | |
139 | |
140 /* Private functions ---------------------------------------------------------*/ | |
141 void openEdit_ResetStopwatch(void) | |
142 { | |
143 timer_Stopwatch_Restart(); | |
144 exitMenuEdit_to_Home(); | |
145 } | |
146 | |
147 void openEdit_SetManualMarker(void) | |
148 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
272
diff
changeset
|
149 stateUsedWrite->events.manualMarker = 1; |
38 | 150 exitMenuEdit_to_Home(); |
151 } | |
152 | |
347
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
153 void openEdit_SetEndDive(void) |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
154 { |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
155 dataOutGetPointer()->setEndDive = 1; |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
156 exitMenuEdit_to_Home(); |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
157 } |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
158 |
38 | 159 void openEdit_SimFollowDecostops(void) |
160 { | |
161 simulation_set_heed_decostops(!simulation_get_heed_decostops()); | |
162 exitMenuEdit_to_Menu_with_Menu_Update(); | |
163 } | |
164 | |
547 | 165 void openEdit_CalibViewport(void) |
166 { | |
167 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
|
168 suspendMotionDetection(0); /* exit to focus mode directly */ |
547 | 169 exitMenuEdit_to_Home(); |
170 } | |
171 | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
172 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
173 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
174 static void openEdit_ScrubberTimer(uint8_t line) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
175 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
176 uint16_t localScrubTimer; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
177 uint16_t y_line; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
178 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
179 char text[32]; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
180 SSettings *pSettings = settingsGetPointer(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
181 localScrubTimer = pSettings->scrubTimerMax; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
182 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
183 y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
184 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
185 text[0] = '\001'; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
186 text[1] = TXT_ScrubTime; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
187 text[2] = 0; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
188 write_topline(text); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
189 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
190 text[0] = '\002'; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
191 strcpy(&text[1],"\016\016"); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
192 text[3] = TXT_Minutes; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
193 text[4] = 0; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
194 write_label_fix( 20, 800, y_line, &FontT48, TXT_ScrubTime); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
195 write_label_var( 435, 780, y_line, &FontT48, text); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
196 write_field_udigit(StMXTRA_ScrubTimer_Max_Minutes, 600, 779, y_line, &FontT48, "###", (uint32_t)localScrubTimer, 0, 0, 0); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
197 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
198 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
199 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
200 setEvent(StMXTRA_ScrubTimer_Max_Minutes, (uint32_t)OnAction_ScrubberTimer); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
201 startEdit(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
202 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
203 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
204 static void openEdit_ScrubberReset(void) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
205 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
206 SSettings *pSettings; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
207 pSettings = settingsGetPointer(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
208 pSettings->scrubTimerCur = pSettings->scrubTimerMax; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
209 exitMenuEdit_to_Menu_with_Menu_Update(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
210 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
211 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
212 static void openEdit_ScrubberTimerMode(void) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
213 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
214 uint8_t newMode; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
215 SSettings *pSettings; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
216 pSettings = settingsGetPointer(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
217 newMode = pSettings->scrubTimerMode + 1; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
218 if(newMode >= SCRUB_TIMER_END) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
219 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
220 newMode = SCRUB_TIMER_OFF; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
221 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
222 pSettings->scrubTimerMode = newMode; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
223 exitMenuEdit_to_Menu_with_Menu_Update(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
224 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
225 |
662 | 226 #ifdef ENABLE_PSCR_MODE |
227 static void openEdit_PSCRO2Drop(uint8_t line) | |
228 { | |
229 uint8_t localO2Drop; | |
230 uint16_t y_line; | |
231 | |
232 char text[32]; | |
233 SSettings *pSettings = settingsGetPointer(); | |
234 localO2Drop = pSettings->pscr_o2_drop; | |
235 | |
236 y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP); | |
237 | |
238 text[0] = '\001'; | |
239 text[1] = TXT_PSCRO2Drop; | |
240 text[2] = 0; | |
241 write_topline(text); | |
242 | |
243 text[0] = '\002'; | |
244 text[1] = '\016'; | |
245 text[2] = '\016'; | |
246 text[3] = '%'; | |
247 text[4] = 0; | |
248 write_label_fix( 20, 800, y_line, &FontT48, TXT_PSCRO2Drop); | |
249 write_label_var( 435, 780, y_line, &FontT48, text); | |
250 write_field_udigit(StMXTRA_PSCR_O2_Drop, 710, 779, y_line, &FontT48, "##", (uint32_t)localO2Drop, 0, 0, 0); | |
251 | |
252 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus); | |
253 | |
254 setEvent(StMXTRA_PSCR_O2_Drop, (uint32_t)OnAction_PSCRO2Drop); | |
255 startEdit(); | |
256 } | |
257 | |
258 static void openEdit_PSCRLungRatio(uint8_t line) | |
259 { | |
260 uint8_t localLungRatio; | |
261 uint16_t y_line; | |
262 | |
263 char text[32]; | |
264 SSettings *pSettings = settingsGetPointer(); | |
265 localLungRatio = pSettings->pscr_lung_ratio; | |
266 | |
267 y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP); | |
268 | |
269 text[0] = '\001'; | |
270 text[1] = TXT_PSCRO2Drop; | |
271 text[2] = 0; | |
272 write_topline(text); | |
273 | |
274 text[0] = '\002'; | |
275 text[1] = '1'; | |
276 text[2] = '/'; | |
277 text[3] = 0; | |
278 | |
279 write_label_fix( 20, 800, y_line, &FontT48, TXT_PSCRLungRatio); | |
280 write_label_var( 435, 710, y_line, &FontT48, text); | |
281 write_field_udigit(StMXTRA_PSCR_LUNG_RATIO, 710, 779, y_line, &FontT48, "##", (uint32_t)localLungRatio, 0, 0, 0); | |
282 | |
283 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus); | |
284 | |
285 setEvent(StMXTRA_PSCR_LUNG_RATIO, (uint32_t)OnAction_PSCRLungRation); | |
286 startEdit(); | |
287 } | |
288 #endif | |
289 | |
290 #ifdef ENABLE_CO2_SUPPORT | |
291 static void openEdit_CO2Sensor() | |
292 { | |
293 char text[32]; | |
294 snprintf(text,32,"\001%c",TXT_CO2Sensor); | |
295 write_topline(text); | |
296 | |
297 refresh_CO2Data(); | |
298 if(settingsGetPointer()->co2_sensor_active) | |
299 { | |
300 text[0] = '\005'; | |
301 } | |
302 else | |
303 { | |
304 text[0] = '\006'; | |
305 } | |
306 text[0] = TXT_CO2Sensor; | |
307 text[1] = 0; | |
308 | |
309 write_field_on_off(StMXTRA_CO2_Sensor, 30, 95, ME_Y_LINE3, &FontT48, text, settingsGetPointer()->co2_sensor_active); | |
310 | |
311 text[0] = TXT_2BYTE; | |
312 text[1] = TXT2BYTE_O2Calib; | |
313 text[2] = 0; | |
314 write_field_button(StMXTRA_CO2_Sensor_Calib,30, 800, ME_Y_LINE4, &FontT48, text); | |
315 | |
316 setEvent(StMXTRA_CO2_Sensor, (uint32_t)OnAction_CO2OnOff); | |
317 setEvent(StMXTRA_CO2_Sensor_Calib, (uint32_t)OnAction_CO2Calib); | |
318 | |
319 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
320 } | |
321 #endif | |
322 | |
38 | 323 void refresh_CompassHeading(void) |
324 { | |
325 uint16_t heading; | |
326 char text[32]; | |
327 | |
328 text[0] = '\001'; | |
329 text[1] = TXT_2BYTE; | |
330 text[2] = TXT2BYTE_CompassHeading; | |
331 text[3] = 0; | |
332 write_topline(text); | |
333 | |
334 heading = (uint16_t)stateUsed->lifeData.compass_heading; | |
335 snprintf(text,32,"\001%03i`",heading); | |
336 write_label_var( 0, 800, ME_Y_LINE1, &FontT54, text); | |
337 | |
338 tMenuEdit_refresh_field(StMXTRA_CompassHeading); | |
339 } | |
340 | |
662 | 341 void refresh_CO2Data(void) |
342 { | |
343 char text[32]; | |
344 | |
345 snprintf(text,32,"\001%c",TXT_CO2Sensor); | |
346 write_topline(text); | |
347 | |
348 snprintf(text,32,"CO2: %d ppm",stateUsed->lifeData.CO2_data.CO2_ppm); | |
349 write_label_var( 30, 800, ME_Y_LINE1, &FontT48, text); | |
350 | |
351 snprintf(text,32,"Signal: %d",stateUsed->lifeData.CO2_data.signalStrength); | |
352 write_label_var( 30, 800, ME_Y_LINE2, &FontT48, text); | |
353 | |
354 tMenuEdit_refresh_field(StMXTRA_CO2_Sensor); | |
355 tMenuEdit_refresh_field(StMXTRA_CO2_Sensor_Calib); | |
356 } | |
357 | |
38 | 358 void openEdit_CompassHeading(void) |
359 { | |
360 | |
361 write_field_button(StMXTRA_CompassHeading,20, 800, ME_Y_LINE4, &FontT48, "Set"); | |
362 | |
363 setEvent(StMXTRA_CompassHeading, (uint32_t)OnAction_CompassHeading); | |
364 // startEdit(); | |
365 } | |
366 | |
367 | |
368 uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
369 { | |
272
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
370 stateUsedWrite->diveSettings.compassHeading = (uint16_t)stateUsed->lifeData.compass_heading; |
38 | 371 exitMenuEdit_to_Home_with_Menu_Update(); |
372 return EXIT_TO_HOME; | |
373 } | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
374 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
375 static uint8_t OnAction_ScrubberTimer(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
376 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
377 SSettings *pSettings; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
378 uint8_t digitContentNew = EXIT_TO_MENU; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
379 uint32_t newScrubberTime; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
380 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
381 if(action == ACTION_BUTTON_ENTER) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
382 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
383 return digitContent; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
384 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
385 if(action == ACTION_BUTTON_ENTER_FINAL) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
386 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
387 evaluateNewString(editId, &newScrubberTime, 0, 0, 0); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
388 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
389 if(newScrubberTime > MAX_SCRUBBER_TIME) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
390 newScrubberTime = MAX_SCRUBBER_TIME; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
391 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
392 pSettings = settingsGetPointer(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
393 pSettings->scrubTimerMax = newScrubberTime; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
394 if(pSettings->scrubTimerCur > newScrubberTime) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
395 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
396 pSettings->scrubTimerCur = newScrubberTime; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
397 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
398 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
399 tMenuEdit_newInput(editId, newScrubberTime, 0, 0, 0); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
400 digitContentNew = UPDATE_AND_EXIT_TO_MENU; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
401 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
402 if(action == ACTION_BUTTON_NEXT) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
403 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
404 digitContentNew = digitContent + 1; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
405 if(digitContentNew > '9') |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
406 digitContentNew = '0'; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
407 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
408 if(action == ACTION_BUTTON_BACK) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
409 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
410 digitContentNew = digitContent - 1; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
411 if(digitContentNew < '0') |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
412 digitContentNew = '9'; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
413 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
414 return digitContentNew; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
415 } |
662 | 416 #ifdef ENABLE_PSCR_MODE |
417 static uint8_t OnAction_PSCRO2Drop(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
418 { | |
419 SSettings *pSettings; | |
420 uint8_t digitContentNew = EXIT_TO_MENU; | |
421 uint32_t newO2Drop; | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
422 |
662 | 423 if(action == ACTION_BUTTON_ENTER) |
424 { | |
425 return digitContent; | |
426 } | |
427 if(action == ACTION_BUTTON_ENTER_FINAL) | |
428 { | |
429 evaluateNewString(editId, &newO2Drop, 0, 0, 0); | |
430 | |
431 if(newO2Drop > PSCR_MAX_O2_DROP) | |
432 newO2Drop = PSCR_MAX_O2_DROP; | |
433 | |
434 pSettings = settingsGetPointer(); | |
435 pSettings->pscr_o2_drop = newO2Drop; | |
436 | |
437 tMenuEdit_newInput(editId, newO2Drop, 0, 0, 0); | |
438 digitContentNew = UPDATE_AND_EXIT_TO_MENU; | |
439 } | |
440 if(action == ACTION_BUTTON_NEXT) | |
441 { | |
442 digitContentNew = digitContent + 1; | |
443 if(digitContentNew > '9') | |
444 digitContentNew = '0'; | |
445 } | |
446 if(action == ACTION_BUTTON_BACK) | |
447 { | |
448 digitContentNew = digitContent - 1; | |
449 if(digitContentNew < '0') | |
450 digitContentNew = '9'; | |
451 } | |
452 return digitContentNew; | |
453 } | |
454 | |
455 static uint8_t OnAction_PSCRLungRation(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
456 { | |
457 SSettings *pSettings; | |
458 uint8_t digitContentNew = EXIT_TO_MENU; | |
459 uint32_t newLungRatio; | |
460 | |
461 if(action == ACTION_BUTTON_ENTER) | |
462 { | |
463 return digitContent; | |
464 } | |
465 if(action == ACTION_BUTTON_ENTER_FINAL) | |
466 { | |
467 evaluateNewString(editId, &newLungRatio, 0, 0, 0); | |
468 | |
469 if(newLungRatio > PSCR_MAX_LUNG_RATIO) | |
470 newLungRatio = PSCR_MAX_LUNG_RATIO; | |
471 | |
472 if(newLungRatio < PSCR_MIN_LUNG_RATIO) | |
473 newLungRatio = PSCR_MIN_LUNG_RATIO; | |
474 | |
475 pSettings = settingsGetPointer(); | |
476 pSettings->pscr_lung_ratio = newLungRatio; | |
477 | |
478 tMenuEdit_newInput(editId, newLungRatio, 0, 0, 0); | |
479 digitContentNew = UPDATE_AND_EXIT_TO_MENU; | |
480 } | |
481 if(action == ACTION_BUTTON_NEXT) | |
482 { | |
483 digitContentNew = digitContent + 1; | |
484 if(digitContentNew > '9') | |
485 digitContentNew = '0'; | |
486 } | |
487 if(action == ACTION_BUTTON_BACK) | |
488 { | |
489 digitContentNew = digitContent - 1; | |
490 if(digitContentNew < '0') | |
491 digitContentNew = '9'; | |
492 } | |
493 return digitContentNew; | |
494 } | |
495 #endif | |
496 | |
497 #ifdef ENABLE_CO2_SUPPORT | |
498 static uint8_t OnAction_CO2OnOff(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
499 { | |
500 SSettings *pSettings = settingsGetPointer(); | |
501 if(pSettings->co2_sensor_active) | |
502 { | |
503 pSettings->co2_sensor_active = 0; | |
504 tMenuEdit_set_on_off(StMXTRA_CO2_Sensor,0); | |
505 } | |
506 else | |
507 { | |
508 pSettings->co2_sensor_active = 1; | |
509 tMenuEdit_set_on_off(StMXTRA_CO2_Sensor,1); | |
510 } | |
511 return UPDATE_DIVESETTINGS; | |
512 } | |
513 | |
514 static uint8_t OnAction_CO2Calib(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
515 { | |
516 DataEX_setExtInterface_Cmd(EXT_INTERFACE_CO2_CALIB); | |
517 return UPDATE_DIVESETTINGS; | |
518 } | |
519 #endif |