Mercurial > public > ostc4
annotate Discovery/Src/tMenuEditXtra.c @ 1017:5924a2d1d3ba GasConsumption
Prepare custom block update function:
In the flash area of the font lib some sectors may be used for custom data or a boot updater image. With this change a flash option is added to the maintainance menu.
IMPORTANT: The fimwareEraseProgram.c is needed for compiling the firmware now => Add it e.g. by adding a link from the OtherSources location to your source folder.
| author | Ideenmodellierer |
|---|---|
| date | Thu, 29 May 2025 22:04:46 +0200 |
| parents | 8c0134a287da |
| children | 808153ba3fec |
| rev | line source |
|---|---|
| 38 | 1 /////////////////////////////////////////////////////////////////////////////// |
| 2 /// -*- coding: UTF-8 -*- | |
| 3 /// | |
| 4 /// \file Discovery/Src/tMenuEditXtra.c | |
| 5 /// \brief Menu Edit Xtra - Specials in Divemode like Reset Stopwatch | |
| 6 /// \author heinrichs weikamp gmbh | |
| 7 /// \date 02-Mar-2015 | |
| 8 /// | |
| 9 /// \details | |
| 10 /// | |
| 11 /// $Id$ | |
| 12 /////////////////////////////////////////////////////////////////////////////// | |
| 13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
| 14 /// | |
| 15 /// This program is free software: you can redistribute it and/or modify | |
| 16 /// it under the terms of the GNU General Public License as published by | |
| 17 /// the Free Software Foundation, either version 3 of the License, or | |
| 18 /// (at your option) any later version. | |
| 19 /// | |
| 20 /// This program is distributed in the hope that it will be useful, | |
| 21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 23 /// GNU General Public License for more details. | |
| 24 /// | |
| 25 /// You should have received a copy of the GNU General Public License | |
| 26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 27 ////////////////////////////////////////////////////////////////////////////// | |
| 28 | |
| 29 /* Includes ------------------------------------------------------------------*/ | |
|
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 | 32 #include "tMenuEditXtra.h" |
| 33 | |
| 34 #include "gfx_fonts.h" | |
| 35 #include "simulation.h" | |
| 36 #include "timer.h" | |
| 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 | 39 #include "motion.h" |
| 662 | 40 #include "configuration.h" |
| 845 | 41 #include "tInfoPreDive.h" |
|
347
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
42 |
| 38 | 43 |
| 44 /* Private function prototypes -----------------------------------------------*/ | |
| 45 void openEdit_CompassHeading(void); | |
| 46 void openEdit_ResetStopwatch(void); | |
| 47 void openEdit_SimFollowDecostops(void); | |
| 48 void openEdit_SetManualMarker(void); | |
|
347
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
49 void openEdit_SetEndDive(void); |
|
552
531e7818b737
Added menu structure to acces viewport calibration:
Ideenmodellierer
parents:
547
diff
changeset
|
50 void openEdit_CalibViewport(void); |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
51 |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
52 static void openEdit_CCRModeSensorOrFixedSP(void); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
53 static void openEdit_Fallback(void); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
54 static void openEdit_Scrubber(void); |
| 662 | 55 #ifdef ENABLE_PSCR_MODE |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
56 static void openEdit_PSCR(void); |
| 662 | 57 #endif |
| 38 | 58 |
| 59 /* Announced function prototypes -----------------------------------------------*/ | |
| 60 uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
| 710 | 61 uint8_t OnAction_ScrubberTimerId(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 62 static uint8_t OnAction_ScrubberTimerMax(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
63 static uint8_t OnAction_ScrubberReset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
64 static uint8_t OnAction_ScrubberMode(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 998 | 65 static uint8_t OnAction_ScrubberActive(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
| 662 | 66 #ifdef ENABLE_PSCR_MODE |
| 67 static uint8_t OnAction_PSCRO2Drop(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
| 68 static uint8_t OnAction_PSCRLungRation(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
| 69 #endif | |
| 70 | |
| 38 | 71 /* Exported functions --------------------------------------------------------*/ |
| 72 | |
| 998 | 73 static uint8_t scrubberMenuId = 0; |
| 710 | 74 |
| 38 | 75 void openEdit_Xtra(uint8_t line) |
| 76 { | |
| 77 set_globalState_Menu_Line(line); | |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
78 |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
79 /* DIVE MODE */ |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
80 if(actual_menu_content != MENU_SURFACE) |
| 38 | 81 { |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
82 resetMenuEdit(CLUT_MenuPageXtra); |
|
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 switch(line) |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
85 { |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
86 case 1: |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
87 default: |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
88 openEdit_ResetStopwatch(); |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
89 break; |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
90 case 2: |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
91 openEdit_CompassHeading(); |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
92 break; |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
93 case 3: |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
94 openEdit_SetManualMarker(); |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
95 break; |
|
906
49ee233c7a74
Bugfix de-/activation of deco stop consideration in simulator:
ideenmodellierer
parents:
883
diff
changeset
|
96 #ifdef ENABLE_MOTION_CONTROL |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
97 case 4: |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
98 openEdit_CalibViewport(); |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
99 break; |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
100 case 5: |
|
906
49ee233c7a74
Bugfix de-/activation of deco stop consideration in simulator:
ideenmodellierer
parents:
883
diff
changeset
|
101 #else |
|
49ee233c7a74
Bugfix de-/activation of deco stop consideration in simulator:
ideenmodellierer
parents:
883
diff
changeset
|
102 case 4: |
|
49ee233c7a74
Bugfix de-/activation of deco stop consideration in simulator:
ideenmodellierer
parents:
883
diff
changeset
|
103 #endif |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
104 if(is_stateUsedSetToSim()) |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
105 { |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
106 openEdit_SimFollowDecostops(); |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
107 } |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
108 else |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
109 { |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
110 openEdit_SetEndDive(); |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
111 } |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
112 break; |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
113 } |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
114 } |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
115 else /* surface mode */ |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
116 { |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
117 switch(line) |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
118 { |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
119 case 1: openEdit_CCRModeSensorOrFixedSP(); |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
120 break; |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
121 case 2: openEdit_Fallback(); |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
122 break; |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
123 case 3: openEdit_Scrubber(); |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
124 break; |
| 662 | 125 #ifdef ENABLE_PSCR_MODE |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
126 case 4: openEdit_PSCR(); |
| 662 | 127 break; |
| 128 #endif | |
|
883
7755a476f164
Added compile switch for predive check menu:
Ideenmodellierer
parents:
845
diff
changeset
|
129 #ifdef ENABLE_PREDIVE_CHECK |
| 845 | 130 case 5: openInfo_PreDive(); |
| 131 break; | |
|
883
7755a476f164
Added compile switch for predive check menu:
Ideenmodellierer
parents:
845
diff
changeset
|
132 #endif |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
133 default: |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
134 break; |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
135 } |
| 38 | 136 } |
| 137 } | |
| 138 | |
| 139 /* Private functions ---------------------------------------------------------*/ | |
| 140 void openEdit_ResetStopwatch(void) | |
| 141 { | |
| 142 timer_Stopwatch_Restart(); | |
| 143 exitMenuEdit_to_Home(); | |
| 144 } | |
| 145 | |
| 146 void openEdit_SetManualMarker(void) | |
| 147 { | |
|
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
272
diff
changeset
|
148 stateUsedWrite->events.manualMarker = 1; |
| 38 | 149 exitMenuEdit_to_Home(); |
| 150 } | |
| 151 | |
|
347
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
152 void openEdit_SetEndDive(void) |
|
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
153 { |
|
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
154 dataOutGetPointer()->setEndDive = 1; |
|
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
155 exitMenuEdit_to_Home(); |
|
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
156 } |
|
77de014928d6
Added option to manually leave dive mode to system menu
ideenmodellierer
parents:
288
diff
changeset
|
157 |
| 38 | 158 void openEdit_SimFollowDecostops(void) |
| 159 { | |
| 160 simulation_set_heed_decostops(!simulation_get_heed_decostops()); | |
| 161 exitMenuEdit_to_Menu_with_Menu_Update(); | |
| 162 } | |
| 163 | |
| 547 | 164 void openEdit_CalibViewport(void) |
| 165 { | |
| 166 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
|
167 suspendMotionDetection(0); /* exit to focus mode directly */ |
| 547 | 168 exitMenuEdit_to_Home(); |
| 169 } | |
| 170 | |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
171 |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
172 static void openEdit_CCRModeSensorOrFixedSP(void) |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
173 { |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
174 SSettings *pSettings = settingsGetPointer(); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
175 |
|
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
|
176 if(pSettings->CCR_Mode == CCRMODE_Sensors) { |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
177 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
|
178 } else { |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
179 pSettings->CCR_Mode = CCRMODE_Sensors; |
|
811
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
793
diff
changeset
|
180 } |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
181 |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
182 exitEditWithUpdate(); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
183 } |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
184 |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
185 static void openEdit_Fallback(void) |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
186 { |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
187 /* does not work like this resetEnterPressedToStateBeforeButtonAction(); */ |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
188 |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
189 SSettings *pSettings = settingsGetPointer(); |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
190 |
|
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
|
191 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
|
192 pSettings->fallbackToFixedSetpoint = (pSettings->fallbackToFixedSetpoint + 1) % 2; |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
193 } |
|
769
6b248bcdbf28
Deactivation of the 'fallback' option when the CCR mode is set to 'Fixed' - this makes it a little clearer that the option has no influence in this mode.
heinrichsweikamp
parents:
758
diff
changeset
|
194 |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
195 exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only(); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
196 } |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
197 |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
198 |
| 998 | 199 static void printScrubberResetText(char *text, SSettings *settings, uint8_t scrubberId) |
|
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
200 { |
| 998 | 201 int16_t currentTimerMinutes = settings->scrubberData[scrubberId].TimerCur; |
|
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
202 char colour = '\020'; |
|
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
203 if (currentTimerMinutes <= 0) { |
|
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
204 colour = '\025'; |
|
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
205 } else if (currentTimerMinutes <= 30) { |
|
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
206 colour = '\024'; |
|
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
207 } |
|
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
208 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
|
209 } |
|
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
210 |
|
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
748
diff
changeset
|
211 |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
212 static void openEdit_Scrubber(void) |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
213 { |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
214 char text[32]; |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
215 uint8_t textIndex = 0; |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
216 uint16_t localScrubTimer; |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
217 |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
218 SSettings *pSettings = settingsGetPointer(); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
219 |
| 998 | 220 localScrubTimer = pSettings->scrubberData[scrubberMenuId].TimerMax; |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
221 |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
222 resetMenuEdit(CLUT_MenuPageXtra); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
223 |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
224 |
| 710 | 225 snprintf(&text[0], 32,"\001%c",TXT_ScrubTime); |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
226 write_topline(text); |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
227 |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
228 |
| 998 | 229 snprintf(&text[0], 32,"%c \002#%d",TXT_ScrubTime,scrubberMenuId); |
| 710 | 230 write_field_button(StMXTRA_ScrubTimer, 20, 780, ME_Y_LINE1, &FontT48, text); |
| 231 | |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
232 if(pSettings->scrubberActiveId & (1 << scrubberMenuId)) |
| 998 | 233 { |
| 234 snprintf(&text[0], 32,"%c %c \002\005", TXT_ScrubTime, TXT_Active); | |
| 235 } | |
| 236 else | |
| 237 { | |
| 238 snprintf(&text[0], 32,"%c %c \002\006", TXT_ScrubTime, TXT_Active); | |
| 239 } | |
| 240 write_field_button(StMXTRA_ScrubTimer_Active, 20, 780, ME_Y_LINE2, &FontT48, text); | |
| 241 | |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
242 snprintf(&text[textIndex], 32,\ |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
243 "%c" |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
244 "\016\016(%c)\017" |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
245 ,TXT_ScrubTime |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
246 ,TXT_Maximum); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
247 |
| 998 | 248 write_label_var( 20, 340, ME_Y_LINE3, &FontT48, text); |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
249 snprintf(&text[textIndex], 32, "\002###\016\016 %c\017",TXT_Minutes); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
250 |
| 998 | 251 write_field_udigit(StMXTRA_ScrubTimer_Max, 610, 780, ME_Y_LINE3, &FontT48, text,localScrubTimer, 0, 0, 0); |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
252 |
| 998 | 253 printScrubberResetText(text, pSettings, scrubberMenuId); |
| 254 write_field_button(StMXTRA_ScrubTimer_Reset, 20, 780, ME_Y_LINE4, &FontT48, text); | |
| 710 | 255 |
| 998 | 256 if(pSettings->scrubberData[scrubberMenuId].lastDive.WeekDay != 0) |
| 710 | 257 { |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
258 snprintf(&text[0], 32, "%c%c\002 %02d.%02d.%02d", TXT_2BYTE, TXT2BYTE_SimDiveTime, pSettings->scrubberData[scrubberMenuId].lastDive.Date, pSettings->scrubberData[scrubberMenuId].lastDive.Month, pSettings->scrubberData[scrubberMenuId].lastDive.Year); |
| 710 | 259 } |
| 260 else | |
| 261 { | |
| 262 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime); | |
| 263 } | |
| 998 | 264 write_label_var( 20, 780, ME_Y_LINE5, &FontT48, text); |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
265 |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
266 switch (pSettings->scrubTimerMode) { |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
267 case SCRUB_TIMER_MINUTES: |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
268 default: |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
269 snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Minutes ); |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
270 |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
271 break; |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
272 case SCRUB_TIMER_PERCENT: |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
273 snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Percent ); |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
274 |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
275 break; |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
276 } |
| 998 | 277 write_field_button(StMXTRA_ScrubTimer_OP_Mode, 20, 780, ME_Y_LINE6, &FontT48, text); |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
278 |
| 710 | 279 setEvent(StMXTRA_ScrubTimer, (uint32_t)OnAction_ScrubberTimerId); |
| 998 | 280 setEvent(StMXTRA_ScrubTimer_Active, (uint32_t)OnAction_ScrubberActive); |
| 710 | 281 setEvent(StMXTRA_ScrubTimer_Max, (uint32_t)OnAction_ScrubberTimerMax); |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
282 setEvent(StMXTRA_ScrubTimer_Reset, (uint32_t)OnAction_ScrubberReset); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
283 setEvent(StMXTRA_ScrubTimer_OP_Mode, (uint32_t)OnAction_ScrubberMode); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
284 |
| 998 | 285 |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
286 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
287 |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
288 } |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
289 |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
290 static void openEdit_PSCR(void) |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
291 { |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
292 uint8_t localO2Drop,localLungRatio; |
| 662 | 293 char text[32]; |
| 294 SSettings *pSettings = settingsGetPointer(); | |
| 295 localO2Drop = pSettings->pscr_o2_drop; | |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
296 localLungRatio = pSettings->pscr_lung_ratio; |
| 662 | 297 |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
298 resetMenuEdit(CLUT_MenuPageXtra); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
299 |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
300 snprintf(text, 32, "\001%c",TXT_PSClosedCircuit); |
| 662 | 301 write_topline(text); |
| 302 | |
| 303 text[0] = '\002'; | |
| 304 text[1] = '\016'; | |
| 305 text[2] = '\016'; | |
| 306 text[3] = '%'; | |
| 307 text[4] = 0; | |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
308 write_label_fix( 20, 800, ME_Y_LINE1, &FontT48, TXT_PSCRO2Drop); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
309 write_label_var( 435, 780, ME_Y_LINE1, &FontT48, text); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
310 write_field_udigit(StMXTRA_PSCR_O2_Drop, 710, 779, ME_Y_LINE1, &FontT48, "##", (uint32_t)localO2Drop, 0, 0, 0); |
| 662 | 311 |
| 312 | |
| 313 text[0] = '\002'; | |
| 314 text[1] = '1'; | |
| 315 text[2] = '/'; | |
| 316 text[3] = 0; | |
| 317 | |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
318 write_label_fix( 20, 800, ME_Y_LINE2, &FontT48, TXT_PSCRLungRatio); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
319 write_label_var( 435, 710, ME_Y_LINE2, &FontT48, text); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
320 write_field_udigit(StMXTRA_PSCR_LUNG_RATIO, 710, 779, ME_Y_LINE2, &FontT48, "##", (uint32_t)localLungRatio, 0, 0, 0); |
| 662 | 321 |
| 712 | 322 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); |
| 662 | 323 |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
324 setEvent(StMXTRA_PSCR_O2_Drop, (uint32_t)OnAction_PSCRO2Drop); |
| 662 | 325 setEvent(StMXTRA_PSCR_LUNG_RATIO, (uint32_t)OnAction_PSCRLungRation); |
| 326 } | |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
327 |
| 662 | 328 |
|
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
|
329 |
|
967
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
330 static uint8_t OnAction_CompassHeadingReverse(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
331 { |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
332 setCompassHeading((stateUsed->diveSettings.compassHeading + 180) % 360); |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
333 |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
334 exitMenuEdit_to_Home_with_Menu_Update(); |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
335 |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
336 return EXIT_TO_HOME; |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
337 } |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
338 |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
339 |
|
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
|
340 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
|
341 { |
|
929
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
342 clearCompassHeading(); |
|
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
|
343 |
|
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
|
344 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
|
345 |
|
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
|
346 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
|
347 } |
|
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
|
348 |
|
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
|
349 |
|
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
|
350 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
|
351 { |
|
929
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
352 setCompassHeading(settingsGetPointer()->compassBearing); |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
353 |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
354 exitMenuEdit_to_Home_with_Menu_Update(); |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
355 |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
356 return EXIT_TO_HOME; |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
357 } |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
358 |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
359 |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
360 static uint8_t OnAction_CompassHeadingLog(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
361 { |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
362 logCompassHeading((uint16_t)stateUsed->lifeData.compass_heading); |
|
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
|
363 |
|
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 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
|
365 |
|
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 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
|
367 } |
|
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 |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
370 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
|
371 { |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
372 SSettings *settings = settingsGetPointer(); |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
373 |
|
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
|
374 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
|
375 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
|
376 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
|
377 |
|
967
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
378 if (!isRefresh) { |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
379 snprintf(text, 32, "%c%c", TXT_2BYTE, TXT2BYTE_Set); |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
380 write_field_button(StMXTRA_CompassHeading, 20, 800, ME_Y_LINE1, &FontT48, text); |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
381 } else { |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
382 tMenuEdit_refresh_field(StMXTRA_CompassHeading); |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
383 } |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
384 |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
385 uint16_t heading; |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
386 if (settings->compassInertia) { |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
387 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
|
388 } else { |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
389 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
|
390 } |
|
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
|
391 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
|
392 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
|
393 |
|
967
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
394 bool headingIsSet = stateUsed->diveSettings.compassHeading; |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
395 snprintf(text, 32, "%s%c%c", makeGrey(!headingIsSet), TXT_2BYTE, TXT2BYTE_Reverse); |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
396 if (headingIsSet) { |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
397 if (!isRefresh) { |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
398 write_field_button(StMXTRA_CompassHeadingReverse, 20, 800, ME_Y_LINE2, &FontT48, text); |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
399 } else { |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
400 tMenuEdit_refresh_field(StMXTRA_CompassHeadingReverse); |
|
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
401 } |
|
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
|
402 } else { |
|
967
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
403 write_label_var(20, 800, ME_Y_LINE2, &FontT48, text); |
|
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
|
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 |
|
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 |
|
929
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
430 snprintf(text, 32, "%c%c", TXT_2BYTE, TXT2BYTE_Log); |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
431 if (!isRefresh) { |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
432 write_field_button(StMXTRA_CompassHeadingLog, 20, 800, ME_Y_LINE5, &FontT48, text); |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
433 } else { |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
434 tMenuEdit_refresh_field(StMXTRA_CompassHeadingLog); |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
435 } |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
436 |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
437 if (headingIsSet) { |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
438 snprintf(text, 32, "%s%c%c (%03u`)", makeGrey(true), TXT_2BYTE, TXT2BYTE_Current, stateUsed->diveSettings.compassHeading); |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
439 write_label_var(20, 800, ME_Y_LINE6, &FontT48, text); |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
440 } |
|
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
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 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
|
443 setEvent(StMXTRA_CompassHeading, (uint32_t)OnAction_CompassHeading); |
|
967
9b418e63dbc2
Add a 'Reverse' action to the compass heading dive menu.
heinrichsweikamp
parents:
929
diff
changeset
|
444 setEvent(StMXTRA_CompassHeadingReverse, (uint32_t)OnAction_CompassHeadingReverse); |
|
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
|
445 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
|
446 setEvent(StMXTRA_CompassHeadingReset, (uint32_t)OnAction_CompassHeadingReset); |
|
929
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
906
diff
changeset
|
447 setEvent(StMXTRA_CompassHeadingLog, (uint32_t)OnAction_CompassHeadingLog); |
|
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
|
448 } |
|
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
|
449 |
|
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
|
450 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
|
451 } |
|
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
|
452 |
|
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
|
453 |
| 38 | 454 void refresh_CompassHeading(void) |
| 455 { | |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
456 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
|
457 } |
| 38 | 458 |
| 459 | |
| 460 void openEdit_CompassHeading(void) | |
| 461 { | |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
462 drawCompassHeadingMenu(false); |
| 38 | 463 } |
| 464 | |
| 465 | |
| 466 uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 467 { | |
|
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
|
468 setCompassHeading((uint16_t)stateUsed->lifeData.compass_heading); |
| 38 | 469 exitMenuEdit_to_Home_with_Menu_Update(); |
| 470 return EXIT_TO_HOME; | |
| 471 } | |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
472 |
| 710 | 473 |
| 474 uint8_t OnAction_ScrubberTimerId(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 475 { | |
| 476 char text[32]; | |
| 477 SSettings *pSettings; | |
| 478 pSettings = settingsGetPointer(); | |
| 479 | |
| 998 | 480 if(scrubberMenuId == 0) |
| 710 | 481 { |
| 998 | 482 scrubberMenuId = 1; |
| 710 | 483 } |
| 484 else | |
| 485 { | |
| 998 | 486 scrubberMenuId = 0; |
| 710 | 487 } |
| 488 | |
| 998 | 489 snprintf(&text[0], 32,"%c \002#%d",TXT_ScrubTime,scrubberMenuId); |
| 710 | 490 tMenuEdit_newButtonText(StMXTRA_ScrubTimer, text); |
| 491 | |
| 998 | 492 printScrubberResetText(text, pSettings, scrubberMenuId); |
| 710 | 493 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_Reset, text); |
| 494 | |
| 998 | 495 tMenuEdit_newInput(StMXTRA_ScrubTimer_Max, pSettings->scrubberData[scrubberMenuId].TimerMax, 0, 0, 0); |
| 710 | 496 |
| 998 | 497 if(pSettings->scrubberData[scrubberMenuId].lastDive.WeekDay != 0) |
| 710 | 498 { |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
499 snprintf(&text[0], 32, "%c%c\002 %02d.%02d.%02d", TXT_2BYTE, TXT2BYTE_SimDiveTime, pSettings->scrubberData[scrubberMenuId].lastDive.Date, pSettings->scrubberData[scrubberMenuId].lastDive.Month, pSettings->scrubberData[scrubberMenuId].lastDive.Year); |
| 710 | 500 } |
| 501 else | |
| 502 { | |
| 503 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime); | |
| 504 } | |
| 998 | 505 clean_content( 20, 780, ME_Y_LINE5, &FontT48); |
| 506 write_label_var( 20, 780, ME_Y_LINE5, &FontT48, text); | |
| 507 | |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
508 if(pSettings->scrubberActiveId & (1 << scrubberMenuId)) |
| 998 | 509 { |
| 510 snprintf(&text[0], 32,"%c %c \002\005", TXT_ScrubTime, TXT_Active); | |
| 511 } | |
| 512 else | |
| 513 { | |
| 514 snprintf(&text[0], 32,"%c %c \002\006", TXT_ScrubTime, TXT_Active); | |
| 515 } | |
| 516 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_Active, text); | |
| 710 | 517 |
| 518 return UNSPECIFIC_RETURN; | |
| 519 } | |
| 520 | |
| 521 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
|
522 { |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
523 SSettings *pSettings; |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
524 uint8_t digitContentNew = EXIT_TO_MENU; |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
525 uint32_t newScrubberTime; |
|
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) |
|
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 return digitContent; |
|
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(action == ACTION_BUTTON_ENTER_FINAL) |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
532 { |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
533 evaluateNewString(editId, &newScrubberTime, 0, 0, 0); |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
534 |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
535 if(newScrubberTime > MAX_SCRUBBER_TIME) |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
536 newScrubberTime = MAX_SCRUBBER_TIME; |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
537 |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
538 pSettings = settingsGetPointer(); |
| 998 | 539 pSettings->scrubberData[scrubberMenuId].TimerMax = newScrubberTime; |
| 540 if(pSettings->scrubberData[scrubberMenuId].TimerCur > newScrubberTime) | |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
541 { |
| 998 | 542 pSettings->scrubberData[scrubberMenuId].TimerCur = newScrubberTime; |
|
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 |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
545 tMenuEdit_newInput(editId, newScrubberTime, 0, 0, 0); |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
546 digitContentNew = UNSPECIFIC_RETURN; |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
547 } |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
548 if(action == ACTION_BUTTON_NEXT) |
|
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 digitContentNew = digitContent + 1; |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
551 if(digitContentNew > '9') |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
552 digitContentNew = '0'; |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
553 } |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
554 if(action == ACTION_BUTTON_BACK) |
|
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 digitContentNew = digitContent - 1; |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
557 if(digitContentNew < '0') |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
558 digitContentNew = '9'; |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
559 } |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
560 return digitContentNew; |
|
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
561 } |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
562 |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
563 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
|
564 { |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
565 char text[32]; |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
566 SSettings *pSettings; |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
567 pSettings = settingsGetPointer(); |
| 998 | 568 pSettings->scrubberData[scrubberMenuId].TimerCur = pSettings->scrubberData[scrubberMenuId].TimerMax; |
| 569 pSettings->scrubberData[scrubberMenuId].lastDive.WeekDay = 0; /* invalidate date */ | |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
570 |
| 998 | 571 printScrubberResetText(text, pSettings, scrubberMenuId); |
| 710 | 572 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_Reset, text); |
| 573 | |
| 574 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime); | |
| 998 | 575 clean_content( 20, 780, ME_Y_LINE5, &FontT48); |
| 576 write_label_var( 20, 780, ME_Y_LINE5, &FontT48, text); | |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
577 |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
578 return UNSPECIFIC_RETURN; |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
579 } |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
580 |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
581 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
|
582 { |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
583 char text[32]; |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
584 uint8_t newMode; |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
585 SSettings *pSettings; |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
586 pSettings = settingsGetPointer(); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
587 newMode = pSettings->scrubTimerMode + 1; |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
588 if (newMode >= SCRUB_TIMER_END) { |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
589 newMode = SCRUB_TIMER_MINUTES; |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
590 } |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
591 pSettings->scrubTimerMode = newMode; |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
592 |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
593 switch (pSettings->scrubTimerMode) { |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
594 case SCRUB_TIMER_MINUTES: |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
595 default: |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
596 snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Minutes ); |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
597 |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
598 break; |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
599 case SCRUB_TIMER_PERCENT: |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
600 snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Percent ); |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
601 |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
602 break; |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
603 } |
|
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
604 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_OP_Mode, text); |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
605 |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
606 return UNSPECIFIC_RETURN; |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
607 } |
|
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
608 |
| 998 | 609 uint8_t OnAction_ScrubberActive(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
| 610 { | |
| 611 char text[32]; | |
| 612 SSettings *pSettings; | |
| 613 pSettings = settingsGetPointer(); | |
| 614 | |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
615 if(pSettings->scrubberActiveId & (1 << scrubberMenuId)) |
| 998 | 616 { |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
617 pSettings->scrubberActiveId &= ~(1 << scrubberMenuId); |
| 998 | 618 snprintf(&text[0], 32,"%c %c \002\006", TXT_ScrubTime, TXT_Active); |
| 619 } | |
| 620 else | |
| 621 { | |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
998
diff
changeset
|
622 pSettings->scrubberActiveId |= (1 << scrubberMenuId); |
| 998 | 623 snprintf(&text[0], 32,"%c %c \002\005", TXT_ScrubTime, TXT_Active); |
| 624 } | |
| 625 | |
| 626 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_Active, text); | |
| 627 | |
| 628 return UNSPECIFIC_RETURN; | |
| 629 } | |
| 630 | |
| 662 | 631 #ifdef ENABLE_PSCR_MODE |
| 632 static uint8_t OnAction_PSCRO2Drop(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 633 { | |
| 634 SSettings *pSettings; | |
| 635 uint8_t digitContentNew = EXIT_TO_MENU; | |
| 636 uint32_t newO2Drop; | |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
648
diff
changeset
|
637 |
| 662 | 638 if(action == ACTION_BUTTON_ENTER) |
| 639 { | |
| 640 return digitContent; | |
| 641 } | |
| 642 if(action == ACTION_BUTTON_ENTER_FINAL) | |
| 643 { | |
| 644 evaluateNewString(editId, &newO2Drop, 0, 0, 0); | |
| 645 | |
| 646 if(newO2Drop > PSCR_MAX_O2_DROP) | |
| 647 newO2Drop = PSCR_MAX_O2_DROP; | |
| 648 | |
| 649 pSettings = settingsGetPointer(); | |
| 650 pSettings->pscr_o2_drop = newO2Drop; | |
| 651 | |
| 652 tMenuEdit_newInput(editId, newO2Drop, 0, 0, 0); | |
| 793 | 653 digitContentNew = UPDATE_DIVESETTINGS; |
| 662 | 654 } |
| 655 if(action == ACTION_BUTTON_NEXT) | |
| 656 { | |
| 657 digitContentNew = digitContent + 1; | |
| 658 if(digitContentNew > '9') | |
| 659 digitContentNew = '0'; | |
| 660 } | |
| 661 if(action == ACTION_BUTTON_BACK) | |
| 662 { | |
| 663 digitContentNew = digitContent - 1; | |
| 664 if(digitContentNew < '0') | |
| 665 digitContentNew = '9'; | |
| 666 } | |
| 667 return digitContentNew; | |
| 668 } | |
| 669 | |
| 670 static uint8_t OnAction_PSCRLungRation(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
| 671 { | |
| 672 SSettings *pSettings; | |
| 673 uint8_t digitContentNew = EXIT_TO_MENU; | |
| 674 uint32_t newLungRatio; | |
| 675 | |
| 676 if(action == ACTION_BUTTON_ENTER) | |
| 677 { | |
| 678 return digitContent; | |
| 679 } | |
| 680 if(action == ACTION_BUTTON_ENTER_FINAL) | |
| 681 { | |
| 682 evaluateNewString(editId, &newLungRatio, 0, 0, 0); | |
| 683 | |
| 684 if(newLungRatio > PSCR_MAX_LUNG_RATIO) | |
| 685 newLungRatio = PSCR_MAX_LUNG_RATIO; | |
| 686 | |
| 687 if(newLungRatio < PSCR_MIN_LUNG_RATIO) | |
| 688 newLungRatio = PSCR_MIN_LUNG_RATIO; | |
| 689 | |
| 690 pSettings = settingsGetPointer(); | |
| 691 pSettings->pscr_lung_ratio = newLungRatio; | |
| 692 | |
| 693 tMenuEdit_newInput(editId, newLungRatio, 0, 0, 0); | |
| 793 | 694 digitContentNew = UPDATE_DIVESETTINGS; |
| 662 | 695 } |
| 696 if(action == ACTION_BUTTON_NEXT) | |
| 697 { | |
| 698 digitContentNew = digitContent + 1; | |
| 699 if(digitContentNew > '9') | |
| 700 digitContentNew = '0'; | |
| 701 } | |
| 702 if(action == ACTION_BUTTON_BACK) | |
| 703 { | |
| 704 digitContentNew = digitContent - 1; | |
| 705 if(digitContentNew < '0') | |
| 706 digitContentNew = '9'; | |
| 707 } | |
| 708 return digitContentNew; | |
| 709 } | |
| 710 #endif | |
| 711 | |
| 712 |
