Mercurial > public > ostc4
annotate Discovery/Src/tHome.c @ 1046:1d7c7a36df15 GasConsumption
Bugfix OSTC5 BT and enabling fast mode:
The OSTC5 BT was operating at default speed of 115200. To enable the faster communication some init steps have been added to set speed to 460800. Having the UART enabled while the module was shut down caused problems during initialisation. To avoid these the BT UART is now initialized after the the module is powered on and deinitialized while the module is switched off.
| author | Ideenmodellierer |
|---|---|
| date | Fri, 14 Nov 2025 18:54:20 +0100 |
| parents | 5b913cdaa9dc |
| children |
| rev | line source |
|---|---|
| 38 | 1 /////////////////////////////////////////////////////////////////////////////// |
| 2 /// -*- coding: UTF-8 -*- | |
| 3 /// | |
| 4 /// \file Discovery/Src/tHome.c | |
| 5 /// \brief Control for Surface and Dive Templates | |
| 6 /// \author heinrichs weikamp gmbh | |
| 7 /// \date 10-November-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 "tHome.h" | |
| 31 | |
| 32 #include "data_exchange_main.h" // for dataOutGetPointer() | |
| 33 #include "gfx_fonts.h" | |
| 34 #include "t3.h" | |
| 35 #include "t4_tetris.h" | |
| 36 #include "t5_gauge.h" | |
| 37 #include "t6_apnea.h" | |
| 38 #include "t7.h" | |
| 39 #include "tDebug.h" | |
| 40 #include "timer.h" // for timer_Stopwatch_Restart | |
| 41 #include "tMenu.h" | |
| 42 #include "tMenuEditGasOC.h" // for openEdit_DiveSelectBetterGas() | |
| 43 #include "tMenuEditSetpoint.h" // for openEdit_DiveSelectBetterSetpoint() | |
| 44 #include "simulation.h" | |
|
361
b111fc4250e9
Pass action to customer vie update function.
Ideenmodellierer
parents:
289
diff
changeset
|
45 #include "motion.h" |
|
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
46 #include "logbook_miniLive.h" |
| 38 | 47 |
| 48 /* Private types -------------------------------------------------------------*/ | |
| 49 | |
| 50 /* Exported variables --------------------------------------------------------*/ | |
| 51 _Bool warning_count_high_time = 0; | |
| 52 _Bool display_count_high_time = 0; | |
| 53 | |
| 54 uint8_t errorsInSettings = 0; | |
| 55 /* Private variables ---------------------------------------------------------*/ | |
| 56 static uint8_t warning_toogle_count; | |
| 57 static uint16_t display_toogle_count; | |
| 58 static uint16_t tHome_tick_count_cview; | |
| 59 static uint16_t tHome_tick_count_field; | |
| 576 | 60 static uint16_t tHome_tick_count_o2sens; |
| 38 | 61 |
| 1035 | 62 const uint8_t cv_changelist[] = {CVIEW_Compass, CVIEW_SummaryOfLeftCorner, CVIEW_Tissues, |
| 63 CVIEW_Profile, CVIEW_EADTime, CVIEW_Gaslist, CVIEW_noneOrDebug, | |
| 64 CVIEW_Decolist, CVIEW_sensors,CVIEW_sensors_mV, CVIEW_Timer, | |
| 65 #ifdef ENABLE_LOGGER_WINDOW | |
| 66 CVIEW_Logger, | |
| 67 #endif | |
| 68 CVIEW_END}; | |
|
594
280c11153080
Added compile switch for new T3 View Profile
Ideenmodellierer
parents:
576
diff
changeset
|
69 const uint8_t cv_changelist_BS[] = {CVIEW_T3_Decostop, CVIEW_sensors, CVIEW_Compass, CVIEW_T3_MaxDepth,CVIEW_T3_StopWatch, CVIEW_T3_TTS, CVIEW_T3_GasList, CVIEW_T3_ppO2andGas, CVIEW_noneOrDebug, |
|
280c11153080
Added compile switch for new T3 View Profile
Ideenmodellierer
parents:
576
diff
changeset
|
70 CVIEW_T3_Navigation, CVIEW_T3_DepthData, CVIEW_T3_DecoTTS, |
|
280c11153080
Added compile switch for new T3 View Profile
Ideenmodellierer
parents:
576
diff
changeset
|
71 #ifdef ENABLE_T3_PROFILE_VIEW |
|
280c11153080
Added compile switch for new T3 View Profile
Ideenmodellierer
parents:
576
diff
changeset
|
72 CVIEW_T3_Profile, |
|
280c11153080
Added compile switch for new T3 View Profile
Ideenmodellierer
parents:
576
diff
changeset
|
73 #endif |
|
836
8d6c35655d4d
Bugfix BF temperatur display and cv switching:
ideenmodellierer
parents:
816
diff
changeset
|
74 CVIEW_T3_Temperature, |
|
594
280c11153080
Added compile switch for new T3 View Profile
Ideenmodellierer
parents:
576
diff
changeset
|
75 CVIEW_T3_END}; |
| 38 | 76 |
| 77 /* Private function prototypes -----------------------------------------------*/ | |
| 78 | |
| 576 | 79 #define AUTORETURN_O2SENS (200u) /* return to sensor view after 20 seconds in case sensor is connected */ |
| 80 | |
| 81 | |
| 38 | 82 /* Exported functions --------------------------------------------------------*/ |
| 83 | |
| 84 void set_globalState_tHome(void) | |
| 85 { | |
| 86 if(stateUsed->mode == MODE_DIVE) | |
| 739 | 87 { |
| 38 | 88 set_globalState(StD); |
| 739 | 89 } |
| 38 | 90 else |
| 91 set_globalState(StS); | |
|
816
c4ee952b9425
Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
heinrichsweikamp
parents:
810
diff
changeset
|
92 |
|
c4ee952b9425
Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
heinrichsweikamp
parents:
810
diff
changeset
|
93 clearDisabledMenuLines(); |
| 38 | 94 } |
| 95 | |
| 96 | |
| 97 void tHome_init(void) | |
| 98 { | |
| 99 t7_init(); // standard + surface | |
| 100 t3_init(); // big font | |
| 101 t4_init(); // game | |
| 102 t5_init(); // gauge | |
| 103 t6_init(); // apnea | |
| 104 } | |
| 105 | |
| 106 | |
| 107 void tHome_init_compass(void) | |
| 108 { | |
| 109 init_t7_compass(); | |
| 110 } | |
| 111 | |
| 112 | |
| 113 void tHome_refresh(void) | |
| 114 { | |
| 115 SSettings* pSettings = settingsGetPointer(); | |
| 116 | |
| 117 warning_toogle_count++; | |
| 118 if(warning_toogle_count >= 2* pSettings->warning_blink_dsec) | |
| 119 warning_toogle_count = 0; | |
| 120 | |
| 121 if(warning_toogle_count >= pSettings->warning_blink_dsec) | |
| 122 warning_count_high_time = 1; | |
| 123 else | |
| 124 warning_count_high_time = 0; | |
| 125 | |
| 126 | |
| 127 display_toogle_count++; | |
| 128 if(display_toogle_count >= 2* pSettings->display_toogle_desc) | |
| 129 display_toogle_count = 0; | |
| 130 | |
| 131 if(display_toogle_count >= pSettings->display_toogle_desc) | |
| 132 display_count_high_time = 1; | |
| 133 else | |
| 134 display_count_high_time = 0; | |
| 135 | |
| 136 | |
| 137 if(pSettings->design == 6) | |
| 138 t6_refresh(); | |
| 139 else | |
| 140 if(pSettings->design == 5) | |
| 141 t5_refresh(); | |
| 142 else | |
| 143 if(pSettings->design == 4) | |
| 144 t4_refresh(); | |
| 145 else | |
| 146 if(pSettings->design == 3) | |
| 147 t3_refresh(); | |
| 148 else | |
| 149 if(pSettings->design == 7) | |
| 150 t7_refresh(); | |
| 151 else | |
| 152 { | |
| 153 pSettings->design = 7; | |
| 154 t7_refresh(); | |
| 155 } | |
| 156 } | |
| 157 | |
| 158 | |
| 159 void tHome_sleepmode_fun(void) | |
| 160 { | |
| 161 t7_refresh_sleepmode_fun(); | |
| 162 } | |
| 163 | |
| 164 | |
|
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
165 static void checkSetStateSim(SSettings *settings) |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
166 { |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
167 if (is_stateUsedSetToSim()) { |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
168 if (settings->design != 3) { |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
169 set_globalState(StDSIM1); |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
170 } else { |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
171 #ifdef ENABLE_T3_PPO_SIM |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
172 if (stateUsed->diveSettings.ppo2sensors_deactivated & 0x01 == 0) { |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
173 set_globalState(StDSIM1); |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
174 } else if (stateUsed->diveSettings.ppo2sensors_deactivated & 0x02 == 0) { |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
175 set_globalState(StDSIM3); |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
176 } else if (stateUsed->diveSettings.ppo2sensors_deactivated & 0x04 == 0) { |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
177 set_globalState(StDSIM5); |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
178 } else { |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
179 set_globalState(StD); |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
180 } |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
181 #endif |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
182 } |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
183 } else { |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
184 set_globalState(StD); |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
185 } |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
186 } |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
187 |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
188 |
|
777
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
189 static void checkSetStateCompassSim(SSettings *settings) |
|
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
190 { |
|
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
191 if (settings->design == 7 && t7_isCompassShowing()) { |
|
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
192 set_globalState(StDBEAR); |
|
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
193 } else { |
|
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
194 checkSetStateSim(settings); |
|
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
195 } |
|
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
196 } |
|
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
197 |
|
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
198 |
| 38 | 199 void tHomeDiveMenuControl(uint8_t sendAction) |
| 200 { | |
|
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
201 SSettings *settings = settingsGetPointer(); |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
202 |
| 38 | 203 if(sendAction == ACTION_BUTTON_NEXT) |
| 204 { | |
| 205 if(settingsGetPointer()->design == 4) | |
| 206 return; | |
| 207 | |
| 208 switch(get_globalState()) | |
| 209 { | |
|
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
210 case StD: |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
211 if(settingsGetPointer()->design == 6) |
| 38 | 212 { |
| 213 if(is_stateUsedSetToSim()) | |
| 214 set_globalState(StDSIM1); | |
| 215 else | |
| 216 set_globalState(StDQUIT); | |
| 217 break; | |
| 218 } | |
| 219 | |
| 220 if(settingsGetPointer()->design == 5) | |
| 221 { | |
| 222 if(t5_getCustomView() == CVIEW_Compass) | |
| 223 set_globalState(StDBEAR); | |
| 224 else | |
| 225 set_globalState(StDRAVG); | |
| 226 break; | |
| 227 } | |
| 228 | |
|
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
229 if(settingsGetPointer()->design == 3) |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
230 { |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
231 switch(t3_getCustomView()) |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
232 { |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
233 case CVIEW_T3_Navigation: |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
234 case CVIEW_Compass: set_globalState(StDBEAR); |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
235 break; |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
236 case CVIEW_T3_StopWatch: set_globalState(StDRAVG); |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
237 break; |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
238 case CVIEW_T3_GasList: if(stateUsed->warnings.betterGas) |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
239 { |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
240 set_globalState(StDMGAS); |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
241 } |
| 838 | 242 else |
| 243 { | |
| 244 set_globalState(StDMENU); | |
| 245 } | |
|
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
246 break; |
|
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
247 #ifdef ENABLE_T3_PPO_SIM |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
248 case CVIEW_sensors: if(is_stateUsedSetToSim()) |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
249 { |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
250 set_globalState(StDSIM1); |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
251 } |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
252 break; |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
253 #endif |
|
628
db2bcd2f6778
Added compile switch for T3_PROFILE menu operation option
Ideenmodellierer
parents:
619
diff
changeset
|
254 #ifdef ENABLE_T3_PROFILE_VIEW |
| 613 | 255 case CVIEW_T3_Profile: set_globalState(StDMARK); |
|
628
db2bcd2f6778
Added compile switch for T3_PROFILE menu operation option
Ideenmodellierer
parents:
619
diff
changeset
|
256 #endif |
| 613 | 257 break; |
|
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
258 default: |
| 739 | 259 set_globalState(StDMENU); |
|
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
260 break; |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
261 } |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
262 break; |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
263 } |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
264 |
| 38 | 265 if(stateUsed->warnings.betterGas) |
| 266 set_globalState(StDMGAS); | |
| 267 else | |
| 268 if(stateUsed->warnings.betterSetpoint) | |
| 269 set_globalState(StDMSPT); | |
| 270 else | |
| 271 set_globalState(StDMENU); | |
| 272 break; | |
| 273 | |
| 274 case StDMGAS: | |
|
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
275 if(settingsGetPointer()->design == 3) |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
276 { |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
277 set_globalState(StD); |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
278 } |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
279 else |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
280 { |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
281 if(stateUsed->warnings.betterSetpoint) |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
282 set_globalState(StDMSPT); |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
283 else |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
284 set_globalState(StDMENU); |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
285 } |
| 38 | 286 break; |
| 287 | |
| 288 case StDMSPT: | |
| 289 set_globalState(StDMENU); | |
| 290 break; | |
| 291 | |
| 292 case StDMENU: | |
|
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
293 if (settings->design == 7 && isLoopMode(settings->dive_mode)) { |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
294 set_globalState(StDBAILOUT); |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
295 |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
296 break; |
|
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
297 } |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
298 |
|
777
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
299 checkSetStateCompassSim(settings); |
|
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
300 |
| 38 | 301 break; |
|
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
302 case StDBAILOUT: |
|
775
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
303 if (settingsGetPointer()->dive_mode == DIVEMODE_CCR && isLoopMode(stateUsed->diveSettings.diveMode) && findSwitchToSetpoint()) { |
|
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
304 set_globalState(StDSETPOINT); |
|
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
305 |
|
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
306 break; |
|
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
307 } |
|
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
308 |
|
777
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
309 checkSetStateCompassSim(settings); |
|
775
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
310 |
|
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
311 break; |
|
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
312 case StDSETPOINT: |
|
777
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
313 checkSetStateCompassSim(settings); |
| 38 | 314 |
|
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
315 break; |
| 38 | 316 case StDSIM1: |
| 317 set_globalState(StDSIM2); | |
| 318 break; | |
| 319 | |
| 320 case StDSIM2: | |
|
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
321 if(settingsGetPointer()->design != 3) |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
322 { |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
323 set_globalState(StDSIM3); |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
324 } |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
325 else |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
326 { |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
327 #ifdef ENABLE_T3_PPO_SIM |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
328 if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x02) == 0) |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
329 { |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
330 set_globalState(StDSIM3); |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
331 } |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
332 else if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x04) == 0) |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
333 { |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
334 set_globalState(StDSIM5); |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
335 } |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
336 else |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
337 { |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
338 set_globalState(StD); |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
339 } |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
340 #endif |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
341 } |
| 38 | 342 break; |
| 343 | |
| 344 case StDSIM3: | |
| 345 set_globalState(StDSIM4); | |
| 346 break; | |
| 347 | |
| 348 case StDSIM4: | |
|
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
349 if(settingsGetPointer()->design != 3) |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
350 { |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
351 set_globalState(StD); |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
352 } |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
353 else |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
354 { |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
355 #ifdef ENABLE_T3_PPO_SIM |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
356 if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x04) == 0) |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
357 { |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
358 set_globalState(StDSIM5); |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
359 } |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
360 else |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
361 { |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
362 set_globalState(StD); |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
363 } |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
364 #endif |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
365 } |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
366 break; |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
367 #ifdef ENABLE_T3_PPO_SIM |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
368 case StDSIM5: |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
369 set_globalState(StDSIM6); |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
370 break; |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
371 |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
372 case StDSIM6: |
| 38 | 373 set_globalState(StD); |
| 374 break; | |
|
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
375 #endif |
|
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
376 case StDBEAR: |
|
777
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
377 if (settingsGetPointer()->design == 7) { |
|
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
378 checkSetStateSim(settings); |
|
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
379 |
|
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
380 break; |
|
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
381 } |
|
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
382 |
|
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
383 if(settingsGetPointer()->design == 5) |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
384 { |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
385 set_globalState(StDRAVG); |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
386 } |
| 38 | 387 |
|
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
388 if(settingsGetPointer()->design == 3) |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
389 { |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
390 if(t3_getCustomView() == CVIEW_T3_Navigation) |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
391 { |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
392 set_globalState(StDRAVG); |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
393 } |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
394 else |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
395 { |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
396 set_globalState(StD); |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
397 } |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
398 } |
| 38 | 399 break; |
|
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
400 case StDRAVG: |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
401 if(settingsGetPointer()->design == 5) |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
402 { |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
403 if(is_stateUsedSetToSim()) |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
404 set_globalState(StDSIM1); |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
405 else |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
406 set_globalState(StD); |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
407 break; |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
408 } |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
409 else |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
410 { |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
411 set_globalState(StD); |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
412 } |
|
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
413 break; |
| 38 | 414 case StDQUIT: // t6_apnea |
| 415 set_globalState(StD); | |
| 416 break; | |
| 417 | |
|
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
418 case StDMARK: |
|
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
419 if((settingsGetPointer()->design == 3) && (MiniLiveLogbook_getNextMarkerIndex(0) != 0)) |
|
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
420 { |
|
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
421 set_globalState(StDCHECK); |
|
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
422 } |
|
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
423 else |
|
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
424 { |
|
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
425 set_globalState(StD); |
|
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
426 } |
|
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
427 break; |
|
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
428 |
| 38 | 429 default: |
| 430 set_globalState(StD); | |
| 431 } | |
| 432 } | |
| 433 | |
| 434 if(sendAction == ACTION_BUTTON_ENTER) | |
| 435 { | |
| 436 if(settingsGetPointer()->design == 4) | |
| 437 return; | |
| 438 | |
| 439 switch(get_globalState()) | |
| 440 { | |
| 441 case StDMGAS: | |
|
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
442 openEdit_DiveSelectBetterGas(false); |
| 38 | 443 set_globalState(StD); |
| 444 break; | |
| 445 case StDMSPT: | |
|
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
446 openEdit_DiveSelectBetterSetpoint(false); |
| 38 | 447 set_globalState(StD); |
| 448 break; | |
| 449 | |
| 450 case StDMENU: | |
| 451 openMenu_first_page_with_OC_gas_update(); | |
| 452 break; | |
| 453 | |
| 454 case StDSIM1: | |
|
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
455 if(settingsGetPointer()->design != 3) |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
456 { |
| 38 | 457 Sim_Quit(); |
|
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
458 } |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
459 else |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
460 { |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
461 Sim_IncreasePPO(0); |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
462 } |
| 38 | 463 break; |
| 464 | |
| 465 case StDSIM2: | |
|
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
466 if(settingsGetPointer()->design != 3) |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
467 { |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
468 Sim_Ascend(); |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
469 } |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
470 else |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
471 { |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
472 Sim_DecreasePPO(0); |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
473 } |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
474 |
| 38 | 475 break; |
| 476 | |
| 477 case StDSIM3: | |
|
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
478 if(settingsGetPointer()->design != 3) |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
479 { |
| 38 | 480 Sim_Descend(); |
|
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
481 } |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
482 else |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
483 { |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
484 Sim_IncreasePPO(1); |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
485 } |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
486 |
| 38 | 487 break; |
| 488 | |
| 489 case StDSIM4: | |
|
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
490 if(settingsGetPointer()->design != 3) |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
491 { |
| 38 | 492 Sim_Divetime(); |
|
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
493 } |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
494 else |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
495 { |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
496 Sim_DecreasePPO(1); |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
497 } |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
498 |
| 38 | 499 break; |
|
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
500 #ifdef ENABLE_T3_PPO_SIM |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
501 case StDSIM5: |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
502 Sim_IncreasePPO(2); |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
503 break; |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
504 case StDSIM6: |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
505 Sim_DecreasePPO(2); |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
506 break; |
|
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
507 #endif |
|
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
508 case StDBAILOUT: |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
509 if (isLoopMode(stateUsed->diveSettings.diveMode)) { |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
510 tMEGas_check_switch_to_bailout(); |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
511 |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
512 openEdit_DiveSelectBetterGas(true); |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
513 } else { |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
514 checkSwitchToLoop(); |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
515 |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
516 openEdit_DiveSelectBetterSetpoint(true); |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
517 } |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
518 |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
519 set_globalState(StD); |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
520 |
|
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
521 break; |
|
775
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
522 case StDSETPOINT: |
|
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
523 checkSwitchSetpoint(); |
|
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
524 |
|
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
525 set_globalState(StD); |
|
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
526 |
|
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
527 break; |
|
777
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
528 case StDBEAR: // t5_gauge, t7 |
|
774
6169309d6eb9
more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents:
773
diff
changeset
|
529 setCompassHeading((uint16_t)stateUsed->lifeData.compass_heading); |
| 38 | 530 set_globalState(StD); |
| 531 break; | |
| 532 | |
| 533 case StDRAVG: // t5_gauge | |
| 534 timer_Stopwatch_Restart(); | |
| 535 set_globalState(StD); | |
| 536 break; | |
| 537 | |
| 538 case StDQUIT: // t6_apnea | |
| 539 set_globalState(StD); // used to end StDQUIT, is called before everything else because changes are made in the next lines | |
| 540 if(is_stateUsedSetToSim()) | |
| 541 Sim_Quit(); | |
| 542 else | |
| 543 dataOutGetPointer()->setEndDive = 1; | |
| 544 break; | |
| 613 | 545 case StDMARK: stateUsedWrite->events.manualMarker = 1; |
| 546 set_globalState(StD); | |
| 547 break; | |
| 38 | 548 |
|
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
549 case StDCHECK: MiniLiveLogbook_checkMarker(); |
|
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
550 break; |
| 38 | 551 default: |
| 552 break; | |
| 553 } | |
| 554 } | |
| 555 } | |
| 556 | |
| 557 | |
| 558 void tHome_findNextStop(const uint16_t *list, uint8_t *depthOutMeter, uint16_t *lengthOutSeconds) | |
| 559 { | |
| 560 uint8_t ptr = DECOINFO_STRUCT_MAX_STOPS - 1; | |
| 561 | |
| 562 while(ptr && !list[ptr]) | |
| 563 ptr--; | |
| 564 | |
| 565 *lengthOutSeconds = list[ptr]; | |
| 566 if(!(*lengthOutSeconds)) | |
| 567 { | |
| 568 *depthOutMeter = 0; | |
| 569 } | |
| 570 else | |
| 571 if(ptr == 0) | |
| 572 { | |
| 573 *depthOutMeter = (uint8_t)((stateUsed->diveSettings.last_stop_depth_bar*10.0f) + 0.1f); | |
| 574 } | |
| 575 else | |
| 576 { | |
| 577 ptr -= 1; | |
| 578 *depthOutMeter = (uint8_t)(((stateUsed->diveSettings.input_second_to_last_stop_depth_bar + (stateUsed->diveSettings.input_next_stop_increment_depth_bar * ptr))*10.0f) + 0.1f); | |
| 579 } | |
| 580 } | |
| 581 | |
| 582 | |
| 583 void tHome_change_field_button_pressed(void) | |
| 584 { | |
| 585 tHome_tick_count_field = 0; | |
| 576 | 586 tHome_tick_count_o2sens = 0; |
| 38 | 587 if(settingsGetPointer()->design == 7) |
| 588 t7_change_field(); | |
| 589 } | |
| 590 | |
| 591 | |
|
361
b111fc4250e9
Pass action to customer vie update function.
Ideenmodellierer
parents:
289
diff
changeset
|
592 void tHome_change_customview_button_pressed(uint8_t action) |
| 38 | 593 { |
| 594 tHome_tick_count_cview = 0; | |
| 576 | 595 tHome_tick_count_o2sens = 0; |
| 596 | |
| 38 | 597 if(settingsGetPointer()->design == 7) |
|
361
b111fc4250e9
Pass action to customer vie update function.
Ideenmodellierer
parents:
289
diff
changeset
|
598 t7_change_customview(action); |
| 38 | 599 else |
| 600 if(settingsGetPointer()->design == 3) | |
|
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
601 t3_change_customview(action); |
| 38 | 602 else |
| 603 if(settingsGetPointer()->design == 5) | |
|
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
604 t5_change_customview(action); |
| 38 | 605 else |
| 606 if(settingsGetPointer()->design == 6) | |
|
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
607 t6_change_customview(action); |
| 38 | 608 } |
| 609 | |
| 505 | 610 uint8_t tHome_getNumberOfAvailableCVs(const uint8_t* pcv_list) |
| 611 { | |
| 612 uint8_t cnt = 0; | |
| 613 | |
| 614 while((pcv_list[cnt] != CVIEW_END) && (pcv_list[cnt] != CVIEW_T3_END)) | |
| 615 { | |
| 616 cnt++; | |
| 617 if (cnt > 100) /* just in case an invalid list has been provided... */ | |
| 618 { | |
| 619 break; | |
| 620 } | |
| 621 } | |
| 622 cnt--; /* do not count end token */ | |
| 623 return cnt; | |
| 624 } | |
| 38 | 625 |
| 626 void tHome_tick(void) | |
| 627 { | |
| 628 uint16_t field = settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout; | |
| 629 uint16_t cview = settingsGetPointer()->tX_customViewTimeout; | |
| 630 | |
| 631 if(field) | |
| 632 { | |
| 633 tHome_tick_count_field++; | |
| 634 if(tHome_tick_count_field > (field * 10)) | |
| 635 { | |
| 636 tHome_tick_count_field = 0; | |
| 637 if(settingsGetPointer()->design == 7) | |
| 638 { | |
| 639 t7_set_field_to_primary(); | |
| 640 } | |
| 641 } | |
| 642 } | |
| 643 | |
| 644 if(cview) | |
| 645 { | |
| 646 tHome_tick_count_cview++; | |
| 647 if(tHome_tick_count_cview > (cview *10)) | |
| 648 { | |
| 649 tHome_tick_count_cview = 0; | |
|
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
777
diff
changeset
|
650 if (settingsGetPointer()->design == 7 && !t7_isTimerRunning(false)) { |
| 38 | 651 t7_set_customview_to_primary(); |
| 652 } | |
|
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
653 if(settingsGetPointer()->design == 3) |
|
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
654 { |
|
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
655 t3_set_customview_to_primary(); |
|
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
656 } |
| 38 | 657 } |
| 658 } | |
| 576 | 659 |
|
810
e6827fcd7604
Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents:
805
diff
changeset
|
660 if((stateUsed->mode == MODE_SURFACE) && (!t7_customview_disabled(CVIEW_sensors))) |
| 576 | 661 { |
| 662 tHome_tick_count_o2sens++; | |
| 663 if(tHome_tick_count_o2sens > AUTORETURN_O2SENS) | |
| 664 { | |
| 665 tHome_tick_count_o2sens = 0; | |
|
810
e6827fcd7604
Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents:
805
diff
changeset
|
666 if((stateUsed->chargeStatus == CHARGER_off) |
|
e6827fcd7604
Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents:
805
diff
changeset
|
667 || (stateUsed->lifeData.ppO2Sensor_bar[0] != 0.0) |
|
e6827fcd7604
Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents:
805
diff
changeset
|
668 || (stateUsed->lifeData.ppO2Sensor_bar[1] != 0.0) |
|
e6827fcd7604
Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents:
805
diff
changeset
|
669 || (stateUsed->lifeData.ppO2Sensor_bar[2] != 0.0)) |
|
e6827fcd7604
Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents:
805
diff
changeset
|
670 { |
|
e6827fcd7604
Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents:
805
diff
changeset
|
671 t7_select_customview(CVIEW_sensors); |
|
e6827fcd7604
Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents:
805
diff
changeset
|
672 } |
| 576 | 673 } |
| 674 } | |
|
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
777
diff
changeset
|
675 |
|
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
777
diff
changeset
|
676 t7_tick(); |
| 38 | 677 } |
| 678 | |
| 679 | |
| 680 uint32_t tHome_DateCode(RTC_DateTypeDef *dateInput) | |
| 681 { | |
| 682 uint32_t answer = 0; | |
| 683 | |
| 684 answer = 0; | |
| 685 answer += (dateInput->Year & 0x7F)<< 9; | |
| 686 answer += (dateInput->Month & 0x0F)<< 5; | |
| 687 answer += (dateInput->Date & 0x1F); | |
| 688 | |
| 689 return answer; | |
| 690 } | |
| 691 | |
| 692 | |
| 693 uint8_t tHome_gas_writer(uint8_t oxygen_percentage, uint8_t helium_percentage, char *text) | |
| 694 { | |
| 695 if(oxygen_percentage == 100) | |
| 696 return (uint8_t) snprintf(text,10,"Oxy"); | |
| 697 else if((oxygen_percentage == 21) && (!helium_percentage)) | |
| 698 return (uint8_t) snprintf(text,10,"Air"); | |
| 699 else if(!helium_percentage) | |
| 700 return (uint8_t) snprintf(text,10,"NX%02i",oxygen_percentage); | |
| 701 else if((oxygen_percentage + helium_percentage) == 100) | |
| 702 return (uint8_t) snprintf(text,10,"HX%02i",oxygen_percentage); | |
| 703 else | |
| 704 return (uint8_t) snprintf(text,10,"%02i/%02i",oxygen_percentage,helium_percentage); | |
| 705 } | |
| 706 | |
| 707 uint8_t tHome_show_lost_connection_count(GFX_DrawCfgScreen *ScreenToWriteOn) | |
| 708 { | |
| 208 | 709 static uint8_t LastKnowRTEState = SPI_RX_STATE_INVALID; |
| 710 | |
| 99 | 711 if(!SPI_MIN_ERROR_SHOW) return 0; |
|
172
c659fda83e44
Minor: Button defaults, release date adjusted, use SPI_SHOW_SYNC_STATS
heinrichsweikamp
parents:
138
diff
changeset
|
712 if(DataEX_lost_connection_count()>=SPI_MIN_ERROR_SHOW && SPI_SHOW_SYNC_STATS){ |
| 38 | 713 |
| 99 | 714 char text[64]; |
| 38 | 715 |
| 82 | 716 SDataExchangeSlaveToMaster* dataIn=get_dataInPointer(); |
| 208 | 717 SDataReceiveFromMaster* pDataOut = dataOutGetPointer(); |
| 82 | 718 |
|
493
b560e474e319
Added possibility to switch between "classic" bigfont views and a selection with a new information combination
Ideenmodellierer
parents:
386
diff
changeset
|
719 snprintf(text,32,"spi err:\002 %ld/%ld",DataEX_lost_connection_count(),get_num_SPI_CALLBACKS()); |
| 99 | 720 Gfx_write_label_var(ScreenToWriteOn, 100,300, 0,&FontT24,CLUT_ButtonSymbols,text); |
| 82 | 721 |
| 104 | 722 // snprintf(text,32,"header:\002%X%X%X%X",dataIn->header.checkCode[0],dataIn->header.checkCode[1],dataIn->header.checkCode[2],dataIn->header.checkCode[3]); |
| 723 // Gfx_write_label_var(ScreenToWriteOn, 350,550, 0,&FontT24,CLUT_ButtonSymbols,text); | |
| 82 | 724 |
| 208 | 725 //snprintf(text,32,"footer:\002%X%X%X%X",dataIn->footer.checkCode[0],dataIn->footer.checkCode[1],dataIn->footer.checkCode[2],dataIn->footer.checkCode[3]); |
| 726 | |
| 727 /* data shifted => ignore received data */ | |
| 728 if((pDataOut->header.checkCode[SPI_HEADER_INDEX_RX_STATE] == SPI_RX_STATE_SHIFTED) || (pDataOut->header.checkCode[SPI_HEADER_INDEX_RX_STATE] == SPI_RX_STATE_OFFLINE)) | |
| 729 { | |
| 730 dataIn->header.checkCode[SPI_HEADER_INDEX_RX_STATE] = LastKnowRTEState; | |
| 731 } | |
| 732 else | |
| 733 { | |
| 734 LastKnowRTEState =dataIn->header.checkCode[SPI_HEADER_INDEX_RX_STATE]; | |
| 735 } | |
| 736 snprintf(text,32,"RX State M|R:\002%X|%X",pDataOut->header.checkCode[SPI_HEADER_INDEX_RX_STATE], dataIn->header.checkCode[SPI_HEADER_INDEX_RX_STATE] ); | |
| 99 | 737 Gfx_write_label_var(ScreenToWriteOn, 600,800, 0,&FontT24,CLUT_ButtonSymbols,text); |
| 738 } | |
| 82 | 739 |
| 99 | 740 |
| 741 | |
| 742 // snprintf(text,32,"cpt:\002%i",get_num_SPI_CALLBACKS()); | |
| 743 // Gfx_write_label_var(ScreenToWriteOn, 600,800, 90,&FontT24,CLUT_ButtonSymbols,text); | |
| 82 | 744 |
| 745 // snprintf(text,10,"i2c:\002%i",get_DataEX_Error_place()); | |
| 746 // Gfx_write_label_var(ScreenToWriteOn, 600,800, 90,&FontT24,CLUT_ButtonSymbols,text); | |
| 38 | 747 |
| 748 return DataEX_lost_connection_count(); | |
| 749 } |
