annotate Discovery/Src/tHome.c @ 861:ad96f99ebc78 Evo_2_23

Synchronize ADC and UART activities: depending on the cable configuration the UART sensor operation may have an impact to the ADC measurement (peaks). To avoid this the ADC measurements are now only started in case no UART communication is pending.
author Ideenmodellierer
date Tue, 07 May 2024 21:25:25 +0200
parents aed39d19269c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 /// -*- coding: UTF-8 -*-
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 /// \file Discovery/Src/tHome.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Control for Surface and Dive Templates
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 10-November-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 /// \details
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 /// $Id$
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 /// This program is free software: you can redistribute it and/or modify
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /// it under the terms of the GNU General Public License as published by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 /// the Free Software Foundation, either version 3 of the License, or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 /// (at your option) any later version.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /// This program is distributed in the hope that it will be useful,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 /// GNU General Public License for more details.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 /// You should have received a copy of the GNU General Public License
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 //////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 #include "tHome.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include "data_exchange_main.h" // for dataOutGetPointer()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 #include "gfx_fonts.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 #include "t3.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 #include "t4_tetris.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 #include "t5_gauge.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 #include "t6_apnea.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 #include "t7.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 #include "tDebug.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 #include "timer.h" // for timer_Stopwatch_Restart
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 #include "tMenu.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 #include "tMenuEditGasOC.h" // for openEdit_DiveSelectBetterGas()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 #include "tMenuEditSetpoint.h" // for openEdit_DiveSelectBetterSetpoint()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 /* Private types -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 /* Exported variables --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 _Bool warning_count_high_time = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 _Bool display_count_high_time = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 uint8_t errorsInSettings = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 static uint8_t warning_toogle_count;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 static uint16_t display_toogle_count;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 static uint16_t tHome_tick_count_cview;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 static uint16_t tHome_tick_count_field;
576
1105cf7bbf6f Return to o2 values:
Ideenmodellierer
parents: 542
diff changeset
60 static uint16_t tHome_tick_count_o2sens;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61
805
dd7ce655db26 Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents: 777
diff changeset
62 const uint8_t cv_changelist[] = {CVIEW_Compass, CVIEW_SummaryOfLeftCorner, CVIEW_Tissues, CVIEW_Profile, CVIEW_EADTime, CVIEW_Gaslist, CVIEW_noneOrDebug, CVIEW_Decolist, CVIEW_sensors,CVIEW_sensors_mV, CVIEW_Timer, CVIEW_END};
594
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 576
diff changeset
63 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
64 CVIEW_T3_Navigation, CVIEW_T3_DepthData, CVIEW_T3_DecoTTS,
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 576
diff changeset
65 #ifdef ENABLE_T3_PROFILE_VIEW
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 576
diff changeset
66 CVIEW_T3_Profile,
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 576
diff changeset
67 #endif
836
8d6c35655d4d Bugfix BF temperatur display and cv switching:
ideenmodellierer
parents: 816
diff changeset
68 CVIEW_T3_Temperature,
594
280c11153080 Added compile switch for new T3 View Profile
Ideenmodellierer
parents: 576
diff changeset
69 CVIEW_T3_END};
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72
576
1105cf7bbf6f Return to o2 values:
Ideenmodellierer
parents: 542
diff changeset
73 #define AUTORETURN_O2SENS (200u) /* return to sensor view after 20 seconds in case sensor is connected */
1105cf7bbf6f Return to o2 values:
Ideenmodellierer
parents: 542
diff changeset
74
1105cf7bbf6f Return to o2 values:
Ideenmodellierer
parents: 542
diff changeset
75
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 void set_globalState_tHome(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 if(stateUsed->mode == MODE_DIVE)
739
4a6bffaa38b3 Enable start dive in Big font display:
Ideenmodellierer
parents: 685
diff changeset
81 {
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 set_globalState(StD);
739
4a6bffaa38b3 Enable start dive in Big font display:
Ideenmodellierer
parents: 685
diff changeset
83 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 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
86
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
87 clearDisabledMenuLines();
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 void tHome_init(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 t7_init(); // standard + surface
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 t3_init(); // big font
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 t4_init(); // game
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 t5_init(); // gauge
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 t6_init(); // apnea
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 void tHome_init_compass(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 init_t7_compass();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 void tHome_refresh(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 SSettings* pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 warning_toogle_count++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 if(warning_toogle_count >= 2* pSettings->warning_blink_dsec)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 warning_toogle_count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 if(warning_toogle_count >= pSettings->warning_blink_dsec)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 warning_count_high_time = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 warning_count_high_time = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 display_toogle_count++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 if(display_toogle_count >= 2* pSettings->display_toogle_desc)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 display_toogle_count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 if(display_toogle_count >= pSettings->display_toogle_desc)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 display_count_high_time = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 display_count_high_time = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 if(pSettings->design == 6)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 t6_refresh();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 if(pSettings->design == 5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 t5_refresh();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 if(pSettings->design == 4)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 t4_refresh();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 if(pSettings->design == 3)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 t3_refresh();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 if(pSettings->design == 7)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 t7_refresh();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 pSettings->design = 7;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 t7_refresh();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 void tHome_sleepmode_fun(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 t7_refresh_sleepmode_fun();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158
773
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
159 static void checkSetStateSim(SSettings *settings)
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
160 {
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
161 if (is_stateUsedSetToSim()) {
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
162 if (settings->design != 3) {
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
163 set_globalState(StDSIM1);
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
164 } else {
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
165 #ifdef ENABLE_T3_PPO_SIM
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
166 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
167 set_globalState(StDSIM1);
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
168 } 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
169 set_globalState(StDSIM3);
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
170 } 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
171 set_globalState(StDSIM5);
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
172 } else {
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
173 set_globalState(StD);
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
174 }
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
175 #endif
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
176 }
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
177 } else {
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
178 set_globalState(StD);
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
179 }
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
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
182
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
183 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
184 {
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
185 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
186 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
187 } 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
188 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
189 }
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
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
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 void tHomeDiveMenuControl(uint8_t sendAction)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 {
773
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
195 SSettings *settings = settingsGetPointer();
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
196
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 if(sendAction == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 if(settingsGetPointer()->design == 4)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 switch(get_globalState())
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 {
516
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
204 case StD:
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
205 if(settingsGetPointer()->design == 6)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 if(is_stateUsedSetToSim())
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 set_globalState(StDSIM1);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 set_globalState(StDQUIT);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 if(settingsGetPointer()->design == 5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 if(t5_getCustomView() == CVIEW_Compass)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 set_globalState(StDBEAR);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 set_globalState(StDRAVG);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222
516
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
223 if(settingsGetPointer()->design == 3)
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
224 {
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
225 switch(t3_getCustomView())
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
226 {
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
227 case CVIEW_T3_Navigation:
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
228 case CVIEW_Compass: set_globalState(StDBEAR);
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
229 break;
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
230 case CVIEW_T3_StopWatch: set_globalState(StDRAVG);
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
231 break;
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
232 case CVIEW_T3_GasList: if(stateUsed->warnings.betterGas)
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
233 {
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
234 set_globalState(StDMGAS);
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
235 }
838
aed39d19269c Added T3 autofocus for Gas list:
Ideenmodellierer
parents: 836
diff changeset
236 else
aed39d19269c Added T3 autofocus for Gas list:
Ideenmodellierer
parents: 836
diff changeset
237 {
aed39d19269c Added T3 autofocus for Gas list:
Ideenmodellierer
parents: 836
diff changeset
238 set_globalState(StDMENU);
aed39d19269c Added T3 autofocus for Gas list:
Ideenmodellierer
parents: 836
diff changeset
239 }
516
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
240 break;
633
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
241 #ifdef ENABLE_T3_PPO_SIM
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
242 case CVIEW_sensors: if(is_stateUsedSetToSim())
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
243 {
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
244 set_globalState(StDSIM1);
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
245 }
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
246 break;
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
247 #endif
628
db2bcd2f6778 Added compile switch for T3_PROFILE menu operation option
Ideenmodellierer
parents: 619
diff changeset
248 #ifdef ENABLE_T3_PROFILE_VIEW
613
beeb23d18443 Added "Set Marker" to T3 quick menu:
Ideenmodellierer
parents: 594
diff changeset
249 case CVIEW_T3_Profile: set_globalState(StDMARK);
628
db2bcd2f6778 Added compile switch for T3_PROFILE menu operation option
Ideenmodellierer
parents: 619
diff changeset
250 #endif
613
beeb23d18443 Added "Set Marker" to T3 quick menu:
Ideenmodellierer
parents: 594
diff changeset
251 break;
516
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
252 default:
739
4a6bffaa38b3 Enable start dive in Big font display:
Ideenmodellierer
parents: 685
diff changeset
253 set_globalState(StDMENU);
516
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
254 break;
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
255 }
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
256 break;
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
257 }
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
258
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259 if(stateUsed->warnings.betterGas)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 set_globalState(StDMGAS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 if(stateUsed->warnings.betterSetpoint)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 set_globalState(StDMSPT);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 set_globalState(StDMENU);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 case StDMGAS:
516
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
269 if(settingsGetPointer()->design == 3)
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
270 {
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
271 set_globalState(StD);
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
272 }
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
273 else
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
274 {
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
275 if(stateUsed->warnings.betterSetpoint)
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
276 set_globalState(StDMSPT);
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
277 else
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
278 set_globalState(StDMENU);
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
279 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 case StDMSPT:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 set_globalState(StDMENU);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 case StDMENU:
773
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
287 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
288 set_globalState(StDBAILOUT);
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
289
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
290 break;
633
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
291 }
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
292
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
293 checkSetStateCompassSim(settings);
773
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
294
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 break;
773
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
296 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
297 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
298 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
299
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
300 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
301 }
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
302
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
303 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
304
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 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
306 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
307 checkSetStateCompassSim(settings);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308
773
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
309 break;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 case StDSIM1:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 set_globalState(StDSIM2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 case StDSIM2:
633
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
315 if(settingsGetPointer()->design != 3)
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
316 {
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
317 set_globalState(StDSIM3);
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
318 }
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
319 else
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
320 {
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
321 #ifdef ENABLE_T3_PPO_SIM
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
322 if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x02) == 0)
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
323 {
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
324 set_globalState(StDSIM3);
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
325 }
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
326 else if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x04) == 0)
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
327 {
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
328 set_globalState(StDSIM5);
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 else
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 set_globalState(StD);
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 #endif
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
335 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 case StDSIM3:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 set_globalState(StDSIM4);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 case StDSIM4:
633
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
343 if(settingsGetPointer()->design != 3)
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
344 {
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
345 set_globalState(StD);
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
346 }
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
347 else
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
348 {
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
349 #ifdef ENABLE_T3_PPO_SIM
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
350 if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x04) == 0)
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
351 {
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
352 set_globalState(StDSIM5);
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
353 }
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
354 else
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
355 {
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
356 set_globalState(StD);
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 #endif
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 break;
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
361 #ifdef ENABLE_T3_PPO_SIM
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
362 case StDSIM5:
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
363 set_globalState(StDSIM6);
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
364 break;
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 case StDSIM6:
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 set_globalState(StD);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 break;
633
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
369 #endif
516
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
370 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
371 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
372 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
373
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
374 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
375 }
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
376
516
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
377 if(settingsGetPointer()->design == 5)
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
378 {
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
379 set_globalState(StDRAVG);
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
380 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381
516
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
382 if(settingsGetPointer()->design == 3)
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
383 {
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
384 if(t3_getCustomView() == CVIEW_T3_Navigation)
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
385 {
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
386 set_globalState(StDRAVG);
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
387 }
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
388 else
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 set_globalState(StD);
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 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393 break;
516
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
394 case StDRAVG:
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
395 if(settingsGetPointer()->design == 5)
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
396 {
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
397 if(is_stateUsedSetToSim())
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
398 set_globalState(StDSIM1);
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
399 else
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
400 set_globalState(StD);
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
401 break;
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 else
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
404 {
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
405 set_globalState(StD);
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
406 }
bd66f4910993 Added quick menu function to big font view:
Ideenmodellierer
parents: 505
diff changeset
407 break;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408 case StDQUIT: // t6_apnea
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409 set_globalState(StD);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411
619
8fa2de4414a8 Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents: 613
diff changeset
412 case StDMARK:
8fa2de4414a8 Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents: 613
diff changeset
413 if((settingsGetPointer()->design == 3) && (MiniLiveLogbook_getNextMarkerIndex(0) != 0))
8fa2de4414a8 Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents: 613
diff changeset
414 {
8fa2de4414a8 Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents: 613
diff changeset
415 set_globalState(StDCHECK);
8fa2de4414a8 Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents: 613
diff changeset
416 }
8fa2de4414a8 Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents: 613
diff changeset
417 else
8fa2de4414a8 Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents: 613
diff changeset
418 {
8fa2de4414a8 Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents: 613
diff changeset
419 set_globalState(StD);
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 break;
8fa2de4414a8 Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents: 613
diff changeset
422
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423 default:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424 set_globalState(StD);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428 if(sendAction == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
430 if(settingsGetPointer()->design == 4)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
431 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
432
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
433 switch(get_globalState())
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435 case StDMGAS:
773
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
436 openEdit_DiveSelectBetterGas(false);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437 set_globalState(StD);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439 case StDMSPT:
773
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
440 openEdit_DiveSelectBetterSetpoint(false);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 set_globalState(StD);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444 case StDMENU:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445 openMenu_first_page_with_OC_gas_update();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
447
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448 case StDSIM1:
633
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
449 if(settingsGetPointer()->design != 3)
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
450 {
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451 Sim_Quit();
633
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
452 }
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
453 else
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
454 {
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
455 Sim_IncreasePPO(0);
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
456 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
458
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
459 case StDSIM2:
633
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
460 if(settingsGetPointer()->design != 3)
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
461 {
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
462 Sim_Ascend();
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
463 }
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
464 else
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
465 {
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
466 Sim_DecreasePPO(0);
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
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
470
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
471 case StDSIM3:
633
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
472 if(settingsGetPointer()->design != 3)
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
473 {
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 Sim_Descend();
633
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
475 }
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
476 else
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
477 {
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
478 Sim_IncreasePPO(1);
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
479 }
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
480
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483 case StDSIM4:
633
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
484 if(settingsGetPointer()->design != 3)
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
485 {
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
486 Sim_Divetime();
633
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
487 }
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
488 else
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
489 {
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
490 Sim_DecreasePPO(1);
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
491 }
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
492
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
493 break;
633
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
494 #ifdef ENABLE_T3_PPO_SIM
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
495 case StDSIM5:
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
496 Sim_IncreasePPO(2);
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
497 break;
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
498 case StDSIM6:
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
499 Sim_DecreasePPO(2);
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
500 break;
68d95049f11a Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents: 628
diff changeset
501 #endif
773
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
502 case StDBAILOUT:
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
503 if (isLoopMode(stateUsed->diveSettings.diveMode)) {
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
504 tMEGas_check_switch_to_bailout();
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
505
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
506 openEdit_DiveSelectBetterGas(true);
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
507 } else {
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
508 checkSwitchToLoop();
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
509
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
510 openEdit_DiveSelectBetterSetpoint(true);
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
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
513 set_globalState(StD);
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
514
2c243233c999 Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents: 739
diff changeset
515 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
516 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
517 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
518
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
519 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
520
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
521 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
522 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
523 setCompassHeading((uint16_t)stateUsed->lifeData.compass_heading);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
524 set_globalState(StD);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
525 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
526
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
527 case StDRAVG: // t5_gauge
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
528 timer_Stopwatch_Restart();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
529 set_globalState(StD);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
530 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
531
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
532 case StDQUIT: // t6_apnea
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
533 set_globalState(StD); // used to end StDQUIT, is called before everything else because changes are made in the next lines
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
534 if(is_stateUsedSetToSim())
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
535 Sim_Quit();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
536 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
537 dataOutGetPointer()->setEndDive = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
538 break;
613
beeb23d18443 Added "Set Marker" to T3 quick menu:
Ideenmodellierer
parents: 594
diff changeset
539 case StDMARK: stateUsedWrite->events.manualMarker = 1;
beeb23d18443 Added "Set Marker" to T3 quick menu:
Ideenmodellierer
parents: 594
diff changeset
540 set_globalState(StD);
beeb23d18443 Added "Set Marker" to T3 quick menu:
Ideenmodellierer
parents: 594
diff changeset
541 break;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
542
619
8fa2de4414a8 Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents: 613
diff changeset
543 case StDCHECK: MiniLiveLogbook_checkMarker();
8fa2de4414a8 Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents: 613
diff changeset
544 break;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
545 default:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
546 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
547 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
548 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
549 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
550
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
551
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
552 void tHome_findNextStop(const uint16_t *list, uint8_t *depthOutMeter, uint16_t *lengthOutSeconds)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
553 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
554 uint8_t ptr = DECOINFO_STRUCT_MAX_STOPS - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
555
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
556 while(ptr && !list[ptr])
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
557 ptr--;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
558
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
559 *lengthOutSeconds = list[ptr];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
560 if(!(*lengthOutSeconds))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
561 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
562 *depthOutMeter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
563 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
564 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
565 if(ptr == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
566 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
567 *depthOutMeter = (uint8_t)((stateUsed->diveSettings.last_stop_depth_bar*10.0f) + 0.1f);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
568 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
569 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
570 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
571 ptr -= 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
572 *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);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
573 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
574 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
575
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
576
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
577 void tHome_change_field_button_pressed(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
578 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
579 tHome_tick_count_field = 0;
576
1105cf7bbf6f Return to o2 values:
Ideenmodellierer
parents: 542
diff changeset
580 tHome_tick_count_o2sens = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
581 if(settingsGetPointer()->design == 7)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
582 t7_change_field();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
583 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
584
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
585
361
b111fc4250e9 Pass action to customer vie update function.
Ideenmodellierer
parents: 289
diff changeset
586 void tHome_change_customview_button_pressed(uint8_t action)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
587 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
588 tHome_tick_count_cview = 0;
576
1105cf7bbf6f Return to o2 values:
Ideenmodellierer
parents: 542
diff changeset
589 tHome_tick_count_o2sens = 0;
1105cf7bbf6f Return to o2 values:
Ideenmodellierer
parents: 542
diff changeset
590
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
591 if(settingsGetPointer()->design == 7)
361
b111fc4250e9 Pass action to customer vie update function.
Ideenmodellierer
parents: 289
diff changeset
592 t7_change_customview(action);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
593 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
594 if(settingsGetPointer()->design == 3)
386
39c147e47c1c Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents: 384
diff changeset
595 t3_change_customview(action);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
596 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
597 if(settingsGetPointer()->design == 5)
386
39c147e47c1c Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents: 384
diff changeset
598 t5_change_customview(action);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
599 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
600 if(settingsGetPointer()->design == 6)
386
39c147e47c1c Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents: 384
diff changeset
601 t6_change_customview(action);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
602 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
603
505
06b21f1e47a5 Removed second big font profile
Ideenmodellierer
parents: 493
diff changeset
604 uint8_t tHome_getNumberOfAvailableCVs(const uint8_t* pcv_list)
06b21f1e47a5 Removed second big font profile
Ideenmodellierer
parents: 493
diff changeset
605 {
06b21f1e47a5 Removed second big font profile
Ideenmodellierer
parents: 493
diff changeset
606 uint8_t cnt = 0;
06b21f1e47a5 Removed second big font profile
Ideenmodellierer
parents: 493
diff changeset
607
06b21f1e47a5 Removed second big font profile
Ideenmodellierer
parents: 493
diff changeset
608 while((pcv_list[cnt] != CVIEW_END) && (pcv_list[cnt] != CVIEW_T3_END))
06b21f1e47a5 Removed second big font profile
Ideenmodellierer
parents: 493
diff changeset
609 {
06b21f1e47a5 Removed second big font profile
Ideenmodellierer
parents: 493
diff changeset
610 cnt++;
06b21f1e47a5 Removed second big font profile
Ideenmodellierer
parents: 493
diff changeset
611 if (cnt > 100) /* just in case an invalid list has been provided... */
06b21f1e47a5 Removed second big font profile
Ideenmodellierer
parents: 493
diff changeset
612 {
06b21f1e47a5 Removed second big font profile
Ideenmodellierer
parents: 493
diff changeset
613 break;
06b21f1e47a5 Removed second big font profile
Ideenmodellierer
parents: 493
diff changeset
614 }
06b21f1e47a5 Removed second big font profile
Ideenmodellierer
parents: 493
diff changeset
615 }
06b21f1e47a5 Removed second big font profile
Ideenmodellierer
parents: 493
diff changeset
616 cnt--; /* do not count end token */
06b21f1e47a5 Removed second big font profile
Ideenmodellierer
parents: 493
diff changeset
617 return cnt;
06b21f1e47a5 Removed second big font profile
Ideenmodellierer
parents: 493
diff changeset
618 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
619
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
620 void tHome_tick(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
621 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
622 uint16_t field = settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
623 uint16_t cview = settingsGetPointer()->tX_customViewTimeout;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
624
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
625 if(field)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
626 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
627 tHome_tick_count_field++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
628 if(tHome_tick_count_field > (field * 10))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
629 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
630 tHome_tick_count_field = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
631 if(settingsGetPointer()->design == 7)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
632 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
633 t7_set_field_to_primary();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
634 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
635 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
636 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
637
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
638 if(cview)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
639 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
640 tHome_tick_count_cview++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
641 if(tHome_tick_count_cview > (cview *10))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
642 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
643 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
644 if (settingsGetPointer()->design == 7 && !t7_isTimerRunning(false)) {
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
645 t7_set_customview_to_primary();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
646 }
541
6fbf7cd391cb Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents: 516
diff changeset
647 if(settingsGetPointer()->design == 3)
6fbf7cd391cb Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents: 516
diff changeset
648 {
6fbf7cd391cb Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents: 516
diff changeset
649 t3_set_customview_to_primary();
6fbf7cd391cb Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents: 516
diff changeset
650 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
651 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
652 }
576
1105cf7bbf6f Return to o2 values:
Ideenmodellierer
parents: 542
diff changeset
653
810
e6827fcd7604 Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents: 805
diff changeset
654 if((stateUsed->mode == MODE_SURFACE) && (!t7_customview_disabled(CVIEW_sensors)))
576
1105cf7bbf6f Return to o2 values:
Ideenmodellierer
parents: 542
diff changeset
655 {
1105cf7bbf6f Return to o2 values:
Ideenmodellierer
parents: 542
diff changeset
656 tHome_tick_count_o2sens++;
1105cf7bbf6f Return to o2 values:
Ideenmodellierer
parents: 542
diff changeset
657 if(tHome_tick_count_o2sens > AUTORETURN_O2SENS)
1105cf7bbf6f Return to o2 values:
Ideenmodellierer
parents: 542
diff changeset
658 {
1105cf7bbf6f Return to o2 values:
Ideenmodellierer
parents: 542
diff changeset
659 tHome_tick_count_o2sens = 0;
810
e6827fcd7604 Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents: 805
diff changeset
660 if((stateUsed->chargeStatus == CHARGER_off)
e6827fcd7604 Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents: 805
diff changeset
661 || (stateUsed->lifeData.ppO2Sensor_bar[0] != 0.0)
e6827fcd7604 Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents: 805
diff changeset
662 || (stateUsed->lifeData.ppO2Sensor_bar[1] != 0.0)
e6827fcd7604 Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents: 805
diff changeset
663 || (stateUsed->lifeData.ppO2Sensor_bar[2] != 0.0))
e6827fcd7604 Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents: 805
diff changeset
664 {
e6827fcd7604 Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents: 805
diff changeset
665 t7_select_customview(CVIEW_sensors);
e6827fcd7604 Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents: 805
diff changeset
666 }
576
1105cf7bbf6f Return to o2 values:
Ideenmodellierer
parents: 542
diff changeset
667 }
1105cf7bbf6f Return to o2 values:
Ideenmodellierer
parents: 542
diff changeset
668 }
805
dd7ce655db26 Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents: 777
diff changeset
669
dd7ce655db26 Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents: 777
diff changeset
670 t7_tick();
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
671 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
672
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
673
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
674 uint32_t tHome_DateCode(RTC_DateTypeDef *dateInput)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
675 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
676 uint32_t answer = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
677
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
678 answer = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
679 answer += (dateInput->Year & 0x7F)<< 9;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
680 answer += (dateInput->Month & 0x0F)<< 5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
681 answer += (dateInput->Date & 0x1F);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
682
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
683 return answer;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
684 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
685
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
686
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
687 uint8_t tHome_gas_writer(uint8_t oxygen_percentage, uint8_t helium_percentage, char *text)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
688 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
689 if(oxygen_percentage == 100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
690 return (uint8_t) snprintf(text,10,"Oxy");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
691 else if((oxygen_percentage == 21) && (!helium_percentage))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
692 return (uint8_t) snprintf(text,10,"Air");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
693 else if(!helium_percentage)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
694 return (uint8_t) snprintf(text,10,"NX%02i",oxygen_percentage);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
695 else if((oxygen_percentage + helium_percentage) == 100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
696 return (uint8_t) snprintf(text,10,"HX%02i",oxygen_percentage);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
697 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
698 return (uint8_t) snprintf(text,10,"%02i/%02i",oxygen_percentage,helium_percentage);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
699 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
700
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
701 uint8_t tHome_show_lost_connection_count(GFX_DrawCfgScreen *ScreenToWriteOn)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
702 {
208
9fc06e1e0f66 Update SPI error display and handling
ideenmodellierer
parents: 191
diff changeset
703 static uint8_t LastKnowRTEState = SPI_RX_STATE_INVALID;
9fc06e1e0f66 Update SPI error display and handling
ideenmodellierer
parents: 191
diff changeset
704
99
6a2308b9a3d4 Config for debug data
Dmitry Romanov <kitt@bk.ru>
parents: 84
diff changeset
705 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
706 if(DataEX_lost_connection_count()>=SPI_MIN_ERROR_SHOW && SPI_SHOW_SYNC_STATS){
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
707
99
6a2308b9a3d4 Config for debug data
Dmitry Romanov <kitt@bk.ru>
parents: 84
diff changeset
708 char text[64];
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
709
82
a6f0881074a4 +i2c analog noise filtering
Dmitry Romanov <kitt@bk.ru>
parents: 38
diff changeset
710 SDataExchangeSlaveToMaster* dataIn=get_dataInPointer();
208
9fc06e1e0f66 Update SPI error display and handling
ideenmodellierer
parents: 191
diff changeset
711 SDataReceiveFromMaster* pDataOut = dataOutGetPointer();
82
a6f0881074a4 +i2c analog noise filtering
Dmitry Romanov <kitt@bk.ru>
parents: 38
diff changeset
712
493
b560e474e319 Added possibility to switch between "classic" bigfont views and a selection with a new information combination
Ideenmodellierer
parents: 386
diff changeset
713 snprintf(text,32,"spi err:\002 %ld/%ld",DataEX_lost_connection_count(),get_num_SPI_CALLBACKS());
99
6a2308b9a3d4 Config for debug data
Dmitry Romanov <kitt@bk.ru>
parents: 84
diff changeset
714 Gfx_write_label_var(ScreenToWriteOn, 100,300, 0,&FontT24,CLUT_ButtonSymbols,text);
82
a6f0881074a4 +i2c analog noise filtering
Dmitry Romanov <kitt@bk.ru>
parents: 38
diff changeset
715
104
22a1094545f3 Tested and alive.
Dmitry Romanov <kitt@bk.ru>
parents: 99
diff changeset
716 // 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]);
22a1094545f3 Tested and alive.
Dmitry Romanov <kitt@bk.ru>
parents: 99
diff changeset
717 // Gfx_write_label_var(ScreenToWriteOn, 350,550, 0,&FontT24,CLUT_ButtonSymbols,text);
82
a6f0881074a4 +i2c analog noise filtering
Dmitry Romanov <kitt@bk.ru>
parents: 38
diff changeset
718
208
9fc06e1e0f66 Update SPI error display and handling
ideenmodellierer
parents: 191
diff changeset
719 //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]);
9fc06e1e0f66 Update SPI error display and handling
ideenmodellierer
parents: 191
diff changeset
720
9fc06e1e0f66 Update SPI error display and handling
ideenmodellierer
parents: 191
diff changeset
721 /* data shifted => ignore received data */
9fc06e1e0f66 Update SPI error display and handling
ideenmodellierer
parents: 191
diff changeset
722 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))
9fc06e1e0f66 Update SPI error display and handling
ideenmodellierer
parents: 191
diff changeset
723 {
9fc06e1e0f66 Update SPI error display and handling
ideenmodellierer
parents: 191
diff changeset
724 dataIn->header.checkCode[SPI_HEADER_INDEX_RX_STATE] = LastKnowRTEState;
9fc06e1e0f66 Update SPI error display and handling
ideenmodellierer
parents: 191
diff changeset
725 }
9fc06e1e0f66 Update SPI error display and handling
ideenmodellierer
parents: 191
diff changeset
726 else
9fc06e1e0f66 Update SPI error display and handling
ideenmodellierer
parents: 191
diff changeset
727 {
9fc06e1e0f66 Update SPI error display and handling
ideenmodellierer
parents: 191
diff changeset
728 LastKnowRTEState =dataIn->header.checkCode[SPI_HEADER_INDEX_RX_STATE];
9fc06e1e0f66 Update SPI error display and handling
ideenmodellierer
parents: 191
diff changeset
729 }
9fc06e1e0f66 Update SPI error display and handling
ideenmodellierer
parents: 191
diff changeset
730 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
6a2308b9a3d4 Config for debug data
Dmitry Romanov <kitt@bk.ru>
parents: 84
diff changeset
731 Gfx_write_label_var(ScreenToWriteOn, 600,800, 0,&FontT24,CLUT_ButtonSymbols,text);
6a2308b9a3d4 Config for debug data
Dmitry Romanov <kitt@bk.ru>
parents: 84
diff changeset
732 }
82
a6f0881074a4 +i2c analog noise filtering
Dmitry Romanov <kitt@bk.ru>
parents: 38
diff changeset
733
99
6a2308b9a3d4 Config for debug data
Dmitry Romanov <kitt@bk.ru>
parents: 84
diff changeset
734
6a2308b9a3d4 Config for debug data
Dmitry Romanov <kitt@bk.ru>
parents: 84
diff changeset
735
6a2308b9a3d4 Config for debug data
Dmitry Romanov <kitt@bk.ru>
parents: 84
diff changeset
736 // snprintf(text,32,"cpt:\002%i",get_num_SPI_CALLBACKS());
6a2308b9a3d4 Config for debug data
Dmitry Romanov <kitt@bk.ru>
parents: 84
diff changeset
737 // Gfx_write_label_var(ScreenToWriteOn, 600,800, 90,&FontT24,CLUT_ButtonSymbols,text);
82
a6f0881074a4 +i2c analog noise filtering
Dmitry Romanov <kitt@bk.ru>
parents: 38
diff changeset
738
a6f0881074a4 +i2c analog noise filtering
Dmitry Romanov <kitt@bk.ru>
parents: 38
diff changeset
739 // snprintf(text,10,"i2c:\002%i",get_DataEX_Error_place());
a6f0881074a4 +i2c analog noise filtering
Dmitry Romanov <kitt@bk.ru>
parents: 38
diff changeset
740 // Gfx_write_label_var(ScreenToWriteOn, 600,800, 90,&FontT24,CLUT_ButtonSymbols,text);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
741
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
742 return DataEX_lost_connection_count();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
743 }