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