Mercurial > public > ostc4
annotate Discovery/Src/tMenuEditXtra.c @ 769:6b248bcdbf28
Deactivation of the 'fallback' option when the CCR mode is set to 'Fixed' - this makes it a little clearer that the option has no influence in this mode.
author | heinrichsweikamp |
---|---|
date | Fri, 21 Apr 2023 09:47:06 +0200 |
parents | b6d8a6fbf4fd |
children | 6169309d6eb9 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenuEditXtra.c | |
5 /// \brief Menu Edit Xtra - Specials in Divemode like Reset Stopwatch | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 02-Mar-2015 | |
8 /// | |
9 /// \details | |
10 /// | |
11 /// $Id$ | |
12 /////////////////////////////////////////////////////////////////////////////// | |
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
14 /// | |
15 /// This program is free software: you can redistribute it and/or modify | |
16 /// it under the terms of the GNU General Public License as published by | |
17 /// the Free Software Foundation, either version 3 of the License, or | |
18 /// (at your option) any later version. | |
19 /// | |
20 /// This program is distributed in the hope that it will be useful, | |
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 /// GNU General Public License for more details. | |
24 /// | |
25 /// You should have received a copy of the GNU General Public License | |
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
27 ////////////////////////////////////////////////////////////////////////////// | |
28 | |
29 /* Includes ------------------------------------------------------------------*/ | |
30 #include "tMenuEditXtra.h" | |
31 | |
32 #include "gfx_fonts.h" | |
33 #include "simulation.h" | |
34 #include "timer.h" | |
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 | 37 #include "motion.h" |
662 | 38 #include "configuration.h" |
347
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
39 |
38 | 40 |
41 /* Private function prototypes -----------------------------------------------*/ | |
42 void openEdit_CompassHeading(void); | |
43 void openEdit_ResetStopwatch(void); | |
44 void openEdit_SimFollowDecostops(void); | |
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); |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
48 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
49 static void openEdit_CCRModeSensorOrFixedSP(void); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
50 static void openEdit_Fallback(void); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
51 static void openEdit_Scrubber(void); |
662 | 52 #ifdef ENABLE_PSCR_MODE |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
53 static void openEdit_PSCR(void); |
662 | 54 #endif |
55 #ifdef ENABLE_CO2_SUPPORT | |
56 static void openEdit_CO2Sensor(void); | |
57 #endif | |
38 | 58 |
59 /* Announced function prototypes -----------------------------------------------*/ | |
60 uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
710 | 61 uint8_t OnAction_ScrubberTimerId(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
62 static uint8_t OnAction_ScrubberTimerMax(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
63 static uint8_t OnAction_ScrubberReset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
64 static uint8_t OnAction_ScrubberMode(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
662 | 65 #ifdef ENABLE_PSCR_MODE |
66 static uint8_t OnAction_PSCRO2Drop(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
67 static uint8_t OnAction_PSCRLungRation(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
68 #endif | |
69 | |
70 #ifdef ENABLE_CO2_SUPPORT | |
71 static uint8_t OnAction_CO2OnOff(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
72 static uint8_t OnAction_CO2Calib(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
73 #endif | |
38 | 74 |
75 /* Exported functions --------------------------------------------------------*/ | |
76 | |
710 | 77 |
38 | 78 void openEdit_Xtra(uint8_t line) |
79 { | |
80 set_globalState_Menu_Line(line); | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
81 |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
82 /* DIVE MODE */ |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
83 if(actual_menu_content != MENU_SURFACE) |
38 | 84 { |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
85 resetMenuEdit(CLUT_MenuPageXtra); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
86 |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
87 switch(line) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
88 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
89 case 1: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
90 default: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
91 openEdit_ResetStopwatch(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
92 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
93 case 2: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
94 openEdit_CompassHeading(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
95 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
96 case 3: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
97 openEdit_SetManualMarker(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
98 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
99 case 4: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
100 openEdit_CalibViewport(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
101 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
102 case 5: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
103 if(is_stateUsedSetToSim()) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
104 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
105 openEdit_SimFollowDecostops(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
106 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
107 else |
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 openEdit_SetEndDive(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
110 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
111 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
112 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
113 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
114 else /* surface mode */ |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
115 { |
769
6b248bcdbf28
Deactivation of the 'fallback' option when the CCR mode is set to 'Fixed' - this makes it a little clearer that the option has no influence in this mode.
heinrichsweikamp
parents:
758
diff
changeset
|
116 if((settingsGetPointer()->dive_mode != DIVEMODE_PSCR) && (line > 3)) /* PSCR items are only optional */ |
662 | 117 { |
118 line = 6; | |
119 } | |
120 | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
121 switch(line) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
122 { |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
123 case 1: openEdit_CCRModeSensorOrFixedSP(); |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
124 break; |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
125 case 2: openEdit_Fallback(); |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
126 break; |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
127 case 3: openEdit_Scrubber(); |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
128 break; |
662 | 129 #ifdef ENABLE_PSCR_MODE |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
130 case 4: openEdit_PSCR(); |
662 | 131 break; |
132 #endif | |
133 #ifdef ENABLE_CO2_SUPPORT | |
134 case 6: openEdit_CO2Sensor(); | |
135 break; | |
136 #endif | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
137 default: |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
138 break; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
139 } |
38 | 140 } |
141 } | |
142 | |
143 /* Private functions ---------------------------------------------------------*/ | |
144 void openEdit_ResetStopwatch(void) | |
145 { | |
146 timer_Stopwatch_Restart(); | |
147 exitMenuEdit_to_Home(); | |
148 } | |
149 | |
150 void openEdit_SetManualMarker(void) | |
151 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
272
diff
changeset
|
152 stateUsedWrite->events.manualMarker = 1; |
38 | 153 exitMenuEdit_to_Home(); |
154 } | |
155 | |
347
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
156 void openEdit_SetEndDive(void) |
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 dataOutGetPointer()->setEndDive = 1; |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
159 exitMenuEdit_to_Home(); |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
160 } |
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
161 |
38 | 162 void openEdit_SimFollowDecostops(void) |
163 { | |
164 simulation_set_heed_decostops(!simulation_get_heed_decostops()); | |
165 exitMenuEdit_to_Menu_with_Menu_Update(); | |
166 } | |
167 | |
547 | 168 void openEdit_CalibViewport(void) |
169 { | |
170 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
|
171 suspendMotionDetection(0); /* exit to focus mode directly */ |
547 | 172 exitMenuEdit_to_Home(); |
173 } | |
174 | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
175 |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
176 static void openEdit_CCRModeSensorOrFixedSP(void) |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
177 { |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
178 SSettings *pSettings = settingsGetPointer(); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
179 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
180 if(pSettings->CCR_Mode == CCRMODE_Sensors) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
181 pSettings->CCR_Mode = CCRMODE_FixedSetpoint; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
182 else |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
183 pSettings->CCR_Mode = CCRMODE_Sensors; |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
184 |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
185 exitEditWithUpdate(); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
186 } |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
187 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
188 static void openEdit_Fallback(void) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
189 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
190 /* does not work like this resetEnterPressedToStateBeforeButtonAction(); */ |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
191 |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
192 SSettings *pSettings = settingsGetPointer(); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
193 |
769
6b248bcdbf28
Deactivation of the 'fallback' option when the CCR mode is set to 'Fixed' - this makes it a little clearer that the option has no influence in this mode.
heinrichsweikamp
parents:
758
diff
changeset
|
194 if (pSettings->CCR_Mode == CCRMODE_Sensors) { |
6b248bcdbf28
Deactivation of the 'fallback' option when the CCR mode is set to 'Fixed' - this makes it a little clearer that the option has no influence in this mode.
heinrichsweikamp
parents:
758
diff
changeset
|
195 pSettings->fallbackToFixedSetpoint = (pSettings->fallbackToFixedSetpoint + 1) % 2; |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
196 } |
769
6b248bcdbf28
Deactivation of the 'fallback' option when the CCR mode is set to 'Fixed' - this makes it a little clearer that the option has no influence in this mode.
heinrichsweikamp
parents:
758
diff
changeset
|
197 |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
198 exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only(); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
199 } |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
200 |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
201 |
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
202 static void printScrubberResetText(char *text, SSettings *settings) |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
203 { |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
204 int16_t currentTimerMinutes = settings->scrubberData[settings->scubberActiveId].TimerCur; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
205 char colour = '\020'; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
206 if (currentTimerMinutes <= 0) { |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
207 colour = '\025'; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
208 } else if (currentTimerMinutes <= 30) { |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
209 colour = '\024'; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
210 } |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
211 snprintf(text, 32, "%c\002%c%03i\016\016 %c\017", TXT_ScrubTimeReset, colour, currentTimerMinutes, TXT_Minutes); |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
212 } |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
213 |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
214 |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
215 static void openEdit_Scrubber(void) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
216 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
217 char text[32]; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
218 uint8_t textIndex = 0; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
219 uint16_t localScrubTimer; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
220 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
221 SSettings *pSettings = settingsGetPointer(); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
222 |
710 | 223 localScrubTimer = pSettings->scrubberData[pSettings->scubberActiveId].TimerMax; |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
224 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
225 resetMenuEdit(CLUT_MenuPageXtra); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
226 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
227 |
710 | 228 snprintf(&text[0], 32,"\001%c",TXT_ScrubTime); |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
229 write_topline(text); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
230 |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
231 |
710 | 232 snprintf(&text[0], 32,"%c \002#%d",TXT_ScrubTime,pSettings->scubberActiveId); |
233 write_field_button(StMXTRA_ScrubTimer, 20, 780, ME_Y_LINE1, &FontT48, text); | |
234 | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
235 snprintf(&text[textIndex], 32,\ |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
236 "%c" |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
237 "\016\016(%c)\017" |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
238 ,TXT_ScrubTime |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
239 ,TXT_Maximum); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
240 |
710 | 241 write_label_var( 20, 340, ME_Y_LINE2, &FontT48, text); |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
242 snprintf(&text[textIndex], 32, "\002###\016\016 %c\017",TXT_Minutes); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
243 |
710 | 244 write_field_udigit(StMXTRA_ScrubTimer_Max, 610, 780, ME_Y_LINE2, &FontT48, text,localScrubTimer, 0, 0, 0); |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
245 |
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
246 printScrubberResetText(text, pSettings); |
710 | 247 write_field_button(StMXTRA_ScrubTimer_Reset, 20, 780, ME_Y_LINE3, &FontT48, text); |
248 | |
249 if(pSettings->scrubberData[pSettings->scubberActiveId].lastDive.WeekDay != 0) | |
250 { | |
251 snprintf(&text[0], 32,"%c%c\002 %02d.%02d.%02d", TXT_2BYTE, TXT2BYTE_SimDiveTime, pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Date, | |
252 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Month, | |
253 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Year); | |
254 } | |
255 else | |
256 { | |
257 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime); | |
258 } | |
259 write_label_var( 20, 780, ME_Y_LINE4, &FontT48, text); | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
260 |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
261 switch(pSettings->scrubTimerMode) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
262 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
263 case SCRUB_TIMER_OFF: |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
264 default: snprintf(&text[0], 32,"%c\002%c%c",TXT_ScrubTimeMode, TXT_2BYTE, TXT2BYTE_MoCtrlNone ); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
265 break; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
266 case SCRUB_TIMER_MINUTES: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Minutes ); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
267 break; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
268 case SCRUB_TIMER_PERCENT: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Percent ); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
269 break; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
270 } |
710 | 271 write_field_button(StMXTRA_ScrubTimer_OP_Mode, 20, 780, ME_Y_LINE5, &FontT48, text); |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
272 |
710 | 273 setEvent(StMXTRA_ScrubTimer, (uint32_t)OnAction_ScrubberTimerId); |
274 setEvent(StMXTRA_ScrubTimer_Max, (uint32_t)OnAction_ScrubberTimerMax); | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
275 setEvent(StMXTRA_ScrubTimer_Reset, (uint32_t)OnAction_ScrubberReset); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
276 setEvent(StMXTRA_ScrubTimer_OP_Mode, (uint32_t)OnAction_ScrubberMode); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
277 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
278 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
279 |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
280 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
281 |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
282 static void openEdit_PSCR(void) |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
283 { |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
284 uint8_t localO2Drop,localLungRatio; |
662 | 285 char text[32]; |
286 SSettings *pSettings = settingsGetPointer(); | |
287 localO2Drop = pSettings->pscr_o2_drop; | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
288 localLungRatio = pSettings->pscr_lung_ratio; |
662 | 289 |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
290 resetMenuEdit(CLUT_MenuPageXtra); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
291 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
292 snprintf(text, 32, "\001%c",TXT_PSClosedCircuit); |
662 | 293 write_topline(text); |
294 | |
295 text[0] = '\002'; | |
296 text[1] = '\016'; | |
297 text[2] = '\016'; | |
298 text[3] = '%'; | |
299 text[4] = 0; | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
300 write_label_fix( 20, 800, ME_Y_LINE1, &FontT48, TXT_PSCRO2Drop); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
301 write_label_var( 435, 780, ME_Y_LINE1, &FontT48, text); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
302 write_field_udigit(StMXTRA_PSCR_O2_Drop, 710, 779, ME_Y_LINE1, &FontT48, "##", (uint32_t)localO2Drop, 0, 0, 0); |
662 | 303 |
304 | |
305 text[0] = '\002'; | |
306 text[1] = '1'; | |
307 text[2] = '/'; | |
308 text[3] = 0; | |
309 | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
310 write_label_fix( 20, 800, ME_Y_LINE2, &FontT48, TXT_PSCRLungRatio); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
311 write_label_var( 435, 710, ME_Y_LINE2, &FontT48, text); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
312 write_field_udigit(StMXTRA_PSCR_LUNG_RATIO, 710, 779, ME_Y_LINE2, &FontT48, "##", (uint32_t)localLungRatio, 0, 0, 0); |
662 | 313 |
712 | 314 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
662 | 315 |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
316 setEvent(StMXTRA_PSCR_O2_Drop, (uint32_t)OnAction_PSCRO2Drop); |
662 | 317 setEvent(StMXTRA_PSCR_LUNG_RATIO, (uint32_t)OnAction_PSCRLungRation); |
318 } | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
319 |
662 | 320 |
321 #ifdef ENABLE_CO2_SUPPORT | |
322 static void openEdit_CO2Sensor() | |
323 { | |
324 char text[32]; | |
725 | 325 |
326 resetMenuEdit(CLUT_MenuPageXtra); | |
327 | |
662 | 328 snprintf(text,32,"\001%c",TXT_CO2Sensor); |
329 write_topline(text); | |
330 | |
331 refresh_CO2Data(); | |
332 if(settingsGetPointer()->co2_sensor_active) | |
333 { | |
334 text[0] = '\005'; | |
335 } | |
336 else | |
337 { | |
338 text[0] = '\006'; | |
339 } | |
340 text[0] = TXT_CO2Sensor; | |
341 text[1] = 0; | |
342 | |
343 write_field_on_off(StMXTRA_CO2_Sensor, 30, 95, ME_Y_LINE3, &FontT48, text, settingsGetPointer()->co2_sensor_active); | |
344 | |
345 text[0] = TXT_2BYTE; | |
346 text[1] = TXT2BYTE_O2Calib; | |
347 text[2] = 0; | |
348 write_field_button(StMXTRA_CO2_Sensor_Calib,30, 800, ME_Y_LINE4, &FontT48, text); | |
349 | |
350 setEvent(StMXTRA_CO2_Sensor, (uint32_t)OnAction_CO2OnOff); | |
351 setEvent(StMXTRA_CO2_Sensor_Calib, (uint32_t)OnAction_CO2Calib); | |
352 | |
353 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
354 } | |
355 #endif | |
356 | |
38 | 357 void refresh_CompassHeading(void) |
358 { | |
359 uint16_t heading; | |
360 char text[32]; | |
361 | |
362 text[0] = '\001'; | |
363 text[1] = TXT_2BYTE; | |
364 text[2] = TXT2BYTE_CompassHeading; | |
365 text[3] = 0; | |
366 write_topline(text); | |
367 | |
368 heading = (uint16_t)stateUsed->lifeData.compass_heading; | |
369 snprintf(text,32,"\001%03i`",heading); | |
370 write_label_var( 0, 800, ME_Y_LINE1, &FontT54, text); | |
371 | |
372 tMenuEdit_refresh_field(StMXTRA_CompassHeading); | |
373 } | |
374 | |
662 | 375 void refresh_CO2Data(void) |
376 { | |
377 char text[32]; | |
378 | |
379 snprintf(text,32,"\001%c",TXT_CO2Sensor); | |
380 write_topline(text); | |
381 | |
748 | 382 snprintf(text,32,"CO2: %ld ppm",stateUsed->lifeData.CO2_data.CO2_ppm); |
662 | 383 write_label_var( 30, 800, ME_Y_LINE1, &FontT48, text); |
384 | |
385 snprintf(text,32,"Signal: %d",stateUsed->lifeData.CO2_data.signalStrength); | |
386 write_label_var( 30, 800, ME_Y_LINE2, &FontT48, text); | |
387 | |
388 tMenuEdit_refresh_field(StMXTRA_CO2_Sensor); | |
389 tMenuEdit_refresh_field(StMXTRA_CO2_Sensor_Calib); | |
390 } | |
391 | |
38 | 392 void openEdit_CompassHeading(void) |
393 { | |
394 write_field_button(StMXTRA_CompassHeading,20, 800, ME_Y_LINE4, &FontT48, "Set"); | |
395 setEvent(StMXTRA_CompassHeading, (uint32_t)OnAction_CompassHeading); | |
396 } | |
397 | |
398 | |
399 uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
400 { | |
272
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
401 stateUsedWrite->diveSettings.compassHeading = (uint16_t)stateUsed->lifeData.compass_heading; |
38 | 402 exitMenuEdit_to_Home_with_Menu_Update(); |
403 return EXIT_TO_HOME; | |
404 } | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
405 |
710 | 406 |
407 uint8_t OnAction_ScrubberTimerId(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
408 { | |
409 char text[32]; | |
410 SSettings *pSettings; | |
411 pSettings = settingsGetPointer(); | |
412 | |
413 if(pSettings->scubberActiveId == 0) | |
414 { | |
415 pSettings->scubberActiveId = 1; | |
416 } | |
417 else | |
418 { | |
419 pSettings->scubberActiveId = 0; | |
420 } | |
421 | |
422 | |
423 snprintf(&text[0], 32,"%c \002#%d",TXT_ScrubTime,pSettings->scubberActiveId); | |
424 tMenuEdit_newButtonText(StMXTRA_ScrubTimer, text); | |
425 | |
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
426 printScrubberResetText(text, pSettings); |
710 | 427 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_Reset, text); |
428 | |
429 tMenuEdit_newInput(StMXTRA_ScrubTimer_Max, pSettings->scrubberData[pSettings->scubberActiveId].TimerMax, 0, 0, 0); | |
430 | |
431 if(pSettings->scrubberData[pSettings->scubberActiveId].lastDive.WeekDay != 0) | |
432 { | |
433 snprintf(&text[0], 32,"%c%c\002 %02d.%02d.%02d", TXT_2BYTE, TXT2BYTE_SimDiveTime, pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Date, | |
434 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Month, | |
435 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Year); | |
436 } | |
437 else | |
438 { | |
439 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime); | |
440 } | |
441 clean_content( 20, 780, ME_Y_LINE4, &FontT48); | |
442 write_label_var( 20, 780, ME_Y_LINE4, &FontT48, text); | |
443 | |
444 return UNSPECIFIC_RETURN; | |
445 } | |
446 | |
447 static uint8_t OnAction_ScrubberTimerMax(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
|
448 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
449 SSettings *pSettings; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
450 uint8_t digitContentNew = EXIT_TO_MENU; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
451 uint32_t newScrubberTime; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
452 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
453 if(action == ACTION_BUTTON_ENTER) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
454 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
455 return digitContent; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
456 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
457 if(action == ACTION_BUTTON_ENTER_FINAL) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
458 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
459 evaluateNewString(editId, &newScrubberTime, 0, 0, 0); |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
460 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
461 if(newScrubberTime > MAX_SCRUBBER_TIME) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
462 newScrubberTime = MAX_SCRUBBER_TIME; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
463 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
464 pSettings = settingsGetPointer(); |
710 | 465 pSettings->scrubberData[pSettings->scubberActiveId].TimerMax = newScrubberTime; |
466 if(pSettings->scrubberData[pSettings->scubberActiveId].TimerCur > newScrubberTime) | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
467 { |
710 | 468 pSettings->scrubberData[pSettings->scubberActiveId].TimerCur = newScrubberTime; |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
469 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
470 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
471 tMenuEdit_newInput(editId, newScrubberTime, 0, 0, 0); |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
472 digitContentNew = UNSPECIFIC_RETURN; |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
473 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
474 if(action == ACTION_BUTTON_NEXT) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
475 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
476 digitContentNew = digitContent + 1; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
477 if(digitContentNew > '9') |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
478 digitContentNew = '0'; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
479 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
480 if(action == ACTION_BUTTON_BACK) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
481 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
482 digitContentNew = digitContent - 1; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
483 if(digitContentNew < '0') |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
484 digitContentNew = '9'; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
485 } |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
486 return digitContentNew; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
487 } |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
488 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
489 uint8_t OnAction_ScrubberReset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
490 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
491 char text[32]; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
492 SSettings *pSettings; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
493 pSettings = settingsGetPointer(); |
710 | 494 pSettings->scrubberData[pSettings->scubberActiveId].TimerCur = pSettings->scrubberData[pSettings->scubberActiveId].TimerMax; |
495 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.WeekDay = 0; /* invalidate date */ | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
496 |
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
497 printScrubberResetText(text, pSettings); |
710 | 498 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_Reset, text); |
499 | |
500 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime); | |
501 clean_content( 20, 780, ME_Y_LINE4, &FontT48); | |
502 write_label_var( 20, 780, ME_Y_LINE4, &FontT48, text); | |
503 | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
504 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
505 return UNSPECIFIC_RETURN; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
506 } |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
507 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
508 uint8_t OnAction_ScrubberMode(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
509 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
510 char text[32]; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
511 uint8_t newMode; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
512 SSettings *pSettings; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
513 pSettings = settingsGetPointer(); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
514 newMode = pSettings->scrubTimerMode + 1; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
515 if(newMode >= SCRUB_TIMER_END) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
516 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
517 newMode = SCRUB_TIMER_OFF; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
518 } |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
519 pSettings->scrubTimerMode = newMode; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
520 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
521 switch(pSettings->scrubTimerMode) |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
522 { |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
523 case SCRUB_TIMER_OFF: |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
524 default: snprintf(&text[0], 32,"%c\002%c%c",TXT_ScrubTimeMode, TXT_2BYTE, TXT2BYTE_MoCtrlNone ); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
525 break; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
526 case SCRUB_TIMER_MINUTES: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Minutes ); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
527 break; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
528 case SCRUB_TIMER_PERCENT: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Percent ); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
529 break; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
530 } |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
531 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_OP_Mode, text); |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
532 |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
533 return UNSPECIFIC_RETURN; |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
534 } |
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
535 |
662 | 536 #ifdef ENABLE_PSCR_MODE |
537 static uint8_t OnAction_PSCRO2Drop(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
538 { | |
539 SSettings *pSettings; | |
540 uint8_t digitContentNew = EXIT_TO_MENU; | |
541 uint32_t newO2Drop; | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
542 |
662 | 543 if(action == ACTION_BUTTON_ENTER) |
544 { | |
545 return digitContent; | |
546 } | |
547 if(action == ACTION_BUTTON_ENTER_FINAL) | |
548 { | |
549 evaluateNewString(editId, &newO2Drop, 0, 0, 0); | |
550 | |
551 if(newO2Drop > PSCR_MAX_O2_DROP) | |
552 newO2Drop = PSCR_MAX_O2_DROP; | |
553 | |
554 pSettings = settingsGetPointer(); | |
555 pSettings->pscr_o2_drop = newO2Drop; | |
556 | |
557 tMenuEdit_newInput(editId, newO2Drop, 0, 0, 0); | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
558 digitContentNew = UNSPECIFIC_RETURN; |
662 | 559 } |
560 if(action == ACTION_BUTTON_NEXT) | |
561 { | |
562 digitContentNew = digitContent + 1; | |
563 if(digitContentNew > '9') | |
564 digitContentNew = '0'; | |
565 } | |
566 if(action == ACTION_BUTTON_BACK) | |
567 { | |
568 digitContentNew = digitContent - 1; | |
569 if(digitContentNew < '0') | |
570 digitContentNew = '9'; | |
571 } | |
572 return digitContentNew; | |
573 } | |
574 | |
575 static uint8_t OnAction_PSCRLungRation(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
576 { | |
577 SSettings *pSettings; | |
578 uint8_t digitContentNew = EXIT_TO_MENU; | |
579 uint32_t newLungRatio; | |
580 | |
581 if(action == ACTION_BUTTON_ENTER) | |
582 { | |
583 return digitContent; | |
584 } | |
585 if(action == ACTION_BUTTON_ENTER_FINAL) | |
586 { | |
587 evaluateNewString(editId, &newLungRatio, 0, 0, 0); | |
588 | |
589 if(newLungRatio > PSCR_MAX_LUNG_RATIO) | |
590 newLungRatio = PSCR_MAX_LUNG_RATIO; | |
591 | |
592 if(newLungRatio < PSCR_MIN_LUNG_RATIO) | |
593 newLungRatio = PSCR_MIN_LUNG_RATIO; | |
594 | |
595 pSettings = settingsGetPointer(); | |
596 pSettings->pscr_lung_ratio = newLungRatio; | |
597 | |
598 tMenuEdit_newInput(editId, newLungRatio, 0, 0, 0); | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
599 digitContentNew = UNSPECIFIC_RETURN; |
662 | 600 } |
601 if(action == ACTION_BUTTON_NEXT) | |
602 { | |
603 digitContentNew = digitContent + 1; | |
604 if(digitContentNew > '9') | |
605 digitContentNew = '0'; | |
606 } | |
607 if(action == ACTION_BUTTON_BACK) | |
608 { | |
609 digitContentNew = digitContent - 1; | |
610 if(digitContentNew < '0') | |
611 digitContentNew = '9'; | |
612 } | |
613 return digitContentNew; | |
614 } | |
615 #endif | |
616 | |
617 #ifdef ENABLE_CO2_SUPPORT | |
618 static uint8_t OnAction_CO2OnOff(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
619 { | |
620 SSettings *pSettings = settingsGetPointer(); | |
621 if(pSettings->co2_sensor_active) | |
622 { | |
623 pSettings->co2_sensor_active = 0; | |
624 tMenuEdit_set_on_off(StMXTRA_CO2_Sensor,0); | |
625 } | |
626 else | |
627 { | |
628 pSettings->co2_sensor_active = 1; | |
629 tMenuEdit_set_on_off(StMXTRA_CO2_Sensor,1); | |
630 } | |
631 return UPDATE_DIVESETTINGS; | |
632 } | |
633 | |
634 static uint8_t OnAction_CO2Calib(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
635 { | |
636 DataEX_setExtInterface_Cmd(EXT_INTERFACE_CO2_CALIB); | |
637 return UPDATE_DIVESETTINGS; | |
638 } | |
639 #endif |