Mercurial > public > ostc4
annotate Discovery/Src/tMenuEditGasOC.c @ 774:6169309d6eb9
more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
author | heinrichsweikamp |
---|---|
date | Wed, 10 May 2023 16:25:39 +0200 |
parents | 2c243233c999 |
children | b7d93ff6b3b2 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenuEditGasOC.c | |
5 /// \brief Main Template file for editing Open Circuit Gas Settings | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 09-July-2014 | |
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 "tMenuEditGasOC.h" | |
31 | |
32 #include "check_warning.h" | |
33 #include "gfx_fonts.h" | |
34 #include "tMenuEdit.h" | |
35 #include "unit.h" | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
36 #include "configuration.h" |
38 | 37 |
38 /* Private types -------------------------------------------------------------*/ | |
39 typedef struct | |
40 { | |
41 uint8_t gasID; | |
42 SGasLine * pGasLine; | |
43 uint8_t mod; | |
44 uint8_t ccr; | |
45 uint8_t setpoint; | |
46 } SEditGasPage; | |
47 | |
48 | |
49 /* Private variables ---------------------------------------------------------*/ | |
50 SEditGasPage editGasPage; | |
51 | |
52 /* Private function prototypes -----------------------------------------------*/ | |
53 void create_text_with_u8(char *text, const char *text1, uint8_t inputU8, const char *text2); | |
54 | |
55 void openEdit_Gas(uint8_t line, uint8_t ccr); | |
56 void openEdit_GasType(void); | |
57 | |
58 void openEdit_DiveGasSelect(uint8_t line, uint8_t ccr); | |
59 void openEdit_SpecialDiveGasMenu(uint8_t ccr); | |
60 void openEdit_DiveGasSelect_Subroutine(uint8_t line, uint8_t ccr); | |
61 | |
62 void tMEGas_check_switch_to_bailout(void); | |
63 | |
64 /* Announced function prototypes -----------------------------------------------*/ | |
65 uint8_t OnAction_Mix (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
66 uint8_t OnAction_GasType (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
67 uint8_t OnAction_ChangeDepth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
68 uint8_t OnAction_SetToMOD (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
69 uint8_t OnAction_BottleSize (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
70 | |
71 uint8_t OnAction_First (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
72 uint8_t OnAction_Deco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
73 uint8_t OnAction_Travel (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
74 uint8_t OnAction_Inactive (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
75 uint8_t OnAction_Off (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
38 | 76 |
77 uint8_t OnAction_DM_Active (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
78 uint8_t OnAction_DM_Mix (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
79 | |
80 /* | |
81 uint8_t OnAction_DefaultMix (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
82 uint8_t OnAction_ToggleDepth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
83 uint8_t OnAction_ToggleDefault (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
84 uint8_t OnAction_DefaultDepth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
85 */ | |
86 | |
87 /* Exported functions --------------------------------------------------------*/ | |
88 | |
89 void openEdit_GasCC(uint8_t line) | |
90 { | |
91 if(actual_menu_content == MENU_SURFACE) | |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
92 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
93 if(line == 6) |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
94 { |
662 | 95 if(isLoopMode(settingsGetPointer()->dive_mode) || (stateUsed->diveSettings.ccrOption == 1)) |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
96 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
97 selectPage(StMOG); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
98 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
99 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
100 else |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
101 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
102 openEdit_Gas(line , 1); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
103 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
104 } |
38 | 105 else |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
106 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
107 if(line == 6) |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
108 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
109 openEdit_SpecialDiveGasMenu(1); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
110 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
111 else |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
112 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
113 openEdit_DiveGasSelect(line, 1); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
114 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
115 } |
38 | 116 } |
117 | |
118 | |
119 void openEdit_GasOC(uint8_t line) | |
120 { | |
121 if(actual_menu_content == MENU_SURFACE) | |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
122 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
123 if(line == 6) |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
124 { |
662 | 125 if(isLoopMode(settingsGetPointer()->dive_mode) || (stateUsed->diveSettings.ccrOption == 1)) |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
126 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
127 selectPage(StMCG); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
128 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
129 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
130 else |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
131 { |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
132 openEdit_Gas(line, 0); |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
133 } |
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
134 } |
38 | 135 else |
136 if(line == 6) | |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
137 { |
38 | 138 openEdit_SpecialDiveGasMenu(0); |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
139 } |
38 | 140 else |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
141 { |
38 | 142 openEdit_DiveGasSelect(line, 0); |
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
528
diff
changeset
|
143 } |
38 | 144 } |
145 | |
146 | |
147 /* dive mode */ | |
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
735
diff
changeset
|
148 void openEdit_DiveSelectBetterGas(bool doBailout) |
38 | 149 { |
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
735
diff
changeset
|
150 uint8_t gasId; |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
735
diff
changeset
|
151 if (doBailout) { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
735
diff
changeset
|
152 gasId = actualBetterBailoutGasId(); |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
735
diff
changeset
|
153 } else { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
735
diff
changeset
|
154 gasId = actualBetterGasId(); |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
735
diff
changeset
|
155 } |
38 | 156 |
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
735
diff
changeset
|
157 uint8_t ccr = 0; |
38 | 158 if(gasId>5) |
159 { | |
160 gasId -= 5; | |
161 ccr = 1; | |
162 } | |
163 openEdit_DiveGasSelect_Subroutine(gasId,ccr); | |
164 if(ccr) | |
165 updateSpecificMenu(StMCG); // is this necessary? openEdit_DiveGasSelect_Subroutine has update. hw 151209 | |
166 else | |
167 updateSpecificMenu(StMOG); // is this necessary? openEdit_DiveGasSelect_Subroutine has update. hw 151209 | |
168 } | |
169 | |
170 | |
171 /* select gas in divemode */ | |
172 void openEdit_DiveGasSelect(uint8_t line, uint8_t ccr) | |
173 { | |
682 | 174 if(!ccr) |
175 { | |
176 tMEGas_check_switch_to_bailout(); | |
177 } | |
178 openEdit_DiveGasSelect_Subroutine(line, ccr); | |
179 | |
38 | 180 exitMenuEdit_to_Home_with_Menu_Update(); |
181 } | |
182 | |
183 | |
184 void openEdit_DiveGasSelect_Subroutine(uint8_t line, uint8_t ccr) | |
185 { | |
186 uint8_t setpoint; | |
187 | |
699 | 188 editGasPage.pGasLine = (SGasLine *)stateUsed->diveSettings.gas; |
38 | 189 |
190 if(ccr) | |
191 { | |
192 editGasPage.gasID = line + NUM_OFFSET_DILUENT; | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
149
diff
changeset
|
193 setpoint = stateUsed->lifeData.actualGas.setPoint_cbar; |
38 | 194 } |
195 else | |
196 { | |
197 editGasPage.gasID = line; | |
198 setpoint = 0; | |
199 } | |
200 | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
201 #ifdef ENABLE_UNUSED_GAS_HIDING |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
202 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.off) /* disable selection of switched off gases */ |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
203 { |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
204 return; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
205 } |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
206 #endif |
38 | 207 for(int i=0;i<(1+ (2*NUM_GASES));i++) |
208 editGasPage.pGasLine[i].note.ub.first = 0; | |
209 | |
210 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1; | |
211 editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 1; | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
149
diff
changeset
|
212 setActualGas_DM(&stateUsedWrite->lifeData,editGasPage.gasID,setpoint); |
38 | 213 } |
214 | |
215 /* extra gas and gas on/off option */ | |
216 void openEdit_SpecialDiveGasMenu(uint8_t ccr) | |
217 { | |
218 char text[32]; | |
219 uint8_t oxygen, helium, gasOffset, textpointer, lineCount, ptrGas; | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
149
diff
changeset
|
220 //SDiveState * pState; |
38 | 221 |
699 | 222 editGasPage.pGasLine = (SGasLine *)stateUsed->diveSettings.gas; |
38 | 223 if(ccr) |
224 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
149
diff
changeset
|
225 editGasPage.setpoint = stateUsed->lifeData.actualGas.setPoint_cbar; |
38 | 226 } |
227 editGasPage.ccr = ccr; | |
228 | |
229 set_globalState_Menu_Line(6); | |
230 | |
231 if(ccr) | |
232 resetMenuEdit(CLUT_MenuPageGasCC); | |
233 else | |
234 resetMenuEdit(CLUT_MenuPageGasOC); | |
235 | |
236 if(ccr) | |
237 gasOffset = NUM_OFFSET_DILUENT; | |
238 else | |
239 gasOffset = 0; | |
240 | |
241 | |
242 text[0] = '\001'; | |
243 text[1] = TXT_2BYTE; | |
244 if(ccr) | |
245 text[2] = TXT2BYTE_SpecialDiveGasMenuCCR; | |
246 else | |
247 text[2] = TXT2BYTE_SpecialDiveGasMenu; | |
248 text[3] = 0; | |
249 write_topline(text); | |
250 | |
251 lineCount = 1; | |
252 | |
253 | |
254 for(int i=1; i<=5; i++) | |
255 { | |
256 ptrGas = i + gasOffset; | |
257 oxygen = stateUsed->diveSettings.gas[ptrGas].oxygen_percentage; | |
258 helium = stateUsed->diveSettings.gas[ptrGas].helium_percentage; | |
259 | |
260 if(oxygen == 100) | |
261 textpointer = snprintf(text,10,"Oxy"); | |
262 else | |
263 if((oxygen == 21) && (helium == 0)) | |
264 textpointer = snprintf(text,10,"Air"); | |
265 else | |
266 textpointer = snprintf(text,10,"%02i/%02i",oxygen,helium); | |
267 | |
268 if(editGasPage.pGasLine[ptrGas].note.ub.first) | |
269 strcpy(&text[textpointer]," *"); | |
270 | |
271 write_field_on_off(StMOG_DM_ActiveBase+i, 30, 500, ME_Y_LINE_BASE + (lineCount * ME_Y_LINE_STEP), &FontT48, text, stateUsed->diveSettings.gas[ptrGas].note.ub.active); | |
272 lineCount++; | |
273 } | |
274 | |
275 if(!ccr) | |
276 { | |
277 if(stateUsed->diveSettings.gas[0].note.ub.first) | |
278 { | |
279 oxygen = stateUsed->diveSettings.gas[0].oxygen_percentage; | |
280 helium = stateUsed->diveSettings.gas[0].helium_percentage; | |
281 write_field_udigit(StMOG_DM_ExtraMix, 30, 800, ME_Y_LINE6, &FontT48, "##/## Extra Gas *", oxygen, helium, 0, 0); | |
282 } | |
283 else | |
284 { | |
285 write_field_udigit(StMOG_DM_ExtraMix, 30, 800, ME_Y_LINE6, &FontT48, "##/## Extra Gas", 0, 0, 0, 0); | |
286 } | |
287 } | |
288 | |
289 for(int i=1; i<=5; i++) | |
290 { | |
291 setEvent(StMOG_DM_ActiveBase + i,(uint32_t)OnAction_DM_Active); | |
292 } | |
293 | |
294 if(!ccr) | |
295 setEvent(StMOG_DM_ExtraMix,(uint32_t)OnAction_DM_Mix); | |
296 } | |
297 | |
298 | |
299 uint8_t OnAction_DM_Active (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
300 { | |
301 uint8_t gasOffset, newActive; | |
302 | |
303 if(editGasPage.ccr) | |
304 gasOffset = NUM_OFFSET_DILUENT; | |
305 else | |
306 gasOffset = 0; | |
307 | |
308 editGasPage.gasID = editId + gasOffset - StMOG_DM_ActiveBase; | |
309 | |
310 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.first) | |
311 return UNSPECIFIC_RETURN; | |
312 | |
313 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.active) | |
314 newActive = 0; | |
315 else | |
316 newActive = 1; | |
317 | |
318 tMenuEdit_set_on_off(editId, newActive); | |
319 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = newActive; | |
320 | |
321 return UNSPECIFIC_RETURN; | |
322 } | |
323 | |
324 /* only for OC */ | |
325 uint8_t OnAction_DM_Mix(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
326 { | |
327 uint8_t digitContentNew; | |
328 uint32_t newOxygen, newHelium; | |
329 | |
330 if(action == ACTION_BUTTON_ENTER) | |
331 { | |
332 return digitContent; | |
333 } | |
334 if(action == ACTION_BUTTON_ENTER_FINAL) | |
335 { | |
336 evaluateNewString(editId, &newOxygen, &newHelium, 0, 0); | |
337 | |
338 if(newOxygen < 5) | |
339 newOxygen = 5; | |
340 if(newOxygen == 99) | |
341 newOxygen = 100; | |
342 if(newHelium > 95) | |
343 newHelium = 95; | |
344 if((newOxygen + newHelium) > 100) | |
345 newOxygen = 100 - newHelium; | |
346 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
149
diff
changeset
|
347 //SDiveState * pDiveState = 0; |
38 | 348 |
349 for(int i=1;i<=(2*NUM_GASES);i++) | |
350 editGasPage.pGasLine[i].note.ub.first = 0; | |
351 | |
735
39f48356049b
Fixed invalid setpoint (0.0) used after switch from CCR to extra (OC) gas
heinrichsweikamp
parents:
699
diff
changeset
|
352 tMEGas_check_switch_to_bailout(); |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
149
diff
changeset
|
353 setActualGas_ExtraGas(&stateUsedWrite->lifeData, newOxygen, newHelium, 0); |
38 | 354 return EXIT_TO_HOME; |
355 } | |
356 if(action == ACTION_BUTTON_NEXT) | |
357 { | |
358 digitContentNew = digitContent + 1; | |
359 if(digitContentNew > '9') | |
360 digitContentNew = '0'; | |
361 return digitContentNew; | |
362 } | |
363 if(action == ACTION_BUTTON_BACK) | |
364 { | |
365 digitContentNew = digitContent - 1; | |
366 if(digitContentNew < '0') | |
367 digitContentNew = '9'; | |
368 return digitContentNew; | |
369 } | |
370 | |
371 return UNSPECIFIC_RETURN; | |
372 } | |
373 | |
374 | |
375 void tMEGas_check_switch_to_bailout(void) | |
376 { | |
662 | 377 if(isLoopMode(stateUsed->diveSettings.diveMode)) |
38 | 378 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
149
diff
changeset
|
379 stateUsedWrite->diveSettings.diveMode = DIVEMODE_OC; |
38 | 380 block_diluent_page(); |
381 } | |
382 } | |
383 | |
384 | |
385 /* surface mode */ | |
386 void openEdit_Gas(uint8_t line, uint8_t ccr) | |
387 { | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
388 uint8_t gasID, oxygen, helium, depthDeco, active, first, depthMOD, deco, travel, inactive, off;//, bottleSizeLiter; |
38 | 389 |
390 char text[32]; | |
391 char textMOD[32]; | |
392 uint8_t txtptr; | |
393 | |
394 if(line) | |
395 set_globalState_Menu_Line(line); | |
396 else | |
397 set_globalState_Menu_Line(NUM_GASES + 1); | |
398 | |
399 if(ccr) | |
400 resetMenuEdit(CLUT_MenuPageGasCC); | |
401 else | |
402 resetMenuEdit(CLUT_MenuPageGasOC); | |
403 | |
404 if(ccr) | |
405 gasID = line + NUM_OFFSET_DILUENT; | |
406 else | |
407 gasID = line; | |
408 | |
409 editGasPage.ccr = ccr; | |
410 editGasPage.gasID = gasID; | |
411 editGasPage.mod = calc_MOD(gasID); | |
412 | |
413 SSettings *data = settingsGetPointer(); | |
414 editGasPage.pGasLine = data->gas; | |
415 | |
416 oxygen = editGasPage.pGasLine[gasID].oxygen_percentage; | |
417 if(oxygen > 99) | |
418 oxygen = 99; | |
419 helium = editGasPage.pGasLine[gasID].helium_percentage; | |
420 depthDeco = editGasPage.pGasLine[gasID].depth_meter; | |
421 //depthTravel = editGasPage.pGasLine[gasID].depth_meter_travel; | |
422 active = editGasPage.pGasLine[gasID].note.ub.active; | |
423 first = editGasPage.pGasLine[gasID].note.ub.first; | |
424 deco = editGasPage.pGasLine[gasID].note.ub.deco; | |
425 travel = editGasPage.pGasLine[gasID].note.ub.travel; | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
426 off = editGasPage.pGasLine[gasID].note.ub.off; |
38 | 427 //bottleSizeLiter = editGasPage.pGasLine[gasID].bottle_size_liter; |
428 | |
429 if(active) | |
430 inactive = 0; | |
431 else | |
432 inactive = 1; | |
433 | |
434 depthMOD = editGasPage.mod; | |
435 | |
436 int i = 0; | |
437 if(gasID >= 10) | |
438 { | |
439 i = 1; | |
440 strcpy(text, "\001" "Gas #10 X"); | |
441 } | |
442 else | |
443 strcpy(text, "\001" "Gas #0 X"); | |
444 | |
445 if(ccr) | |
446 text[8+i] = TXT_Diluent_Gas_Edit; | |
447 else | |
448 text[8+i] = TXT_OC_Gas_Edit; | |
449 | |
450 if(gasID >= 10) | |
451 text[6+i] += gasID - 10; | |
452 else | |
453 text[6+i] += gasID; | |
454 | |
455 write_topline(text); | |
456 if(actual_menu_content == MENU_SURFACE) | |
457 { | |
458 write_label_fix( 20, 800, ME_Y_LINE1, &FontT48, TXT_Mix); | |
459 write_field_udigit(StMOG_Mix, 210, 400, ME_Y_LINE1, &FontT48, "##/##", (uint32_t)oxygen, (uint32_t)helium, 0, 0); | |
460 | |
461 | |
462 text[1] = 0; | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
463 if(off) |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
464 text[0] = TXT_Off; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
465 else |
38 | 466 if(inactive) |
467 text[0] = TXT_Inactive; | |
468 else | |
469 if(first) | |
470 text[0] = TXT_First; | |
471 else | |
472 if(deco) | |
473 text[0] = TXT_Deco; | |
474 else | |
475 if(travel) | |
476 text[0] = TXT_Travel; | |
477 else | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
478 text[0] = TXT_Inactive; |
38 | 479 |
480 write_field_button(StMOG_GasType, 20, 710, ME_Y_LINE2, &FontT48, text); | |
481 | |
482 | |
483 if(deco) | |
484 { | |
485 text[0] = TXT_ChangeDepth; | |
486 text[1] = ' '; | |
487 text[2] = TXT_Deco; | |
488 text[3] = 0; | |
489 write_label_var( 20 ,800, ME_Y_LINE3, &FontT48, text); | |
490 | |
491 textMOD[0] = '#'; | |
492 textMOD[1] = '#'; | |
493 textMOD[2] = '#'; | |
494 textMOD[3] = unit_depth_char1(); | |
495 textMOD[4] = unit_depth_char2(); | |
496 textMOD[5] = 0; | |
497 write_field_udigit(StMOG_ChangeDepth, 600, 710, ME_Y_LINE3, &FontT48,textMOD, (uint32_t)unit_depth_integer(depthDeco), 0, 0, 0); | |
498 | |
499 txtptr = 0; | |
500 text[txtptr++] = TXT_2BYTE; | |
501 text[txtptr++] = TXT2BYTE_SetToMOD; | |
502 text[txtptr++] = 0; | |
503 write_field_button(StMOG_SetToMOD, 20, 710, ME_Y_LINE4, &FontT48,text); | |
504 } | |
505 else | |
506 { | |
507 txtptr = 0; | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
508 text[txtptr++] = '\031'; |
38 | 509 text[txtptr++] = TXT_ChangeDepth; |
510 text[txtptr++] = ' '; | |
511 text[txtptr++] = TXT_Deco; | |
512 text[txtptr++] = 0; | |
513 write_label_var( 20 ,800, ME_Y_LINE3, &FontT48, text); | |
514 | |
515 txtptr = 0; | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
516 text[txtptr++] = '\031'; |
38 | 517 text[txtptr++] = TXT_2BYTE; |
518 text[txtptr++] = TXT2BYTE_SetToMOD; | |
519 text[txtptr++] = 0; | |
520 write_label_var( 20 ,800, ME_Y_LINE4, &FontT48, text); | |
521 } | |
522 /* | |
523 txtptr = 0; | |
524 text[txtptr++] = TXT_2BYTE; | |
525 text[txtptr++] = TXT2BYTE_Bottle; | |
526 text[txtptr++] = 0; | |
527 write_label_var( 20 ,800, ME_Y_LINE5, &FontT48, text); | |
528 write_field_2digit(StMOG_Bottle, 600, 710, ME_Y_LINE5, &FontT48,"## ltr", (uint32_t)bottleSizeLiter, 0, 0, 0); | |
529 | |
530 */ | |
531 stop_cursor_fields(); | |
532 | |
533 textMOD[0] = '#'; | |
534 textMOD[1] = '#'; | |
535 textMOD[2] = '#'; | |
536 textMOD[3] = unit_depth_char1(); | |
537 textMOD[4] = unit_depth_char2(); | |
538 textMOD[5] = ' '; | |
539 textMOD[6] = 'M'; | |
540 textMOD[7] = 'O'; | |
541 textMOD[8] = 'D'; | |
542 textMOD[9] = 0; | |
543 | |
544 write_field_udigit(StMOG_MOD, 401, 780, ME_Y_LINE1, &FontT48, textMOD, (uint32_t)unit_depth_integer(depthMOD), 0, 0, 0); | |
545 // write_field_udigit(StMOG_MOD, 401, 780, ME_Y_LINE1, &FontT48, "###m MOD", (uint32_t)depthMOD, 0, 0, 0); | |
546 | |
547 setEvent(StMOG_Mix, (uint32_t)OnAction_Mix); | |
548 setEvent(StMOG_GasType, (uint32_t)OnAction_GasType); | |
549 | |
550 if(deco) | |
551 { | |
552 setEvent(StMOG_ChangeDepth, (uint32_t)OnAction_ChangeDepth); | |
553 setEvent(StMOG_SetToMOD, (uint32_t)OnAction_SetToMOD); | |
554 } | |
555 /* | |
556 setEvent(StMOG_Bottle, (uint32_t)OnAction_BottleSize); | |
557 */ | |
558 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
559 } | |
560 } | |
561 | |
562 /* surface mode */ | |
563 void openEdit_GasType(void) | |
564 { | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
565 uint8_t gasID, active, first, deco, travel, inactive, off; |
38 | 566 char text[32]; |
567 | |
568 | |
569 if(editGasPage.ccr) | |
570 { | |
571 resetMenuEdit(CLUT_MenuPageGasCC); | |
572 setBackMenu((uint32_t)openEdit_GasCC, editGasPage.gasID - NUM_OFFSET_DILUENT, 2); | |
573 } | |
574 else | |
575 { | |
576 resetMenuEdit(CLUT_MenuPageGasOC); | |
577 setBackMenu((uint32_t)openEdit_GasOC, editGasPage.gasID, 2); | |
578 } | |
579 | |
580 gasID = editGasPage.gasID; | |
581 active = editGasPage.pGasLine[gasID].note.ub.active; | |
582 first = editGasPage.pGasLine[gasID].note.ub.first; | |
583 deco = editGasPage.pGasLine[gasID].note.ub.deco; | |
584 travel = editGasPage.pGasLine[gasID].note.ub.travel; | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
585 off = editGasPage.pGasLine[gasID].note.ub.off; |
38 | 586 |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
587 if((active) || (off)) |
38 | 588 inactive = 0; |
589 else | |
590 inactive = 1; | |
591 | |
592 | |
593 /* header */ | |
594 int i = 0; | |
595 if(gasID >= 10) | |
596 { | |
597 i = 1; | |
598 strcpy(text, "\001" "Gas #10 X"); | |
599 } | |
600 else | |
601 strcpy(text, "\001" "Gas #0 X"); | |
602 | |
603 if(editGasPage.ccr) | |
604 text[8+i] = TXT_Diluent_Gas_Edit; | |
605 else | |
606 text[8+i] = TXT_OC_Gas_Edit; | |
607 | |
608 if(gasID >= 10) | |
609 text[6+i] += gasID - 10; | |
610 else | |
611 text[6+i] += gasID; | |
612 write_topline(text); | |
613 | |
614 text[1] = 0; | |
615 text[0] = TXT_First; | |
616 write_field_on_off(StMOG_First, 30, 400, ME_Y_LINE1, &FontT48, text, first); | |
617 | |
618 text[0] = TXT_Deco; | |
619 write_field_on_off(StMOG_Deco, 30, 400, ME_Y_LINE2, &FontT48, text, deco); | |
620 | |
621 text[0] = TXT_Travel; | |
622 write_field_on_off(StMOG_Travel, 30, 400, ME_Y_LINE3, &FontT48, text, travel); | |
623 | |
624 text[0] = TXT_Inactive; | |
625 write_field_on_off(StMOG_Inactive, 30, 400, ME_Y_LINE4, &FontT48, text, inactive); | |
626 | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
627 #ifdef ENABLE_UNUSED_GAS_HIDING |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
628 text[0] = TXT_Off; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
629 write_field_on_off(StMOG_Off, 30, 400, ME_Y_LINE5, &FontT48, text, off); |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
630 #endif |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
631 |
38 | 632 setEvent(StMOG_First, (uint32_t)OnAction_First); |
633 setEvent(StMOG_Deco, (uint32_t)OnAction_Deco); | |
634 setEvent(StMOG_Travel, (uint32_t)OnAction_Travel); | |
635 setEvent(StMOG_Inactive, (uint32_t)OnAction_Inactive); | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
636 #ifdef ENABLE_UNUSED_GAS_HIDING |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
637 setEvent(StMOG_Off, (uint32_t)OnAction_Off); |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
638 #endif |
38 | 639 |
640 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
641 } | |
642 | |
643 uint8_t OnAction_GasType(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
644 { | |
645 openEdit_GasType(); | |
646 return UNSPECIFIC_RETURN; | |
647 } | |
648 | |
649 uint8_t OnAction_Mix(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
650 { | |
651 uint8_t digitContentNew; | |
652 uint32_t newOxygen, newHelium; | |
653 | |
654 if(action == ACTION_BUTTON_ENTER) | |
655 { | |
656 return digitContent; | |
657 } | |
658 if(action == ACTION_BUTTON_ENTER_FINAL) | |
659 { | |
660 evaluateNewString(editId, &newOxygen, &newHelium, 0, 0); | |
661 | |
662 if(newOxygen < 5) | |
663 newOxygen = 5; | |
664 if(newOxygen == 99) | |
665 newOxygen = 100; | |
666 if(newHelium > 95) | |
667 newHelium = 95; | |
668 if((newOxygen + newHelium) > 100) | |
669 newOxygen = 100 - newHelium; | |
670 | |
671 editGasPage.pGasLine[editGasPage.gasID].oxygen_percentage = newOxygen; | |
672 editGasPage.pGasLine[editGasPage.gasID].helium_percentage = newHelium; | |
673 editGasPage.mod = calc_MOD(editGasPage.gasID); | |
674 | |
675 if(newOxygen == 100) | |
676 newOxygen = 99; | |
677 | |
678 tMenuEdit_newInput(editId, newOxygen, newHelium, 0, 0); | |
679 tMenuEdit_newInput(StMOG_MOD, (uint32_t)unit_depth_integer(editGasPage.mod), 0, 0, 0); | |
680 | |
681 return UPDATE_DIVESETTINGS; | |
682 } | |
683 if(action == ACTION_BUTTON_NEXT) | |
684 { | |
685 digitContentNew = digitContent + 1; | |
686 if(digitContentNew > '9') | |
687 digitContentNew = '0'; | |
688 return digitContentNew; | |
689 } | |
690 if(action == ACTION_BUTTON_BACK) | |
691 { | |
692 digitContentNew = digitContent - 1; | |
693 if(digitContentNew < '0') | |
694 digitContentNew = '9'; | |
695 return digitContentNew; | |
696 } | |
697 | |
698 return UNSPECIFIC_RETURN; | |
699 } | |
700 | |
701 /* | |
702 uint8_t OnAction_DefaultMix(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
703 { | |
704 uint32_t newOxygen, newHelium; | |
705 uint8_t depthDEFAULT; | |
706 char text[32]; | |
707 | |
708 newOxygen = 21; | |
709 newHelium = 0; | |
710 | |
711 editGasPage.pGasLine[editGasPage.gasID].oxygen_percentage = newOxygen; | |
712 editGasPage.pGasLine[editGasPage.gasID].helium_percentage = newHelium; | |
713 | |
714 tMenuEdit_newInput(StMOG_Mix, newOxygen, newHelium, 0, 0); | |
715 | |
716 depthDEFAULT = calc_MOD(editGasPage.gasID); | |
717 create_text_with_u8(text, "", depthDEFAULT, "m MOD"); | |
718 tMenuEdit_newButtonText(StMOG_DefaultDepth, text); | |
719 | |
720 return UPDATE_DIVESETTINGS; | |
721 } | |
722 | |
723 uint8_t OnAction_ToggleDepth(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
724 { | |
725 uint8_t depth; | |
726 uint32_t newDefaultDepth; | |
727 char text[32]; | |
728 | |
729 if(editGasPage.depth_mode == 0) | |
730 { | |
731 editGasPage.depth_mode = 1; | |
732 depth = editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel; | |
733 newDefaultDepth = calc_MinOD(editGasPage.gasID); | |
734 create_text_with_u8(text, "", newDefaultDepth, "m Min"); | |
735 } | |
736 else | |
737 { | |
738 editGasPage.depth_mode = 0; | |
739 depth = editGasPage.pGasLine[editGasPage.gasID].depth_meter; | |
740 newDefaultDepth = calc_MOD(editGasPage.gasID); | |
741 create_text_with_u8(text, "", newDefaultDepth, "m MOD"); | |
742 } | |
743 tMenuEdit_newInput(StMOG_Depth, (uint32_t)depth, 0, 0, 0); | |
744 tMenuEdit_newButtonText(StMOG_DefaultDepth, text); | |
745 | |
746 return UNSPECIFIC_RETURN; | |
747 } | |
748 | |
749 | |
750 uint8_t OnAction_Depth(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
751 { | |
752 uint8_t digitContentNew; | |
753 uint32_t newDepth; | |
754 | |
755 if(action == ACTION_BUTTON_ENTER) | |
756 { | |
757 return digitContent; | |
758 } | |
759 if(action == ACTION_BUTTON_ENTER_FINAL) | |
760 { | |
761 evaluateNewString(editId, &newDepth, 0, 0, 0); | |
762 if(newDepth > 255) | |
763 newDepth = 255; | |
764 if(editGasPage.depth_mode == 0) | |
765 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newDepth; | |
766 else | |
767 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = newDepth; | |
768 tMenuEdit_newInput(editId, newDepth, 0, 0, 0); | |
769 return UPDATE_DIVESETTINGS; | |
770 } | |
771 if(action == ACTION_BUTTON_NEXT) | |
772 { | |
773 digitContentNew = digitContent + 1; | |
774 if(digitContentNew > '9') | |
775 digitContentNew = '0'; | |
776 return digitContentNew; | |
777 } | |
778 if(action == ACTION_BUTTON_BACK) | |
779 { | |
780 digitContentNew = digitContent - 1; | |
781 if(digitContentNew < '0') | |
782 digitContentNew = '9'; | |
783 return digitContentNew; | |
784 } | |
785 | |
786 return UNSPECIFIC_RETURN; | |
787 } | |
788 | |
789 | |
790 uint8_t OnAction_DefaultDepth(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
791 { | |
792 uint32_t newDepth; | |
793 | |
794 if(editGasPage.depth_mode == 0) | |
795 { | |
796 newDepth = calc_MOD(editGasPage.gasID); | |
797 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newDepth; | |
798 } | |
799 else | |
800 { | |
801 newDepth = calc_MinOD(editGasPage.gasID); | |
802 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = newDepth; | |
803 } | |
804 | |
805 tMenuEdit_newInput(StMOG_Depth, newDepth, 0, 0, 0); | |
806 | |
807 return UPDATE_DIVESETTINGS; | |
808 } | |
809 | |
810 | |
811 uint8_t OnAction_Active(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
812 { | |
813 uint8_t active, first; | |
814 | |
815 first = editGasPage.pGasLine[editGasPage.gasID].note.ub.first; | |
816 | |
817 if(first) | |
818 return UNSPECIFIC_RETURN; | |
819 | |
820 active = editGasPage.pGasLine[editGasPage.gasID].note.ub.active; | |
821 | |
822 if(active) | |
823 { | |
824 active = 0; | |
825 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 0; | |
826 } | |
827 else | |
828 { | |
829 active = 1; | |
830 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1; | |
831 } | |
832 tMenuEdit_set_on_off(editId, active); | |
833 | |
834 return UPDATE_DIVESETTINGS; | |
835 } | |
836 */ | |
837 | |
838 | |
839 uint8_t OnAction_First(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
840 { | |
841 uint8_t first, i, gasOne; | |
842 | |
843 if(editGasPage.ccr) | |
844 gasOne = 1 + NUM_OFFSET_DILUENT; | |
845 else | |
846 gasOne = 1; | |
847 | |
848 first = editGasPage.pGasLine[editGasPage.gasID].note.ub.first; | |
849 | |
850 if(!first) | |
851 { | |
852 for(i=gasOne;i<NUM_GASES + gasOne;i++) | |
853 { | |
854 if(editGasPage.pGasLine[i].note.ub.first) | |
855 { | |
856 editGasPage.pGasLine[i].note.ub.first = 0; | |
857 editGasPage.pGasLine[i].note.ub.active = 0; | |
858 } | |
859 } | |
860 } | |
861 | |
862 editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 1; | |
863 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1; | |
864 editGasPage.pGasLine[editGasPage.gasID].note.ub.deco = 0; | |
865 editGasPage.pGasLine[editGasPage.gasID].note.ub.travel = 0; | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
866 editGasPage.pGasLine[editGasPage.gasID].note.ub.off = 0; |
38 | 867 editGasPage.pGasLine[editGasPage.gasID].depth_meter = 0; |
868 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = 0; | |
869 | |
870 tMenuEdit_set_on_off(StMOG_First, 1); | |
871 tMenuEdit_set_on_off(StMOG_Deco, 0); | |
872 tMenuEdit_set_on_off(StMOG_Travel, 0); | |
873 tMenuEdit_set_on_off(StMOG_Inactive, 0); | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
874 #ifdef ENABLE_UNUSED_GAS_HIDING |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
875 tMenuEdit_set_on_off(StMOG_Off, 0); |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
876 #endif |
38 | 877 |
878 if(!first) | |
879 return UPDATE_DIVESETTINGS; | |
880 else | |
881 return UPDATE_AND_EXIT_TO_MENU; | |
882 } | |
883 | |
884 | |
885 uint8_t OnAction_Deco(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
886 { | |
887 uint8_t first, deco, gasOne; | |
888 | |
889 if(editGasPage.ccr) | |
890 gasOne = 1 + NUM_OFFSET_DILUENT; | |
891 else | |
892 gasOne = 1; | |
893 | |
894 first = editGasPage.pGasLine[editGasPage.gasID].note.ub.first; | |
895 deco = editGasPage.pGasLine[editGasPage.gasID].note.ub.deco; | |
896 | |
897 if(first) | |
898 { | |
899 if(editGasPage.gasID == gasOne) | |
900 return UNSPECIFIC_RETURN; | |
901 else | |
902 { | |
903 editGasPage.pGasLine[gasOne].note.ub.first = 1; | |
904 editGasPage.pGasLine[gasOne].note.ub.active = 1; | |
905 editGasPage.pGasLine[gasOne].note.ub.deco = 0; | |
906 editGasPage.pGasLine[gasOne].note.ub.travel = 0; | |
907 editGasPage.pGasLine[gasOne].depth_meter = 0; | |
908 editGasPage.pGasLine[gasOne].depth_meter_travel = 0; | |
909 } | |
910 } | |
911 | |
912 editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 0; | |
913 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1; | |
914 editGasPage.pGasLine[editGasPage.gasID].note.ub.deco = 1; | |
915 editGasPage.pGasLine[editGasPage.gasID].note.ub.travel = 0; | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
916 editGasPage.pGasLine[editGasPage.gasID].note.ub.off = 0; |
38 | 917 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = 0; |
918 editGasPage.mod = calc_MOD(editGasPage.gasID); | |
919 editGasPage.pGasLine[editGasPage.gasID].depth_meter = editGasPage.mod; | |
920 | |
921 /* | |
922 if(deco) | |
923 { | |
924 editGasPage.pGasLine[editGasPage.gasID].depth_meter = editGasPage.mod; | |
925 tMenuEdit_newInput(StMOG_ChangeDepth, editGasPage.pGasLine[editGasPage.gasID].depth_meter, 0, 0, 0); | |
926 } | |
927 */ | |
928 | |
929 tMenuEdit_set_on_off(StMOG_First, 0); | |
930 tMenuEdit_set_on_off(StMOG_Deco, 1); | |
931 tMenuEdit_set_on_off(StMOG_Travel, 0); | |
932 tMenuEdit_set_on_off(StMOG_Inactive, 0); | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
933 #ifdef ENABLE_UNUSED_GAS_HIDING |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
934 tMenuEdit_set_on_off(StMOG_Off, 0); |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
935 #endif |
38 | 936 |
937 if(!deco) | |
938 return UPDATE_DIVESETTINGS; | |
939 else | |
940 return UPDATE_AND_EXIT_TO_MENU; | |
941 } | |
942 | |
943 | |
944 uint8_t OnAction_Travel(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
945 { | |
946 uint8_t first, travel, gasOne; | |
947 | |
948 if(editGasPage.ccr) | |
949 gasOne = 1 + NUM_OFFSET_DILUENT; | |
950 else | |
951 gasOne = 1; | |
952 | |
953 first = editGasPage.pGasLine[editGasPage.gasID].note.ub.first; | |
954 travel = editGasPage.pGasLine[editGasPage.gasID].note.ub.travel; | |
955 | |
956 if(first) | |
957 { | |
958 if(editGasPage.gasID == gasOne) | |
959 return UNSPECIFIC_RETURN; | |
960 else | |
961 { | |
962 editGasPage.pGasLine[gasOne].note.ub.first = 1; | |
963 editGasPage.pGasLine[gasOne].note.ub.active = 1; | |
964 editGasPage.pGasLine[gasOne].note.ub.deco = 0; | |
965 editGasPage.pGasLine[gasOne].note.ub.travel = 0; | |
966 editGasPage.pGasLine[gasOne].depth_meter = 0; | |
967 editGasPage.pGasLine[gasOne].depth_meter_travel = 0; | |
968 } | |
969 } | |
970 | |
971 editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 0; | |
972 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 1; | |
973 editGasPage.pGasLine[editGasPage.gasID].note.ub.deco = 0; | |
974 editGasPage.pGasLine[editGasPage.gasID].note.ub.travel = 1; | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
975 editGasPage.pGasLine[editGasPage.gasID].note.ub.off = 0; |
38 | 976 editGasPage.pGasLine[editGasPage.gasID].depth_meter = 0; |
977 editGasPage.pGasLine[editGasPage.gasID].depth_meter_travel = 0; | |
978 | |
979 tMenuEdit_set_on_off(StMOG_First, 0); | |
980 tMenuEdit_set_on_off(StMOG_Deco, 0); | |
981 tMenuEdit_set_on_off(StMOG_Travel, 1); | |
982 tMenuEdit_set_on_off(StMOG_Inactive, 0); | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
983 #ifdef ENABLE_UNUSED_GAS_HIDING |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
984 tMenuEdit_set_on_off(StMOG_Off, 0); |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
985 #endif |
38 | 986 |
987 if(!travel) | |
988 return UPDATE_DIVESETTINGS; | |
989 else | |
990 return UPDATE_AND_EXIT_TO_MENU; | |
991 } | |
992 | |
993 | |
994 uint8_t OnAction_Inactive(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
995 { | |
996 uint8_t first, inactive, gasOne; | |
997 | |
998 if(editGasPage.ccr) | |
999 gasOne = 1 + NUM_OFFSET_DILUENT; | |
1000 else | |
1001 gasOne = 1; | |
1002 | |
1003 first = editGasPage.pGasLine[editGasPage.gasID].note.ub.first; | |
1004 | |
1005 if(editGasPage.pGasLine[editGasPage.gasID].note.ub.active) | |
1006 inactive = 0; | |
1007 else | |
1008 inactive = 1; | |
1009 | |
1010 if(first) | |
1011 { | |
1012 if(editGasPage.gasID == gasOne) | |
1013 return UNSPECIFIC_RETURN; | |
1014 else | |
1015 { | |
1016 editGasPage.pGasLine[gasOne].note.ub.first = 1; | |
1017 editGasPage.pGasLine[gasOne].note.ub.active = 1; | |
1018 editGasPage.pGasLine[gasOne].note.ub.deco = 0; | |
1019 editGasPage.pGasLine[gasOne].note.ub.travel = 0; | |
1020 editGasPage.pGasLine[gasOne].depth_meter = 0; | |
1021 editGasPage.pGasLine[gasOne].depth_meter_travel = 0; | |
1022 } | |
1023 } | |
1024 | |
1025 editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 0; | |
1026 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 0; | |
1027 editGasPage.pGasLine[editGasPage.gasID].note.ub.deco = 0; | |
1028 editGasPage.pGasLine[editGasPage.gasID].note.ub.travel = 0; | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1029 editGasPage.pGasLine[editGasPage.gasID].note.ub.off = 0; |
38 | 1030 |
1031 tMenuEdit_set_on_off(StMOG_First, 0); | |
1032 tMenuEdit_set_on_off(StMOG_Deco, 0); | |
1033 tMenuEdit_set_on_off(StMOG_Travel, 0); | |
1034 tMenuEdit_set_on_off(StMOG_Inactive, 1); | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1035 #ifdef ENABLE_UNUSED_GAS_HIDING |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1036 tMenuEdit_set_on_off(StMOG_Off, 0); |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1037 #endif |
38 | 1038 if(!inactive) |
1039 return UPDATE_DIVESETTINGS; | |
1040 else | |
1041 return UPDATE_AND_EXIT_TO_MENU; | |
1042 } | |
1043 | |
528
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1044 uint8_t OnAction_Off (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1045 { |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1046 uint8_t first, off, gasOne; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1047 |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1048 if(editGasPage.ccr) |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1049 gasOne = 1 + NUM_OFFSET_DILUENT; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1050 else |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1051 gasOne = 1; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1052 |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1053 first = editGasPage.pGasLine[editGasPage.gasID].note.ub.first; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1054 off =editGasPage.pGasLine[editGasPage.gasID].note.ub.off; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1055 |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1056 if(first) |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1057 { |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1058 if(editGasPage.gasID == gasOne) |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1059 return UNSPECIFIC_RETURN; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1060 else |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1061 { |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1062 editGasPage.pGasLine[gasOne].note.ub.first = 1; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1063 editGasPage.pGasLine[gasOne].note.ub.active = 1; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1064 editGasPage.pGasLine[gasOne].note.ub.deco = 0; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1065 editGasPage.pGasLine[gasOne].note.ub.travel = 0; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1066 editGasPage.pGasLine[gasOne].depth_meter = 0; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1067 editGasPage.pGasLine[gasOne].depth_meter_travel = 0; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1068 } |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1069 } |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1070 |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1071 editGasPage.pGasLine[editGasPage.gasID].note.ub.first = 0; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1072 editGasPage.pGasLine[editGasPage.gasID].note.ub.active = 0; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1073 editGasPage.pGasLine[editGasPage.gasID].note.ub.deco = 0; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1074 editGasPage.pGasLine[editGasPage.gasID].note.ub.travel = 0; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1075 editGasPage.pGasLine[editGasPage.gasID].note.ub.off = 1; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1076 |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1077 tMenuEdit_set_on_off(StMOG_First, 0); |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1078 tMenuEdit_set_on_off(StMOG_Deco, 0); |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1079 tMenuEdit_set_on_off(StMOG_Travel, 0); |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1080 tMenuEdit_set_on_off(StMOG_Inactive, 0); |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1081 #ifdef ENABLE_UNUSED_GAS_HIDING |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1082 tMenuEdit_set_on_off(StMOG_Off, 1); |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1083 #endif |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1084 if(!off) |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1085 return UPDATE_DIVESETTINGS; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1086 else |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1087 return UPDATE_AND_EXIT_TO_MENU; |
a9c195be907e
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
344
diff
changeset
|
1088 } |
38 | 1089 |
1090 uint8_t OnAction_SetToMOD (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1091 { | |
1092 uint8_t newChangeDepth = editGasPage.mod; | |
1093 | |
1094 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newChangeDepth; | |
1095 tMenuEdit_newInput(StMOG_ChangeDepth, unit_depth_integer(newChangeDepth), 0, 0, 0); | |
1096 | |
1097 return UPDATE_DIVESETTINGS; | |
1098 } | |
1099 | |
1100 | |
1101 uint8_t OnAction_ChangeDepth(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1102 { | |
1103 uint8_t digitContentNew; | |
1104 uint32_t newDepth; | |
1105 | |
1106 if(action == ACTION_BUTTON_ENTER) | |
1107 { | |
1108 return digitContent; | |
1109 } | |
1110 if(action == ACTION_BUTTON_ENTER_FINAL) | |
1111 { | |
1112 evaluateNewString(editId, &newDepth, 0, 0, 0); | |
1113 if(settingsGetPointer()->nonMetricalSystem != 0) // new hw 170703 | |
1114 { | |
1115 newDepth += 2; // f�r rundung | |
1116 newDepth = (newDepth * 3) / 10; | |
1117 } | |
1118 if(newDepth > 255) | |
1119 newDepth = 255; | |
1120 editGasPage.pGasLine[editGasPage.gasID].depth_meter = newDepth; | |
1121 tMenuEdit_newInput(editId, unit_depth_integer(newDepth), 0, 0, 0); | |
1122 return UPDATE_DIVESETTINGS; | |
1123 } | |
1124 if(action == ACTION_BUTTON_NEXT) | |
1125 { | |
1126 digitContentNew = digitContent + 1; | |
1127 if(digitContentNew > '9') | |
1128 digitContentNew = '0'; | |
1129 return digitContentNew; | |
1130 } | |
1131 if(action == ACTION_BUTTON_BACK) | |
1132 { | |
1133 digitContentNew = digitContent - 1; | |
1134 if(digitContentNew < '0') | |
1135 digitContentNew = '9'; | |
1136 return digitContentNew; | |
1137 } | |
1138 | |
1139 return UNSPECIFIC_RETURN; | |
1140 } | |
1141 | |
1142 | |
1143 uint8_t OnAction_BottleSize (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1144 { | |
1145 int8_t digitContentNew; | |
1146 uint32_t newBottleSize; | |
1147 // const uint8_t validSize = {4,7,8,10,12,15,16,17,20,24,30,40,255}; | |
1148 const uint8_t validSize[] = {40,30,24,20,17,16,15,12,10,8,7,4,0}; | |
1149 | |
1150 if(action == ACTION_BUTTON_ENTER) | |
1151 { | |
1152 return digitContent; | |
1153 } | |
1154 if(action == ACTION_BUTTON_ENTER_FINAL) | |
1155 { | |
1156 evaluateNewString(editId, &newBottleSize, 0, 0, 0); | |
1157 | |
1158 if(newBottleSize > validSize[0]) | |
1159 newBottleSize = validSize[0]; | |
1160 | |
1161 editGasPage.pGasLine[editGasPage.gasID].bottle_size_liter = newBottleSize; | |
1162 | |
1163 tMenuEdit_newInput(editId, newBottleSize, 0, 0, 0); | |
1164 return UPDATE_DIVESETTINGS; | |
1165 } | |
1166 if(action == ACTION_BUTTON_NEXT) | |
1167 { | |
1168 // new here for ease of comparison | |
1169 digitContentNew = digitContent - '0'; | |
1170 | |
1171 if(digitContentNew > 0) | |
1172 { | |
1173 int i = 0; | |
1174 while(digitContentNew < validSize[i]) | |
1175 { | |
1176 i++; | |
1177 } | |
1178 if(i == 0) | |
1179 digitContentNew = 0; // off | |
1180 else | |
1181 digitContentNew = validSize[i-1]; | |
1182 } | |
1183 else | |
1184 { | |
1185 int i = 0; | |
1186 while(validSize[i] != 0) | |
1187 i++; | |
1188 digitContentNew = validSize[i-1]; // smallest tank | |
1189 } | |
1190 digitContentNew += '0'; | |
1191 return digitContentNew; | |
1192 } | |
1193 if(action == ACTION_BUTTON_BACK) | |
1194 { | |
1195 // new here for ease of comparison | |
1196 digitContentNew = digitContent - '0'; | |
1197 if(digitContentNew > 0) | |
1198 { | |
1199 int i = 0; | |
1200 while(digitContentNew < validSize[i]) | |
1201 { | |
1202 i++; | |
1203 } | |
1204 if(validSize[i] == 0) | |
1205 digitContentNew = 0; // off | |
1206 else if(validSize[i+1] == 0) | |
1207 digitContentNew = 0; // off | |
1208 else | |
1209 digitContentNew = validSize[i+1]; | |
1210 } | |
1211 else | |
1212 { | |
1213 digitContentNew = validSize[0]; | |
1214 } | |
1215 digitContentNew += '0'; | |
1216 | |
1217 return digitContentNew; | |
1218 } | |
1219 return EXIT_TO_MENU; | |
1220 } | |
1221 | |
1222 | |
1223 /* Private functions ---------------------------------------------------------*/ | |
1224 | |
1225 | |
1226 void create_text_with_u8(char *text, const char *text1, uint8_t inputU8, const char *text2) | |
1227 { | |
1228 uint8_t digit1, digit2, digit3, count; | |
1229 | |
1230 count = 0; | |
1231 | |
1232 if(*text1) | |
1233 { | |
1234 strcpy(&text[count], text1); | |
1235 count = strlen(text1); | |
1236 } | |
1237 | |
1238 digit1 = inputU8 / 100; | |
1239 inputU8 -= digit1 * 100; | |
1240 digit2 = inputU8 / 10; | |
1241 inputU8 -= digit2 * 10; | |
1242 digit3 = inputU8; | |
1243 if(digit1) | |
1244 text[count++] = '0' + digit1; | |
1245 if(count || digit2) | |
1246 text[count++] = '0' + digit2; | |
1247 text[count++] = '0' + digit3; | |
1248 | |
1249 if(*text2) | |
1250 { | |
1251 strcpy(&text[count], text2); | |
1252 } | |
1253 } |