annotate Discovery/Src/tMenuEditXtra.c @ 823:d02a7e264d72 Evo_2_23

Starting 'Evo_2_23' branch
author Ideenmodellierer
date Mon, 09 Oct 2023 15:10:10 +0200
parents c4ee952b9425
children ffb1036c27c2
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 ------------------------------------------------------------------*/
774
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
30 #include <stdbool.h>
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
31
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include "tMenuEditXtra.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 #include "gfx_fonts.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 #include "simulation.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 #include "timer.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 #include "tMenuEdit.h"
347
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
38 #include "data_exchange_main.h"
547
12f8745c8a94 Added viewport calibration to dive menu:
Ideenmodellierer
parents: 347
diff changeset
39 #include "motion.h"
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
40 #include "configuration.h"
347
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
41
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 void openEdit_CompassHeading(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 void openEdit_ResetStopwatch(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 void openEdit_SimFollowDecostops(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 void openEdit_SetManualMarker(void);
347
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
48 void openEdit_SetEndDive(void);
552
531e7818b737 Added menu structure to acces viewport calibration:
Ideenmodellierer
parents: 547
diff changeset
49 void openEdit_CalibViewport(void);
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
50
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
51 static void openEdit_CCRModeSensorOrFixedSP(void);
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
52 static void openEdit_Fallback(void);
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
53 static void openEdit_Scrubber(void);
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
54 #ifdef ENABLE_PSCR_MODE
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
55 static void openEdit_PSCR(void);
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
56 #endif
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
57 #ifdef ENABLE_CO2_SUPPORT
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
58 static void openEdit_CO2Sensor(void);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
59 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 /* Announced function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
710
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
63 uint8_t OnAction_ScrubberTimerId(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
64 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
65 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
66 static uint8_t OnAction_ScrubberMode(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
67 #ifdef ENABLE_PSCR_MODE
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
68 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
69 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
70 #endif
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
71
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
72 #ifdef ENABLE_CO2_SUPPORT
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
73 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
74 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
75 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78
710
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
79
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 void openEdit_Xtra(uint8_t line)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 set_globalState_Menu_Line(line);
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
83
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
84 /* DIVE MODE */
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
85 if(actual_menu_content != MENU_SURFACE)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 {
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
87 resetMenuEdit(CLUT_MenuPageXtra);
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
88
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
89 switch(line)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
90 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
91 case 1:
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
92 default:
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
93 openEdit_ResetStopwatch();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
94 break;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
95 case 2:
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
96 openEdit_CompassHeading();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
97 break;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
98 case 3:
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
99 openEdit_SetManualMarker();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
100 break;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
101 case 4:
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
102 openEdit_CalibViewport();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
103 break;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
104 case 5:
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
105 if(is_stateUsedSetToSim())
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 openEdit_SimFollowDecostops();
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
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 openEdit_SetEndDive();
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 break;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
114 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
115 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
116 else /* surface mode */
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
117 {
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
118 if((settingsGetPointer()->dive_mode != DIVEMODE_PSCR) && (line > 3)) /* PSCR items are only optional */
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
119 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
120 line = 6;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
121 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
122
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
123 switch(line)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
124 {
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
125 case 1: openEdit_CCRModeSensorOrFixedSP();
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 2: openEdit_Fallback();
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
128 break;
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
129 case 3: openEdit_Scrubber();
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
130 break;
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
131 #ifdef ENABLE_PSCR_MODE
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
132 case 4: openEdit_PSCR();
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
133 break;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
134 #endif
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
135 #ifdef ENABLE_CO2_SUPPORT
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
136 case 6: openEdit_CO2Sensor();
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
137 break;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
138 #endif
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
139 default:
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
140 break;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
141 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 void openEdit_ResetStopwatch(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 timer_Stopwatch_Restart();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 exitMenuEdit_to_Home();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 void openEdit_SetManualMarker(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 {
288
ba229a012ac7 cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents: 272
diff changeset
154 stateUsedWrite->events.manualMarker = 1;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 exitMenuEdit_to_Home();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157
347
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
158 void openEdit_SetEndDive(void)
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
159 {
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
160 dataOutGetPointer()->setEndDive = 1;
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
161 exitMenuEdit_to_Home();
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
162 }
77de014928d6 Added option to manually leave dive mode to system menu
ideenmodellierer
parents: 288
diff changeset
163
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 void openEdit_SimFollowDecostops(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 simulation_set_heed_decostops(!simulation_get_heed_decostops());
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 exitMenuEdit_to_Menu_with_Menu_Update();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169
547
12f8745c8a94 Added viewport calibration to dive menu:
Ideenmodellierer
parents: 347
diff changeset
170 void openEdit_CalibViewport(void)
12f8745c8a94 Added viewport calibration to dive menu:
Ideenmodellierer
parents: 347
diff changeset
171 {
12f8745c8a94 Added viewport calibration to dive menu:
Ideenmodellierer
parents: 347
diff changeset
172 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
173 suspendMotionDetection(0); /* exit to focus mode directly */
547
12f8745c8a94 Added viewport calibration to dive menu:
Ideenmodellierer
parents: 347
diff changeset
174 exitMenuEdit_to_Home();
12f8745c8a94 Added viewport calibration to dive menu:
Ideenmodellierer
parents: 347
diff changeset
175 }
12f8745c8a94 Added viewport calibration to dive menu:
Ideenmodellierer
parents: 347
diff changeset
176
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 static void openEdit_CCRModeSensorOrFixedSP(void)
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
179 {
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
180 SSettings *pSettings = settingsGetPointer();
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
181
816
c4ee952b9425 Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
heinrichsweikamp
parents: 811
diff changeset
182 if(pSettings->CCR_Mode == CCRMODE_Sensors) {
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
183 pSettings->CCR_Mode = CCRMODE_FixedSetpoint;
816
c4ee952b9425 Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
heinrichsweikamp
parents: 811
diff changeset
184 } else {
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
185 pSettings->CCR_Mode = CCRMODE_Sensors;
811
4c41d9a18c7f Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents: 793
diff changeset
186 }
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
187
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
188 exitEditWithUpdate();
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
189 }
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
190
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
191 static void openEdit_Fallback(void)
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
192 {
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
193 /* does not work like this resetEnterPressedToStateBeforeButtonAction(); */
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
194
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
195 SSettings *pSettings = settingsGetPointer();
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
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 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
198 pSettings->fallbackToFixedSetpoint = (pSettings->fallbackToFixedSetpoint + 1) % 2;
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
199 }
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
200
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
201 exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only();
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
202 }
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
203
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
204
758
b6d8a6fbf4fd - Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents: 748
diff changeset
205 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
206 {
b6d8a6fbf4fd - Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents: 748
diff changeset
207 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
208 char colour = '\020';
b6d8a6fbf4fd - Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents: 748
diff changeset
209 if (currentTimerMinutes <= 0) {
b6d8a6fbf4fd - Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents: 748
diff changeset
210 colour = '\025';
b6d8a6fbf4fd - Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents: 748
diff changeset
211 } else if (currentTimerMinutes <= 30) {
b6d8a6fbf4fd - Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents: 748
diff changeset
212 colour = '\024';
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 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
215 }
b6d8a6fbf4fd - Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents: 748
diff changeset
216
b6d8a6fbf4fd - Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents: 748
diff changeset
217
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
218 static void openEdit_Scrubber(void)
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
219 {
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
220 char text[32];
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
221 uint8_t textIndex = 0;
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
222 uint16_t localScrubTimer;
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
223
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
224 SSettings *pSettings = settingsGetPointer();
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
225
710
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
226 localScrubTimer = pSettings->scrubberData[pSettings->scubberActiveId].TimerMax;
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
227
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
228 resetMenuEdit(CLUT_MenuPageXtra);
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
229
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
230
710
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
231 snprintf(&text[0], 32,"\001%c",TXT_ScrubTime);
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
232 write_topline(text);
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
233
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
234
710
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
235 snprintf(&text[0], 32,"%c \002#%d",TXT_ScrubTime,pSettings->scubberActiveId);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
236 write_field_button(StMXTRA_ScrubTimer, 20, 780, ME_Y_LINE1, &FontT48, text);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
237
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
238 snprintf(&text[textIndex], 32,\
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
239 "%c"
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
240 "\016\016(%c)\017"
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
241 ,TXT_ScrubTime
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
242 ,TXT_Maximum);
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
243
710
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
244 write_label_var( 20, 340, ME_Y_LINE2, &FontT48, text);
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
245 snprintf(&text[textIndex], 32, "\002###\016\016 %c\017",TXT_Minutes);
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
246
710
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
247 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
248
758
b6d8a6fbf4fd - Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents: 748
diff changeset
249 printScrubberResetText(text, pSettings);
710
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
250 write_field_button(StMXTRA_ScrubTimer_Reset, 20, 780, ME_Y_LINE3, &FontT48, text);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
251
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
252 if(pSettings->scrubberData[pSettings->scubberActiveId].lastDive.WeekDay != 0)
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
253 {
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
254 snprintf(&text[0], 32,"%c%c\002 %02d.%02d.%02d", TXT_2BYTE, TXT2BYTE_SimDiveTime, pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Date,
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
255 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Month,
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
256 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Year);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
257 }
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
258 else
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
259 {
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
260 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
261 }
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
262 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
263
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
264 switch(pSettings->scrubTimerMode)
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
265 {
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
266 case SCRUB_TIMER_OFF:
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
267 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
268 break;
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
269 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
270 break;
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
271 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
272 break;
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
273 }
710
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
274 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
275
710
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
276 setEvent(StMXTRA_ScrubTimer, (uint32_t)OnAction_ScrubberTimerId);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
277 setEvent(StMXTRA_ScrubTimer_Max, (uint32_t)OnAction_ScrubberTimerMax);
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
278 setEvent(StMXTRA_ScrubTimer_Reset, (uint32_t)OnAction_ScrubberReset);
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
279 setEvent(StMXTRA_ScrubTimer_OP_Mode, (uint32_t)OnAction_ScrubberMode);
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
280
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
281 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
282
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
283 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
284
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
285 static void openEdit_PSCR(void)
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
286 {
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
287 uint8_t localO2Drop,localLungRatio;
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
288 char text[32];
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
289 SSettings *pSettings = settingsGetPointer();
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
290 localO2Drop = pSettings->pscr_o2_drop;
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
291 localLungRatio = pSettings->pscr_lung_ratio;
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
292
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
293 resetMenuEdit(CLUT_MenuPageXtra);
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
294
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
295 snprintf(text, 32, "\001%c",TXT_PSClosedCircuit);
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
296 write_topline(text);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
297
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
298 text[0] = '\002';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
299 text[1] = '\016';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
300 text[2] = '\016';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
301 text[3] = '%';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
302 text[4] = 0;
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
303 write_label_fix( 20, 800, ME_Y_LINE1, &FontT48, TXT_PSCRO2Drop);
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
304 write_label_var( 435, 780, ME_Y_LINE1, &FontT48, text);
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
305 write_field_udigit(StMXTRA_PSCR_O2_Drop, 710, 779, ME_Y_LINE1, &FontT48, "##", (uint32_t)localO2Drop, 0, 0, 0);
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
306
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
307
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
308 text[0] = '\002';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
309 text[1] = '1';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
310 text[2] = '/';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
311 text[3] = 0;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
312
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
313 write_label_fix( 20, 800, ME_Y_LINE2, &FontT48, TXT_PSCRLungRatio);
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
314 write_label_var( 435, 710, ME_Y_LINE2, &FontT48, text);
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
315 write_field_udigit(StMXTRA_PSCR_LUNG_RATIO, 710, 779, ME_Y_LINE2, &FontT48, "##", (uint32_t)localLungRatio, 0, 0, 0);
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
316
712
062deb659531 Bugfix PSCR menu button label:
Ideenmodellierer
parents: 710
diff changeset
317 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
318
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
319 setEvent(StMXTRA_PSCR_O2_Drop, (uint32_t)OnAction_PSCRO2Drop);
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
320 setEvent(StMXTRA_PSCR_LUNG_RATIO, (uint32_t)OnAction_PSCRLungRation);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
321 }
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
322
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
323
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
324 #ifdef ENABLE_CO2_SUPPORT
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
325 static void openEdit_CO2Sensor()
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
326 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
327 char text[32];
725
621265ec3d23 Update CO2 sensor implementation:
Ideenmodellierer
parents: 712
diff changeset
328
621265ec3d23 Update CO2 sensor implementation:
Ideenmodellierer
parents: 712
diff changeset
329 resetMenuEdit(CLUT_MenuPageXtra);
621265ec3d23 Update CO2 sensor implementation:
Ideenmodellierer
parents: 712
diff changeset
330
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
331 snprintf(text,32,"\001%c",TXT_CO2Sensor);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
332 write_topline(text);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
333
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
334 refresh_CO2Data();
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
335 if(settingsGetPointer()->co2_sensor_active)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
336 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
337 text[0] = '\005';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
338 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
339 else
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
340 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
341 text[0] = '\006';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
342 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
343 text[0] = TXT_CO2Sensor;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
344 text[1] = 0;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
345
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
346 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
347
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
348 text[0] = TXT_2BYTE;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
349 text[1] = TXT2BYTE_O2Calib;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
350 text[2] = 0;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
351 write_field_button(StMXTRA_CO2_Sensor_Calib,30, 800, ME_Y_LINE4, &FontT48, text);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
352
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
353 setEvent(StMXTRA_CO2_Sensor, (uint32_t)OnAction_CO2OnOff);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
354 setEvent(StMXTRA_CO2_Sensor_Calib, (uint32_t)OnAction_CO2Calib);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
355
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
356 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
357 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
358 #endif
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
359
774
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
360
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
361 static uint8_t OnAction_CompassHeadingClear(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
362 {
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
363 stateUsedWrite->diveSettings.compassHeading = 0;
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
364
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
365 exitMenuEdit_to_Home_with_Menu_Update();
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
366
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
367 return EXIT_TO_HOME;
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
368 }
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
369
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
370
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
371 static uint8_t OnAction_CompassHeadingReset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
372 {
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
373 stateUsedWrite->diveSettings.compassHeading = settingsGetPointer()->compassBearing;
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
374
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
375 exitMenuEdit_to_Home_with_Menu_Update();
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
376
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
377 return EXIT_TO_HOME;
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
378 }
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
379
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
380
776
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 774
diff changeset
381 static void drawCompassHeadingMenu(bool isRefresh)
774
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
382 {
776
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 774
diff changeset
383 SSettings *settings = settingsGetPointer();
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 774
diff changeset
384
774
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
385 char text[32];
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
386 snprintf(text, 32, "\001%c%c", TXT_2BYTE, TXT2BYTE_CompassHeading);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
387 write_topline(text);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
388
776
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 774
diff changeset
389 uint16_t heading;
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 774
diff changeset
390 if (settings->compassInertia) {
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 774
diff changeset
391 heading = (uint16_t)compass_getCompensated();
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 774
diff changeset
392 } else {
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 774
diff changeset
393 heading = (uint16_t)stateUsed->lifeData.compass_heading;
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 774
diff changeset
394 }
774
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
395 snprintf(text,32,"\001%03i`",heading);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
396 write_label_var(0, 800, ME_Y_LINE1, &FontT54, text);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
397
776
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 774
diff changeset
398 if (!isRefresh) {
774
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
399 snprintf(text, 32, "%c%c", TXT_2BYTE, TXT2BYTE_Set);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
400 write_field_button(StMXTRA_CompassHeading, 20, 800, ME_Y_LINE2, &FontT48, text);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
401 } else {
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
402 tMenuEdit_refresh_field(StMXTRA_CompassHeading);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
403 }
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
404
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
405 bool headingIsSet = stateUsed->diveSettings.compassHeading;
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
406 snprintf(text, 32, "%s%c%c", makeGrey(!headingIsSet), TXT_2BYTE, TXT2BYTE_Clear);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
407 if (headingIsSet) {
776
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 774
diff changeset
408 if (!isRefresh) {
774
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
409 write_field_button(StMXTRA_CompassHeadingClear, 20, 800, ME_Y_LINE3, &FontT48, text);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
410 } else {
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
411 tMenuEdit_refresh_field(StMXTRA_CompassHeadingClear);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
412 }
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
413 } else {
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
414 write_label_var(20, 800, ME_Y_LINE3, &FontT48, text);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
415 }
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
416
776
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 774
diff changeset
417 int16_t compassBearing = settings->compassBearing;
774
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
418 bool canSetBearing = compassBearing && compassBearing != stateUsed->diveSettings.compassHeading;
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
419 snprintf(text, 32, "%s%c%c (%03u`)", makeGrey(!canSetBearing), TXT_2BYTE, TXT2BYTE_Reset, compassBearing);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
420 if (canSetBearing) {
776
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 774
diff changeset
421 if (!isRefresh) {
774
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
422 write_field_button(StMXTRA_CompassHeadingReset, 20, 800, ME_Y_LINE4, &FontT48, text);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
423 } else {
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
424 tMenuEdit_refresh_field(StMXTRA_CompassHeadingReset);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
425 }
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
426 } else {
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
427 write_label_var(20, 800, ME_Y_LINE4, &FontT48, text);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
428 }
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
429
776
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 774
diff changeset
430 if (!isRefresh) {
774
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
431 setEvent(StMXTRA_CompassHeading, (uint32_t)OnAction_CompassHeading);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
432 setEvent(StMXTRA_CompassHeadingClear, (uint32_t)OnAction_CompassHeadingClear);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
433 setEvent(StMXTRA_CompassHeadingReset, (uint32_t)OnAction_CompassHeadingReset);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
434 }
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
435
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
436 write_buttonTextline(TXT2BYTE_ButtonBack, TXT2BYTE_ButtonEnter, TXT2BYTE_ButtonNext);
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
437 }
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
438
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
439
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440 void refresh_CompassHeading(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 {
776
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 774
diff changeset
442 drawCompassHeadingMenu(true);
774
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
443 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
446 void refresh_CO2Data(void)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
447 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
448 char text[32];
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
449
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
450 snprintf(text,32,"\001%c",TXT_CO2Sensor);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
451 write_topline(text);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
452
748
be25ab2d902c Added display of co2 ppm values:
Ideenmodellierer
parents: 725
diff changeset
453 snprintf(text,32,"CO2: %ld ppm",stateUsed->lifeData.CO2_data.CO2_ppm);
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
454 write_label_var( 30, 800, ME_Y_LINE1, &FontT48, text);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
455
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
456 snprintf(text,32,"Signal: %d",stateUsed->lifeData.CO2_data.signalStrength);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
457 write_label_var( 30, 800, ME_Y_LINE2, &FontT48, text);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
458
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
459 tMenuEdit_refresh_field(StMXTRA_CO2_Sensor);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
460 tMenuEdit_refresh_field(StMXTRA_CO2_Sensor_Calib);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
461 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
462
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463 void openEdit_CompassHeading(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464 {
776
45b8f3c2acce Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents: 774
diff changeset
465 drawCompassHeadingMenu(false);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
467
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
468
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469 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
470 {
774
6169309d6eb9 more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents: 769
diff changeset
471 setCompassHeading((uint16_t)stateUsed->lifeData.compass_heading);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472 exitMenuEdit_to_Home_with_Menu_Update();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 return EXIT_TO_HOME;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 }
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
475
710
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
476
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
477 uint8_t OnAction_ScrubberTimerId(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
478 {
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
479 char text[32];
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
480 SSettings *pSettings;
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
481 pSettings = settingsGetPointer();
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
482
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
483 if(pSettings->scubberActiveId == 0)
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
484 {
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
485 pSettings->scubberActiveId = 1;
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
486 }
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
487 else
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
488 {
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
489 pSettings->scubberActiveId = 0;
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
490 }
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
491
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
492
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
493 snprintf(&text[0], 32,"%c \002#%d",TXT_ScrubTime,pSettings->scubberActiveId);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
494 tMenuEdit_newButtonText(StMXTRA_ScrubTimer, text);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
495
758
b6d8a6fbf4fd - Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents: 748
diff changeset
496 printScrubberResetText(text, pSettings);
710
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
497 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_Reset, text);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
498
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
499 tMenuEdit_newInput(StMXTRA_ScrubTimer_Max, pSettings->scrubberData[pSettings->scubberActiveId].TimerMax, 0, 0, 0);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
500
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
501 if(pSettings->scrubberData[pSettings->scubberActiveId].lastDive.WeekDay != 0)
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
502 {
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
503 snprintf(&text[0], 32,"%c%c\002 %02d.%02d.%02d", TXT_2BYTE, TXT2BYTE_SimDiveTime, pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Date,
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
504 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Month,
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
505 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Year);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
506 }
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
507 else
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
508 {
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
509 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
510 }
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
511 clean_content( 20, 780, ME_Y_LINE4, &FontT48);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
512 write_label_var( 20, 780, ME_Y_LINE4, &FontT48, text);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
513
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
514 return UNSPECIFIC_RETURN;
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
515 }
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
516
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
517 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
518 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
519 SSettings *pSettings;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
520 uint8_t digitContentNew = EXIT_TO_MENU;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
521 uint32_t newScrubberTime;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
522
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
523 if(action == ACTION_BUTTON_ENTER)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
524 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
525 return digitContent;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
526 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
527 if(action == ACTION_BUTTON_ENTER_FINAL)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
528 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
529 evaluateNewString(editId, &newScrubberTime, 0, 0, 0);
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
530
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
531 if(newScrubberTime > MAX_SCRUBBER_TIME)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
532 newScrubberTime = MAX_SCRUBBER_TIME;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
533
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
534 pSettings = settingsGetPointer();
710
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
535 pSettings->scrubberData[pSettings->scubberActiveId].TimerMax = newScrubberTime;
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
536 if(pSettings->scrubberData[pSettings->scubberActiveId].TimerCur > newScrubberTime)
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
537 {
710
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
538 pSettings->scrubberData[pSettings->scubberActiveId].TimerCur = newScrubberTime;
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
539 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
540
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
541 tMenuEdit_newInput(editId, newScrubberTime, 0, 0, 0);
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
542 digitContentNew = UNSPECIFIC_RETURN;
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
543 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
544 if(action == ACTION_BUTTON_NEXT)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
545 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
546 digitContentNew = digitContent + 1;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
547 if(digitContentNew > '9')
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
548 digitContentNew = '0';
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
549 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
550 if(action == ACTION_BUTTON_BACK)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
551 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
552 digitContentNew = digitContent - 1;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
553 if(digitContentNew < '0')
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
554 digitContentNew = '9';
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
555 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
556 return digitContentNew;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
557 }
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
558
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
559 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
560 {
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
561 char text[32];
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
562 SSettings *pSettings;
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
563 pSettings = settingsGetPointer();
710
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
564 pSettings->scrubberData[pSettings->scubberActiveId].TimerCur = pSettings->scrubberData[pSettings->scubberActiveId].TimerMax;
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
565 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.WeekDay = 0; /* invalidate date */
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
566
758
b6d8a6fbf4fd - Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents: 748
diff changeset
567 printScrubberResetText(text, pSettings);
710
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
568 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_Reset, text);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
569
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
570 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
571 clean_content( 20, 780, ME_Y_LINE4, &FontT48);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
572 write_label_var( 20, 780, ME_Y_LINE4, &FontT48, text);
8adf9b8fc7fa Extension scrubber time:
Ideenmodellierer
parents: 707
diff changeset
573
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
574
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
575 return UNSPECIFIC_RETURN;
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
576 }
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
577
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
578 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
579 {
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
580 char text[32];
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
581 uint8_t newMode;
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
582 SSettings *pSettings;
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
583 pSettings = settingsGetPointer();
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
584 newMode = pSettings->scrubTimerMode + 1;
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
585 if(newMode >= SCRUB_TIMER_END)
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
586 {
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
587 newMode = SCRUB_TIMER_OFF;
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
588 }
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
589 pSettings->scrubTimerMode = newMode;
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
590
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
591 switch(pSettings->scrubTimerMode)
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
592 {
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
593 case SCRUB_TIMER_OFF:
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
594 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
595 break;
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
596 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
597 break;
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
598 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
599 break;
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
600 }
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
601 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_OP_Mode, text);
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
602
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
603 return UNSPECIFIC_RETURN;
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
604 }
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
605
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
606 #ifdef ENABLE_PSCR_MODE
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
607 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
608 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
609 SSettings *pSettings;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
610 uint8_t digitContentNew = EXIT_TO_MENU;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
611 uint32_t newO2Drop;
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 648
diff changeset
612
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
613 if(action == ACTION_BUTTON_ENTER)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
614 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
615 return digitContent;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
616 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
617 if(action == ACTION_BUTTON_ENTER_FINAL)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
618 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
619 evaluateNewString(editId, &newO2Drop, 0, 0, 0);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
620
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
621 if(newO2Drop > PSCR_MAX_O2_DROP)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
622 newO2Drop = PSCR_MAX_O2_DROP;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
623
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
624 pSettings = settingsGetPointer();
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
625 pSettings->pscr_o2_drop = newO2Drop;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
626
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
627 tMenuEdit_newInput(editId, newO2Drop, 0, 0, 0);
793
9da81033ad44 Bugfix PSCR Settings in Simulator Mode:
Ideenmodellierer
parents: 776
diff changeset
628 digitContentNew = UPDATE_DIVESETTINGS;
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
629 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
630 if(action == ACTION_BUTTON_NEXT)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
631 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
632 digitContentNew = digitContent + 1;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
633 if(digitContentNew > '9')
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
634 digitContentNew = '0';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
635 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
636 if(action == ACTION_BUTTON_BACK)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
637 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
638 digitContentNew = digitContent - 1;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
639 if(digitContentNew < '0')
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
640 digitContentNew = '9';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
641 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
642 return digitContentNew;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
643 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
644
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
645 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
646 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
647 SSettings *pSettings;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
648 uint8_t digitContentNew = EXIT_TO_MENU;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
649 uint32_t newLungRatio;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
650
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
651 if(action == ACTION_BUTTON_ENTER)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
652 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
653 return digitContent;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
654 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
655 if(action == ACTION_BUTTON_ENTER_FINAL)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
656 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
657 evaluateNewString(editId, &newLungRatio, 0, 0, 0);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
658
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
659 if(newLungRatio > PSCR_MAX_LUNG_RATIO)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
660 newLungRatio = PSCR_MAX_LUNG_RATIO;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
661
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
662 if(newLungRatio < PSCR_MIN_LUNG_RATIO)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
663 newLungRatio = PSCR_MIN_LUNG_RATIO;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
664
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
665 pSettings = settingsGetPointer();
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
666 pSettings->pscr_lung_ratio = newLungRatio;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
667
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
668 tMenuEdit_newInput(editId, newLungRatio, 0, 0, 0);
793
9da81033ad44 Bugfix PSCR Settings in Simulator Mode:
Ideenmodellierer
parents: 776
diff changeset
669 digitContentNew = UPDATE_DIVESETTINGS;
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
670 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
671 if(action == ACTION_BUTTON_NEXT)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
672 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
673 digitContentNew = digitContent + 1;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
674 if(digitContentNew > '9')
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
675 digitContentNew = '0';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
676 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
677 if(action == ACTION_BUTTON_BACK)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
678 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
679 digitContentNew = digitContent - 1;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
680 if(digitContentNew < '0')
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
681 digitContentNew = '9';
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
682 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
683 return digitContentNew;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
684 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
685 #endif
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
686
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
687 #ifdef ENABLE_CO2_SUPPORT
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
688 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
689 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
690 SSettings *pSettings = settingsGetPointer();
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
691 if(pSettings->co2_sensor_active)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
692 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
693 pSettings->co2_sensor_active = 0;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
694 tMenuEdit_set_on_off(StMXTRA_CO2_Sensor,0);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
695 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
696 else
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
697 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
698 pSettings->co2_sensor_active = 1;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
699 tMenuEdit_set_on_off(StMXTRA_CO2_Sensor,1);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
700 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
701 return UPDATE_DIVESETTINGS;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
702 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
703
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
704 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
705 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
706 DataEX_setExtInterface_Cmd(EXT_INTERFACE_CO2_CALIB);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
707 return UPDATE_DIVESETTINGS;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
708 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 654
diff changeset
709 #endif