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