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