annotate Discovery/Src/tMenuEditXtra.c @ 688:8c92f7743e14 Betatest

Added sanity check for temperature and pressure values: It happens from time to time at the debug hardware (electronic without housing) that pressure or temperature are in an invalid range . To avoid side effects a sanity check has been added.
author Ideenmodellierer
date Fri, 05 Aug 2022 15:13:29 +0200
parents 1b995079c045
children e81afd727993
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/tMenuEditXtra.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Menu Edit Xtra - Specials in Divemode like Reset Stopwatch
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 02-Mar-2015
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 "tMenuEditXtra.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include "gfx_fonts.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 #include "simulation.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 #include "timer.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 #include "tMenuEdit.h"
347
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
36 #include "data_exchange_main.h"
547
12f8745c8a94 Added viewport calibration to dive menu:
Ideenmodellierer
parents: 347
diff changeset
37 #include "motion.h"
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
38 #include "configuration.h"
347
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
39
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 void openEdit_CompassHeading(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 void openEdit_ResetStopwatch(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 void openEdit_SimFollowDecostops(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 void openEdit_SetManualMarker(void);
347
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
46 void openEdit_SetEndDive(void);
552
531e7818b737 Added menu structure to acces viewport calibration:
Ideenmodellierer
parents: 547
diff changeset
47 void openEdit_CalibViewport(void);
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
48 static void openEdit_ScrubberTimer(uint8_t line);
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
49 static void openEdit_ScrubberReset(void);
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
50 static void openEdit_ScrubberTimerMode(void);
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
51 #ifdef ENABLE_PSCR_MODE
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
52 static void openEdit_PSCRO2Drop(uint8_t line);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
53 static void openEdit_PSCRLungRatio(uint8_t line);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
54 #endif
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
55 #ifdef ENABLE_CO2_SUPPORT
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
56 static void openEdit_CO2Sensor(void);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
57 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 /* Announced function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
61 static uint8_t OnAction_ScrubberTimer(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
62 #ifdef ENABLE_PSCR_MODE
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
63 static uint8_t OnAction_PSCRO2Drop(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
64 static uint8_t OnAction_PSCRLungRation(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
65 #endif
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
66
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
67 #ifdef ENABLE_CO2_SUPPORT
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
68 static uint8_t OnAction_CO2OnOff(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
69 static uint8_t OnAction_CO2Calib(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
70 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 void openEdit_Xtra(uint8_t line)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 set_globalState_Menu_Line(line);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 resetMenuEdit(CLUT_MenuPageXtra);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
79 /* DIVE MODE */
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
80 if(actual_menu_content != MENU_SURFACE)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 {
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
82 switch(line)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
83 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
84 case 1:
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
85 default:
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
86 openEdit_ResetStopwatch();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
87 break;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
88 case 2:
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
89 openEdit_CompassHeading();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
90 break;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
91 case 3:
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
92 openEdit_SetManualMarker();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
93 break;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
94 case 4:
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
95 openEdit_CalibViewport();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
96 break;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
97 case 5:
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
98 if(is_stateUsedSetToSim())
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
99 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
100 openEdit_SimFollowDecostops();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
101 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
102 else
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
103 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
104 openEdit_SetEndDive();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
105 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
106 break;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
107 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
108 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
109 else /* surface mode */
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
110 {
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
111 if((settingsGetPointer()->dive_mode != DIVEMODE_PSCR) && (line > 3)) /* PSCR items are only optional */
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
112 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
113 line = 6;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
114 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
115
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
116 switch(line)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
117 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
118 case 1: openEdit_ScrubberTimer(line);
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
119 break;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
120 case 2: openEdit_ScrubberReset();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
121 break;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
122 case 3: openEdit_ScrubberTimerMode();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
123 break;
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
124 #ifdef ENABLE_PSCR_MODE
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
125 case 4: openEdit_PSCRO2Drop(line);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
126 break;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
127 case 5: openEdit_PSCRLungRatio(line);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
128 break;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
129 #endif
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
130 #ifdef ENABLE_CO2_SUPPORT
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
131 case 6: openEdit_CO2Sensor();
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
132 break;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
133 #endif
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
134 default:
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
135 break;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
136 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 void openEdit_ResetStopwatch(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 timer_Stopwatch_Restart();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 exitMenuEdit_to_Home();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 void openEdit_SetManualMarker(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 272
diff changeset
149 stateUsedWrite->events.manualMarker = 1;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 exitMenuEdit_to_Home();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152
347
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
153 void openEdit_SetEndDive(void)
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
154 {
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
155 dataOutGetPointer()->setEndDive = 1;
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
156 exitMenuEdit_to_Home();
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
157 }
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
158
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 void openEdit_SimFollowDecostops(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 simulation_set_heed_decostops(!simulation_get_heed_decostops());
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 exitMenuEdit_to_Menu_with_Menu_Update();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164
547
12f8745c8a94 Added viewport calibration to dive menu:
Ideenmodellierer
parents: 347
diff changeset
165 void openEdit_CalibViewport(void)
12f8745c8a94 Added viewport calibration to dive menu:
Ideenmodellierer
parents: 347
diff changeset
166 {
12f8745c8a94 Added viewport calibration to dive menu:
Ideenmodellierer
parents: 347
diff changeset
167 calibrateViewport(stateUsed->lifeData.compass_roll, stateUsed->lifeData.compass_pitch, stateUsed->lifeData.compass_heading);
648
ff2b393e290f Motion detection: Enable focus after focus calibration:
Ideenmodellierer
parents: 552
diff changeset
168 suspendMotionDetection(0); /* exit to focus mode directly */
547
12f8745c8a94 Added viewport calibration to dive menu:
Ideenmodellierer
parents: 347
diff changeset
169 exitMenuEdit_to_Home();
12f8745c8a94 Added viewport calibration to dive menu:
Ideenmodellierer
parents: 347
diff changeset
170 }
12f8745c8a94 Added viewport calibration to dive menu:
Ideenmodellierer
parents: 347
diff changeset
171
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
172
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
173
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
174 static void openEdit_ScrubberTimer(uint8_t line)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
175 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
176 uint16_t localScrubTimer;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
177 uint16_t y_line;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
178
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
179 char text[32];
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
180 SSettings *pSettings = settingsGetPointer();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
181 localScrubTimer = pSettings->scrubTimerMax;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
182
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
183 y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP);
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
184
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
185 text[0] = '\001';
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
186 text[1] = TXT_ScrubTime;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
187 text[2] = 0;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
188 write_topline(text);
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
189
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
190 text[0] = '\002';
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
191 strcpy(&text[1],"\016\016");
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
192 text[3] = TXT_Minutes;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
193 text[4] = 0;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
194 write_label_fix( 20, 800, y_line, &FontT48, TXT_ScrubTime);
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
195 write_label_var( 435, 780, y_line, &FontT48, text);
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
196 write_field_udigit(StMXTRA_ScrubTimer_Max_Minutes, 600, 779, y_line, &FontT48, "###", (uint32_t)localScrubTimer, 0, 0, 0);
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
197
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
198 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
199
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
200 setEvent(StMXTRA_ScrubTimer_Max_Minutes, (uint32_t)OnAction_ScrubberTimer);
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
201 startEdit();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
202 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
203
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
204 static void openEdit_ScrubberReset(void)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
205 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
206 SSettings *pSettings;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
207 pSettings = settingsGetPointer();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
208 pSettings->scrubTimerCur = pSettings->scrubTimerMax;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
209 exitMenuEdit_to_Menu_with_Menu_Update();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
210 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
211
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
212 static void openEdit_ScrubberTimerMode(void)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
213 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
214 uint8_t newMode;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
215 SSettings *pSettings;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
216 pSettings = settingsGetPointer();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
217 newMode = pSettings->scrubTimerMode + 1;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
218 if(newMode >= SCRUB_TIMER_END)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
219 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
220 newMode = SCRUB_TIMER_OFF;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
221 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
222 pSettings->scrubTimerMode = newMode;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
223 exitMenuEdit_to_Menu_with_Menu_Update();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
224 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
225
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
226 #ifdef ENABLE_PSCR_MODE
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
227 static void openEdit_PSCRO2Drop(uint8_t line)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
228 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
229 uint8_t localO2Drop;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
230 uint16_t y_line;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
231
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
232 char text[32];
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
233 SSettings *pSettings = settingsGetPointer();
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
234 localO2Drop = pSettings->pscr_o2_drop;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
235
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
236 y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
237
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
238 text[0] = '\001';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
239 text[1] = TXT_PSCRO2Drop;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
240 text[2] = 0;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
241 write_topline(text);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
242
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
243 text[0] = '\002';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
244 text[1] = '\016';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
245 text[2] = '\016';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
246 text[3] = '%';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
247 text[4] = 0;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
248 write_label_fix( 20, 800, y_line, &FontT48, TXT_PSCRO2Drop);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
249 write_label_var( 435, 780, y_line, &FontT48, text);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
250 write_field_udigit(StMXTRA_PSCR_O2_Drop, 710, 779, y_line, &FontT48, "##", (uint32_t)localO2Drop, 0, 0, 0);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
251
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
252 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
253
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
254 setEvent(StMXTRA_PSCR_O2_Drop, (uint32_t)OnAction_PSCRO2Drop);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
255 startEdit();
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
256 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
257
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
258 static void openEdit_PSCRLungRatio(uint8_t line)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
259 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
260 uint8_t localLungRatio;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
261 uint16_t y_line;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
262
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
263 char text[32];
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
264 SSettings *pSettings = settingsGetPointer();
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
265 localLungRatio = pSettings->pscr_lung_ratio;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
266
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
267 y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
268
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
269 text[0] = '\001';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
270 text[1] = TXT_PSCRO2Drop;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
271 text[2] = 0;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
272 write_topline(text);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
273
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
274 text[0] = '\002';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
275 text[1] = '1';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
276 text[2] = '/';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
277 text[3] = 0;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
278
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
279 write_label_fix( 20, 800, y_line, &FontT48, TXT_PSCRLungRatio);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
280 write_label_var( 435, 710, y_line, &FontT48, text);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
281 write_field_udigit(StMXTRA_PSCR_LUNG_RATIO, 710, 779, y_line, &FontT48, "##", (uint32_t)localLungRatio, 0, 0, 0);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
282
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
283 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
284
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
285 setEvent(StMXTRA_PSCR_LUNG_RATIO, (uint32_t)OnAction_PSCRLungRation);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
286 startEdit();
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
287 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
288 #endif
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
289
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
290 #ifdef ENABLE_CO2_SUPPORT
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
291 static void openEdit_CO2Sensor()
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
292 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
293 char text[32];
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
294 snprintf(text,32,"\001%c",TXT_CO2Sensor);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
295 write_topline(text);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
296
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
297 refresh_CO2Data();
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
298 if(settingsGetPointer()->co2_sensor_active)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
299 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
300 text[0] = '\005';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
301 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
302 else
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
303 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
304 text[0] = '\006';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
305 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
306 text[0] = TXT_CO2Sensor;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
307 text[1] = 0;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
308
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
309 write_field_on_off(StMXTRA_CO2_Sensor, 30, 95, ME_Y_LINE3, &FontT48, text, settingsGetPointer()->co2_sensor_active);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
310
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
311 text[0] = TXT_2BYTE;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
312 text[1] = TXT2BYTE_O2Calib;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
313 text[2] = 0;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
314 write_field_button(StMXTRA_CO2_Sensor_Calib,30, 800, ME_Y_LINE4, &FontT48, text);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
315
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
316 setEvent(StMXTRA_CO2_Sensor, (uint32_t)OnAction_CO2OnOff);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
317 setEvent(StMXTRA_CO2_Sensor_Calib, (uint32_t)OnAction_CO2Calib);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
318
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
319 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
320 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
321 #endif
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
322
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 void refresh_CompassHeading(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 uint16_t heading;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 text[1] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 text[2] = TXT2BYTE_CompassHeading;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 text[3] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 heading = (uint16_t)stateUsed->lifeData.compass_heading;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 snprintf(text,32,"\001%03i`",heading);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 write_label_var( 0, 800, ME_Y_LINE1, &FontT54, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 tMenuEdit_refresh_field(StMXTRA_CompassHeading);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
341 void refresh_CO2Data(void)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
342 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
343 char text[32];
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
344
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
345 snprintf(text,32,"\001%c",TXT_CO2Sensor);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
346 write_topline(text);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
347
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
348 snprintf(text,32,"CO2: %d ppm",stateUsed->lifeData.CO2_data.CO2_ppm);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
349 write_label_var( 30, 800, ME_Y_LINE1, &FontT48, text);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
350
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
351 snprintf(text,32,"Signal: %d",stateUsed->lifeData.CO2_data.signalStrength);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
352 write_label_var( 30, 800, ME_Y_LINE2, &FontT48, text);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
353
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
354 tMenuEdit_refresh_field(StMXTRA_CO2_Sensor);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
355 tMenuEdit_refresh_field(StMXTRA_CO2_Sensor_Calib);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
356 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
357
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 void openEdit_CompassHeading(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 write_field_button(StMXTRA_CompassHeading,20, 800, ME_Y_LINE4, &FontT48, "Set");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 setEvent(StMXTRA_CompassHeading, (uint32_t)OnAction_CompassHeading);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 // startEdit();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 {
272
74a8296a2318 cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
370 stateUsedWrite->diveSettings.compassHeading = (uint16_t)stateUsed->lifeData.compass_heading;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 exitMenuEdit_to_Home_with_Menu_Update();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 return EXIT_TO_HOME;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373 }
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
374
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
375 static uint8_t OnAction_ScrubberTimer(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
376 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
377 SSettings *pSettings;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
378 uint8_t digitContentNew = EXIT_TO_MENU;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
379 uint32_t newScrubberTime;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
380
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
381 if(action == ACTION_BUTTON_ENTER)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
382 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
383 return digitContent;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
384 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
385 if(action == ACTION_BUTTON_ENTER_FINAL)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
386 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
387 evaluateNewString(editId, &newScrubberTime, 0, 0, 0);
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
388
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
389 if(newScrubberTime > MAX_SCRUBBER_TIME)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
390 newScrubberTime = MAX_SCRUBBER_TIME;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
391
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
392 pSettings = settingsGetPointer();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
393 pSettings->scrubTimerMax = newScrubberTime;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
394 if(pSettings->scrubTimerCur > newScrubberTime)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
395 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
396 pSettings->scrubTimerCur = newScrubberTime;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
397 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
398
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
399 tMenuEdit_newInput(editId, newScrubberTime, 0, 0, 0);
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
400 digitContentNew = UPDATE_AND_EXIT_TO_MENU;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
401 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
402 if(action == ACTION_BUTTON_NEXT)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
403 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
404 digitContentNew = digitContent + 1;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
405 if(digitContentNew > '9')
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
406 digitContentNew = '0';
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
407 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
408 if(action == ACTION_BUTTON_BACK)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
409 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
410 digitContentNew = digitContent - 1;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
411 if(digitContentNew < '0')
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
412 digitContentNew = '9';
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
413 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
414 return digitContentNew;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
415 }
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
416 #ifdef ENABLE_PSCR_MODE
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
417 static uint8_t OnAction_PSCRO2Drop(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
418 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
419 SSettings *pSettings;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
420 uint8_t digitContentNew = EXIT_TO_MENU;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
421 uint32_t newO2Drop;
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
422
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
423 if(action == ACTION_BUTTON_ENTER)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
424 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
425 return digitContent;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
426 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
427 if(action == ACTION_BUTTON_ENTER_FINAL)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
428 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
429 evaluateNewString(editId, &newO2Drop, 0, 0, 0);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
430
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
431 if(newO2Drop > PSCR_MAX_O2_DROP)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
432 newO2Drop = PSCR_MAX_O2_DROP;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
433
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
434 pSettings = settingsGetPointer();
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
435 pSettings->pscr_o2_drop = newO2Drop;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
436
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
437 tMenuEdit_newInput(editId, newO2Drop, 0, 0, 0);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
438 digitContentNew = UPDATE_AND_EXIT_TO_MENU;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
439 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
440 if(action == ACTION_BUTTON_NEXT)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
441 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
442 digitContentNew = digitContent + 1;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
443 if(digitContentNew > '9')
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
444 digitContentNew = '0';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
445 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
446 if(action == ACTION_BUTTON_BACK)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
447 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
448 digitContentNew = digitContent - 1;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
449 if(digitContentNew < '0')
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
450 digitContentNew = '9';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
451 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
452 return digitContentNew;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
453 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
454
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
455 static uint8_t OnAction_PSCRLungRation(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
456 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
457 SSettings *pSettings;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
458 uint8_t digitContentNew = EXIT_TO_MENU;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
459 uint32_t newLungRatio;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
460
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
461 if(action == ACTION_BUTTON_ENTER)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
462 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
463 return digitContent;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
464 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
465 if(action == ACTION_BUTTON_ENTER_FINAL)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
466 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
467 evaluateNewString(editId, &newLungRatio, 0, 0, 0);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
468
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
469 if(newLungRatio > PSCR_MAX_LUNG_RATIO)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
470 newLungRatio = PSCR_MAX_LUNG_RATIO;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
471
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
472 if(newLungRatio < PSCR_MIN_LUNG_RATIO)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
473 newLungRatio = PSCR_MIN_LUNG_RATIO;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
474
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
475 pSettings = settingsGetPointer();
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
476 pSettings->pscr_lung_ratio = newLungRatio;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
477
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
478 tMenuEdit_newInput(editId, newLungRatio, 0, 0, 0);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
479 digitContentNew = UPDATE_AND_EXIT_TO_MENU;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
480 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
481 if(action == ACTION_BUTTON_NEXT)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
482 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
483 digitContentNew = digitContent + 1;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
484 if(digitContentNew > '9')
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
485 digitContentNew = '0';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
486 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
487 if(action == ACTION_BUTTON_BACK)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
488 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
489 digitContentNew = digitContent - 1;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
490 if(digitContentNew < '0')
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
491 digitContentNew = '9';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
492 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
493 return digitContentNew;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
494 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
495 #endif
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
496
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
497 #ifdef ENABLE_CO2_SUPPORT
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
498 static uint8_t OnAction_CO2OnOff(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
499 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
500 SSettings *pSettings = settingsGetPointer();
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
501 if(pSettings->co2_sensor_active)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
502 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
503 pSettings->co2_sensor_active = 0;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
504 tMenuEdit_set_on_off(StMXTRA_CO2_Sensor,0);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
505 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
506 else
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
507 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
508 pSettings->co2_sensor_active = 1;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
509 tMenuEdit_set_on_off(StMXTRA_CO2_Sensor,1);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
510 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
511 return UPDATE_DIVESETTINGS;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
512 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
513
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
514 static uint8_t OnAction_CO2Calib(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
515 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
516 DataEX_setExtInterface_Cmd(EXT_INTERFACE_CO2_CALIB);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
517 return UPDATE_DIVESETTINGS;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
518 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
519 #endif