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
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
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
+ − 38 #include "data_exchange_main.h"
547
+ − 39 #include "motion.h"
662
+ − 40 #include "configuration.h"
845
+ − 41 #include "tInfoPreDive.h"
347
+ − 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
+ − 49 void openEdit_SetEndDive(void);
552
+ − 50 void openEdit_CalibViewport(void);
707
+ − 51
+ − 52 static void openEdit_CCRModeSensorOrFixedSP(void);
+ − 53 static void openEdit_Fallback(void);
+ − 54 static void openEdit_Scrubber(void);
662
+ − 55 #ifdef ENABLE_PSCR_MODE
707
+ − 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
+ − 63 static uint8_t OnAction_ScrubberReset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+ − 64 static uint8_t OnAction_ScrubberMode(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
662
+ − 65 #ifdef ENABLE_PSCR_MODE
+ − 66 static uint8_t OnAction_PSCRO2Drop(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+ − 67 static uint8_t OnAction_PSCRLungRation(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+ − 68 #endif
+ − 69
38
+ − 70 /* Exported functions --------------------------------------------------------*/
+ − 71
710
+ − 72
38
+ − 73 void openEdit_Xtra(uint8_t line)
+ − 74 {
+ − 75 set_globalState_Menu_Line(line);
707
+ − 76
654
+ − 77 /* DIVE MODE */
+ − 78 if(actual_menu_content != MENU_SURFACE)
38
+ − 79 {
707
+ − 80 resetMenuEdit(CLUT_MenuPageXtra);
+ − 81
654
+ − 82 switch(line)
+ − 83 {
+ − 84 case 1:
+ − 85 default:
+ − 86 openEdit_ResetStopwatch();
+ − 87 break;
+ − 88 case 2:
+ − 89 openEdit_CompassHeading();
+ − 90 break;
+ − 91 case 3:
+ − 92 openEdit_SetManualMarker();
+ − 93 break;
906
+ − 94 #ifdef ENABLE_MOTION_CONTROL
654
+ − 95 case 4:
+ − 96 openEdit_CalibViewport();
+ − 97 break;
+ − 98 case 5:
906
+ − 99 #else
+ − 100 case 4:
+ − 101 #endif
654
+ − 102 if(is_stateUsedSetToSim())
+ − 103 {
+ − 104 openEdit_SimFollowDecostops();
+ − 105 }
+ − 106 else
+ − 107 {
+ − 108 openEdit_SetEndDive();
+ − 109 }
+ − 110 break;
+ − 111 }
+ − 112 }
+ − 113 else /* surface mode */
+ − 114 {
+ − 115 switch(line)
+ − 116 {
707
+ − 117 case 1: openEdit_CCRModeSensorOrFixedSP();
654
+ − 118 break;
707
+ − 119 case 2: openEdit_Fallback();
654
+ − 120 break;
707
+ − 121 case 3: openEdit_Scrubber();
654
+ − 122 break;
662
+ − 123 #ifdef ENABLE_PSCR_MODE
707
+ − 124 case 4: openEdit_PSCR();
662
+ − 125 break;
+ − 126 #endif
883
+ − 127 #ifdef ENABLE_PREDIVE_CHECK
845
+ − 128 case 5: openInfo_PreDive();
+ − 129 break;
883
+ − 130 #endif
654
+ − 131 default:
+ − 132 break;
+ − 133 }
38
+ − 134 }
+ − 135 }
+ − 136
+ − 137 /* Private functions ---------------------------------------------------------*/
+ − 138 void openEdit_ResetStopwatch(void)
+ − 139 {
+ − 140 timer_Stopwatch_Restart();
+ − 141 exitMenuEdit_to_Home();
+ − 142 }
+ − 143
+ − 144 void openEdit_SetManualMarker(void)
+ − 145 {
288
+ − 146 stateUsedWrite->events.manualMarker = 1;
38
+ − 147 exitMenuEdit_to_Home();
+ − 148 }
+ − 149
347
+ − 150 void openEdit_SetEndDive(void)
+ − 151 {
+ − 152 dataOutGetPointer()->setEndDive = 1;
+ − 153 exitMenuEdit_to_Home();
+ − 154 }
+ − 155
38
+ − 156 void openEdit_SimFollowDecostops(void)
+ − 157 {
+ − 158 simulation_set_heed_decostops(!simulation_get_heed_decostops());
+ − 159 exitMenuEdit_to_Menu_with_Menu_Update();
+ − 160 }
+ − 161
547
+ − 162 void openEdit_CalibViewport(void)
+ − 163 {
+ − 164 calibrateViewport(stateUsed->lifeData.compass_roll, stateUsed->lifeData.compass_pitch, stateUsed->lifeData.compass_heading);
648
+ − 165 suspendMotionDetection(0); /* exit to focus mode directly */
547
+ − 166 exitMenuEdit_to_Home();
+ − 167 }
+ − 168
654
+ − 169
707
+ − 170 static void openEdit_CCRModeSensorOrFixedSP(void)
654
+ − 171 {
707
+ − 172 SSettings *pSettings = settingsGetPointer();
+ − 173
816
c4ee952b9425
Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
heinrichsweikamp
diff
changeset
+ − 174 if(pSettings->CCR_Mode == CCRMODE_Sensors) {
707
+ − 175 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
diff
changeset
+ − 176 } else {
707
+ − 177 pSettings->CCR_Mode = CCRMODE_Sensors;
811
+ − 178 }
654
+ − 179
707
+ − 180 exitEditWithUpdate();
+ − 181 }
+ − 182
+ − 183 static void openEdit_Fallback(void)
+ − 184 {
+ − 185 /* does not work like this resetEnterPressedToStateBeforeButtonAction(); */
+ − 186
654
+ − 187 SSettings *pSettings = settingsGetPointer();
+ − 188
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
diff
changeset
+ − 189 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
diff
changeset
+ − 190 pSettings->fallbackToFixedSetpoint = (pSettings->fallbackToFixedSetpoint + 1) % 2;
707
+ − 191 }
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
diff
changeset
+ − 192
707
+ − 193 exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only();
+ − 194 }
+ − 195
654
+ − 196
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 197 static void printScrubberResetText(char *text, SSettings *settings)
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 198 {
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 199 int16_t currentTimerMinutes = settings->scrubberData[settings->scubberActiveId].TimerCur;
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 200 char colour = '\020';
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 201 if (currentTimerMinutes <= 0) {
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 202 colour = '\025';
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 203 } else if (currentTimerMinutes <= 30) {
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 204 colour = '\024';
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 205 }
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 206 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
diff
changeset
+ − 207 }
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 208
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 209
707
+ − 210 static void openEdit_Scrubber(void)
+ − 211 {
+ − 212 char text[32];
+ − 213 uint8_t textIndex = 0;
+ − 214 uint16_t localScrubTimer;
+ − 215
+ − 216 SSettings *pSettings = settingsGetPointer();
+ − 217
710
+ − 218 localScrubTimer = pSettings->scrubberData[pSettings->scubberActiveId].TimerMax;
707
+ − 219
+ − 220 resetMenuEdit(CLUT_MenuPageXtra);
+ − 221
+ − 222
710
+ − 223 snprintf(&text[0], 32,"\001%c",TXT_ScrubTime);
654
+ − 224 write_topline(text);
+ − 225
707
+ − 226
710
+ − 227 snprintf(&text[0], 32,"%c \002#%d",TXT_ScrubTime,pSettings->scubberActiveId);
+ − 228 write_field_button(StMXTRA_ScrubTimer, 20, 780, ME_Y_LINE1, &FontT48, text);
+ − 229
707
+ − 230 snprintf(&text[textIndex], 32,\
+ − 231 "%c"
+ − 232 "\016\016(%c)\017"
+ − 233 ,TXT_ScrubTime
+ − 234 ,TXT_Maximum);
+ − 235
710
+ − 236 write_label_var( 20, 340, ME_Y_LINE2, &FontT48, text);
707
+ − 237 snprintf(&text[textIndex], 32, "\002###\016\016 %c\017",TXT_Minutes);
+ − 238
710
+ − 239 write_field_udigit(StMXTRA_ScrubTimer_Max, 610, 780, ME_Y_LINE2, &FontT48, text,localScrubTimer, 0, 0, 0);
707
+ − 240
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 241 printScrubberResetText(text, pSettings);
710
+ − 242 write_field_button(StMXTRA_ScrubTimer_Reset, 20, 780, ME_Y_LINE3, &FontT48, text);
+ − 243
+ − 244 if(pSettings->scrubberData[pSettings->scubberActiveId].lastDive.WeekDay != 0)
+ − 245 {
+ − 246 snprintf(&text[0], 32,"%c%c\002 %02d.%02d.%02d", TXT_2BYTE, TXT2BYTE_SimDiveTime, pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Date,
+ − 247 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Month,
+ − 248 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Year);
+ − 249 }
+ − 250 else
+ − 251 {
+ − 252 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime);
+ − 253 }
+ − 254 write_label_var( 20, 780, ME_Y_LINE4, &FontT48, text);
654
+ − 255
707
+ − 256 switch(pSettings->scrubTimerMode)
+ − 257 {
+ − 258 case SCRUB_TIMER_OFF:
+ − 259 default: snprintf(&text[0], 32,"%c\002%c%c",TXT_ScrubTimeMode, TXT_2BYTE, TXT2BYTE_MoCtrlNone );
+ − 260 break;
+ − 261 case SCRUB_TIMER_MINUTES: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Minutes );
+ − 262 break;
+ − 263 case SCRUB_TIMER_PERCENT: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Percent );
+ − 264 break;
+ − 265 }
710
+ − 266 write_field_button(StMXTRA_ScrubTimer_OP_Mode, 20, 780, ME_Y_LINE5, &FontT48, text);
707
+ − 267
710
+ − 268 setEvent(StMXTRA_ScrubTimer, (uint32_t)OnAction_ScrubberTimerId);
+ − 269 setEvent(StMXTRA_ScrubTimer_Max, (uint32_t)OnAction_ScrubberTimerMax);
707
+ − 270 setEvent(StMXTRA_ScrubTimer_Reset, (uint32_t)OnAction_ScrubberReset);
+ − 271 setEvent(StMXTRA_ScrubTimer_OP_Mode, (uint32_t)OnAction_ScrubberMode);
+ − 272
+ − 273 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
+ − 274
654
+ − 275 }
+ − 276
707
+ − 277 static void openEdit_PSCR(void)
654
+ − 278 {
707
+ − 279 uint8_t localO2Drop,localLungRatio;
662
+ − 280 char text[32];
+ − 281 SSettings *pSettings = settingsGetPointer();
+ − 282 localO2Drop = pSettings->pscr_o2_drop;
707
+ − 283 localLungRatio = pSettings->pscr_lung_ratio;
662
+ − 284
707
+ − 285 resetMenuEdit(CLUT_MenuPageXtra);
+ − 286
+ − 287 snprintf(text, 32, "\001%c",TXT_PSClosedCircuit);
662
+ − 288 write_topline(text);
+ − 289
+ − 290 text[0] = '\002';
+ − 291 text[1] = '\016';
+ − 292 text[2] = '\016';
+ − 293 text[3] = '%';
+ − 294 text[4] = 0;
707
+ − 295 write_label_fix( 20, 800, ME_Y_LINE1, &FontT48, TXT_PSCRO2Drop);
+ − 296 write_label_var( 435, 780, ME_Y_LINE1, &FontT48, text);
+ − 297 write_field_udigit(StMXTRA_PSCR_O2_Drop, 710, 779, ME_Y_LINE1, &FontT48, "##", (uint32_t)localO2Drop, 0, 0, 0);
662
+ − 298
+ − 299
+ − 300 text[0] = '\002';
+ − 301 text[1] = '1';
+ − 302 text[2] = '/';
+ − 303 text[3] = 0;
+ − 304
707
+ − 305 write_label_fix( 20, 800, ME_Y_LINE2, &FontT48, TXT_PSCRLungRatio);
+ − 306 write_label_var( 435, 710, ME_Y_LINE2, &FontT48, text);
+ − 307 write_field_udigit(StMXTRA_PSCR_LUNG_RATIO, 710, 779, ME_Y_LINE2, &FontT48, "##", (uint32_t)localLungRatio, 0, 0, 0);
662
+ − 308
712
+ − 309 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
662
+ − 310
707
+ − 311 setEvent(StMXTRA_PSCR_O2_Drop, (uint32_t)OnAction_PSCRO2Drop);
662
+ − 312 setEvent(StMXTRA_PSCR_LUNG_RATIO, (uint32_t)OnAction_PSCRLungRation);
+ − 313 }
707
+ − 314
662
+ − 315
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
diff
changeset
+ − 316
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
diff
changeset
+ − 317 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
diff
changeset
+ − 318 {
929
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
diff
changeset
+ − 319 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
diff
changeset
+ − 320
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
diff
changeset
+ − 321 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
diff
changeset
+ − 322
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
diff
changeset
+ − 323 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
diff
changeset
+ − 324 }
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
diff
changeset
+ − 325
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
diff
changeset
+ − 326
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
diff
changeset
+ − 327 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
diff
changeset
+ − 328 {
929
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
diff
changeset
+ − 329 setCompassHeading(settingsGetPointer()->compassBearing);
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
diff
changeset
+ − 330
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
diff
changeset
+ − 331 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
diff
changeset
+ − 332
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
diff
changeset
+ − 333 return EXIT_TO_HOME;
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
diff
changeset
+ − 334 }
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
diff
changeset
+ − 335
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
diff
changeset
+ − 336
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
diff
changeset
+ − 337 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
diff
changeset
+ − 338 {
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
diff
changeset
+ − 339 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
diff
changeset
+ − 340
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
diff
changeset
+ − 341 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
diff
changeset
+ − 342
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
diff
changeset
+ − 343 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
diff
changeset
+ − 344 }
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
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
diff
changeset
+ − 346
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
diff
changeset
+ − 347 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
diff
changeset
+ − 348 {
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
diff
changeset
+ − 349 SSettings *settings = settingsGetPointer();
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
diff
changeset
+ − 350
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
diff
changeset
+ − 351 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
diff
changeset
+ − 352 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
diff
changeset
+ − 353 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
diff
changeset
+ − 354
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
diff
changeset
+ − 355 uint16_t heading;
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
diff
changeset
+ − 356 if (settings->compassInertia) {
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
diff
changeset
+ − 357 heading = (uint16_t)compass_getCompensated();
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
diff
changeset
+ − 358 } else {
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
diff
changeset
+ − 359 heading = (uint16_t)stateUsed->lifeData.compass_heading;
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
diff
changeset
+ − 360 }
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
diff
changeset
+ − 361 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
diff
changeset
+ − 362 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
diff
changeset
+ − 363
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
diff
changeset
+ − 364 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
diff
changeset
+ − 365 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
diff
changeset
+ − 366 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
diff
changeset
+ − 367 } 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
diff
changeset
+ − 368 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
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
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
diff
changeset
+ − 371 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
diff
changeset
+ − 372 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
diff
changeset
+ − 373 if (headingIsSet) {
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
diff
changeset
+ − 374 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
diff
changeset
+ − 375 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
diff
changeset
+ − 376 } 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
diff
changeset
+ − 377 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
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
diff
changeset
+ − 379 } 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
diff
changeset
+ − 380 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
diff
changeset
+ − 381 }
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
diff
changeset
+ − 382
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
diff
changeset
+ − 383 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
diff
changeset
+ − 384 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
diff
changeset
+ − 385 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
diff
changeset
+ − 386 if (canSetBearing) {
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
diff
changeset
+ − 387 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
diff
changeset
+ − 388 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
diff
changeset
+ − 389 } 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
diff
changeset
+ − 390 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
diff
changeset
+ − 391 }
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
diff
changeset
+ − 392 } 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
diff
changeset
+ − 393 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
diff
changeset
+ − 394 }
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
diff
changeset
+ − 395
929
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
diff
changeset
+ − 396 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
diff
changeset
+ − 397 if (!isRefresh) {
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
diff
changeset
+ − 398 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
diff
changeset
+ − 399 } else {
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
diff
changeset
+ − 400 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
diff
changeset
+ − 401 }
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
diff
changeset
+ − 402
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
diff
changeset
+ − 403 if (headingIsSet) {
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
diff
changeset
+ − 404 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
diff
changeset
+ − 405 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
diff
changeset
+ − 406 }
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
diff
changeset
+ − 407
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
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
diff
changeset
+ − 409 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
diff
changeset
+ − 410 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
diff
changeset
+ − 411 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
diff
changeset
+ − 412 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
diff
changeset
+ − 413 }
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
diff
changeset
+ − 414
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
diff
changeset
+ − 415 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
diff
changeset
+ − 416 }
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
diff
changeset
+ − 417
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
diff
changeset
+ − 418
38
+ − 419 void refresh_CompassHeading(void)
+ − 420 {
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
diff
changeset
+ − 421 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
diff
changeset
+ − 422 }
38
+ − 423
+ − 424
+ − 425 void openEdit_CompassHeading(void)
+ − 426 {
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
diff
changeset
+ − 427 drawCompassHeadingMenu(false);
38
+ − 428 }
+ − 429
+ − 430
+ − 431 uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 432 {
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
diff
changeset
+ − 433 setCompassHeading((uint16_t)stateUsed->lifeData.compass_heading);
38
+ − 434 exitMenuEdit_to_Home_with_Menu_Update();
+ − 435 return EXIT_TO_HOME;
+ − 436 }
654
+ − 437
710
+ − 438
+ − 439 uint8_t OnAction_ScrubberTimerId(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 440 {
+ − 441 char text[32];
+ − 442 SSettings *pSettings;
+ − 443 pSettings = settingsGetPointer();
+ − 444
+ − 445 if(pSettings->scubberActiveId == 0)
+ − 446 {
+ − 447 pSettings->scubberActiveId = 1;
+ − 448 }
+ − 449 else
+ − 450 {
+ − 451 pSettings->scubberActiveId = 0;
+ − 452 }
+ − 453
+ − 454
+ − 455 snprintf(&text[0], 32,"%c \002#%d",TXT_ScrubTime,pSettings->scubberActiveId);
+ − 456 tMenuEdit_newButtonText(StMXTRA_ScrubTimer, text);
+ − 457
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 458 printScrubberResetText(text, pSettings);
710
+ − 459 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_Reset, text);
+ − 460
+ − 461 tMenuEdit_newInput(StMXTRA_ScrubTimer_Max, pSettings->scrubberData[pSettings->scubberActiveId].TimerMax, 0, 0, 0);
+ − 462
+ − 463 if(pSettings->scrubberData[pSettings->scubberActiveId].lastDive.WeekDay != 0)
+ − 464 {
+ − 465 snprintf(&text[0], 32,"%c%c\002 %02d.%02d.%02d", TXT_2BYTE, TXT2BYTE_SimDiveTime, pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Date,
+ − 466 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Month,
+ − 467 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.Year);
+ − 468 }
+ − 469 else
+ − 470 {
+ − 471 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime);
+ − 472 }
+ − 473 clean_content( 20, 780, ME_Y_LINE4, &FontT48);
+ − 474 write_label_var( 20, 780, ME_Y_LINE4, &FontT48, text);
+ − 475
+ − 476 return UNSPECIFIC_RETURN;
+ − 477 }
+ − 478
+ − 479 static uint8_t OnAction_ScrubberTimerMax(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
654
+ − 480 {
+ − 481 SSettings *pSettings;
+ − 482 uint8_t digitContentNew = EXIT_TO_MENU;
+ − 483 uint32_t newScrubberTime;
+ − 484
+ − 485 if(action == ACTION_BUTTON_ENTER)
+ − 486 {
+ − 487 return digitContent;
+ − 488 }
+ − 489 if(action == ACTION_BUTTON_ENTER_FINAL)
+ − 490 {
+ − 491 evaluateNewString(editId, &newScrubberTime, 0, 0, 0);
+ − 492
+ − 493 if(newScrubberTime > MAX_SCRUBBER_TIME)
+ − 494 newScrubberTime = MAX_SCRUBBER_TIME;
+ − 495
+ − 496 pSettings = settingsGetPointer();
710
+ − 497 pSettings->scrubberData[pSettings->scubberActiveId].TimerMax = newScrubberTime;
+ − 498 if(pSettings->scrubberData[pSettings->scubberActiveId].TimerCur > newScrubberTime)
654
+ − 499 {
710
+ − 500 pSettings->scrubberData[pSettings->scubberActiveId].TimerCur = newScrubberTime;
654
+ − 501 }
+ − 502
+ − 503 tMenuEdit_newInput(editId, newScrubberTime, 0, 0, 0);
707
+ − 504 digitContentNew = UNSPECIFIC_RETURN;
654
+ − 505 }
+ − 506 if(action == ACTION_BUTTON_NEXT)
+ − 507 {
+ − 508 digitContentNew = digitContent + 1;
+ − 509 if(digitContentNew > '9')
+ − 510 digitContentNew = '0';
+ − 511 }
+ − 512 if(action == ACTION_BUTTON_BACK)
+ − 513 {
+ − 514 digitContentNew = digitContent - 1;
+ − 515 if(digitContentNew < '0')
+ − 516 digitContentNew = '9';
+ − 517 }
+ − 518 return digitContentNew;
+ − 519 }
707
+ − 520
+ − 521 uint8_t OnAction_ScrubberReset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 522 {
+ − 523 char text[32];
+ − 524 SSettings *pSettings;
+ − 525 pSettings = settingsGetPointer();
710
+ − 526 pSettings->scrubberData[pSettings->scubberActiveId].TimerCur = pSettings->scrubberData[pSettings->scubberActiveId].TimerMax;
+ − 527 pSettings->scrubberData[pSettings->scubberActiveId].lastDive.WeekDay = 0; /* invalidate date */
707
+ − 528
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
diff
changeset
+ − 529 printScrubberResetText(text, pSettings);
710
+ − 530 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_Reset, text);
+ − 531
+ − 532 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime);
+ − 533 clean_content( 20, 780, ME_Y_LINE4, &FontT48);
+ − 534 write_label_var( 20, 780, ME_Y_LINE4, &FontT48, text);
+ − 535
707
+ − 536
+ − 537 return UNSPECIFIC_RETURN;
+ − 538 }
+ − 539
+ − 540 uint8_t OnAction_ScrubberMode(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 541 {
+ − 542 char text[32];
+ − 543 uint8_t newMode;
+ − 544 SSettings *pSettings;
+ − 545 pSettings = settingsGetPointer();
+ − 546 newMode = pSettings->scrubTimerMode + 1;
+ − 547 if(newMode >= SCRUB_TIMER_END)
+ − 548 {
+ − 549 newMode = SCRUB_TIMER_OFF;
+ − 550 }
+ − 551 pSettings->scrubTimerMode = newMode;
+ − 552
+ − 553 switch(pSettings->scrubTimerMode)
+ − 554 {
+ − 555 case SCRUB_TIMER_OFF:
+ − 556 default: snprintf(&text[0], 32,"%c\002%c%c",TXT_ScrubTimeMode, TXT_2BYTE, TXT2BYTE_MoCtrlNone );
+ − 557 break;
+ − 558 case SCRUB_TIMER_MINUTES: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Minutes );
+ − 559 break;
+ − 560 case SCRUB_TIMER_PERCENT: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Percent );
+ − 561 break;
+ − 562 }
+ − 563 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_OP_Mode, text);
+ − 564
+ − 565 return UNSPECIFIC_RETURN;
+ − 566 }
+ − 567
662
+ − 568 #ifdef ENABLE_PSCR_MODE
+ − 569 static uint8_t OnAction_PSCRO2Drop(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 570 {
+ − 571 SSettings *pSettings;
+ − 572 uint8_t digitContentNew = EXIT_TO_MENU;
+ − 573 uint32_t newO2Drop;
654
+ − 574
662
+ − 575 if(action == ACTION_BUTTON_ENTER)
+ − 576 {
+ − 577 return digitContent;
+ − 578 }
+ − 579 if(action == ACTION_BUTTON_ENTER_FINAL)
+ − 580 {
+ − 581 evaluateNewString(editId, &newO2Drop, 0, 0, 0);
+ − 582
+ − 583 if(newO2Drop > PSCR_MAX_O2_DROP)
+ − 584 newO2Drop = PSCR_MAX_O2_DROP;
+ − 585
+ − 586 pSettings = settingsGetPointer();
+ − 587 pSettings->pscr_o2_drop = newO2Drop;
+ − 588
+ − 589 tMenuEdit_newInput(editId, newO2Drop, 0, 0, 0);
793
+ − 590 digitContentNew = UPDATE_DIVESETTINGS;
662
+ − 591 }
+ − 592 if(action == ACTION_BUTTON_NEXT)
+ − 593 {
+ − 594 digitContentNew = digitContent + 1;
+ − 595 if(digitContentNew > '9')
+ − 596 digitContentNew = '0';
+ − 597 }
+ − 598 if(action == ACTION_BUTTON_BACK)
+ − 599 {
+ − 600 digitContentNew = digitContent - 1;
+ − 601 if(digitContentNew < '0')
+ − 602 digitContentNew = '9';
+ − 603 }
+ − 604 return digitContentNew;
+ − 605 }
+ − 606
+ − 607 static uint8_t OnAction_PSCRLungRation(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 608 {
+ − 609 SSettings *pSettings;
+ − 610 uint8_t digitContentNew = EXIT_TO_MENU;
+ − 611 uint32_t newLungRatio;
+ − 612
+ − 613 if(action == ACTION_BUTTON_ENTER)
+ − 614 {
+ − 615 return digitContent;
+ − 616 }
+ − 617 if(action == ACTION_BUTTON_ENTER_FINAL)
+ − 618 {
+ − 619 evaluateNewString(editId, &newLungRatio, 0, 0, 0);
+ − 620
+ − 621 if(newLungRatio > PSCR_MAX_LUNG_RATIO)
+ − 622 newLungRatio = PSCR_MAX_LUNG_RATIO;
+ − 623
+ − 624 if(newLungRatio < PSCR_MIN_LUNG_RATIO)
+ − 625 newLungRatio = PSCR_MIN_LUNG_RATIO;
+ − 626
+ − 627 pSettings = settingsGetPointer();
+ − 628 pSettings->pscr_lung_ratio = newLungRatio;
+ − 629
+ − 630 tMenuEdit_newInput(editId, newLungRatio, 0, 0, 0);
793
+ − 631 digitContentNew = UPDATE_DIVESETTINGS;
662
+ − 632 }
+ − 633 if(action == ACTION_BUTTON_NEXT)
+ − 634 {
+ − 635 digitContentNew = digitContent + 1;
+ − 636 if(digitContentNew > '9')
+ − 637 digitContentNew = '0';
+ − 638 }
+ − 639 if(action == ACTION_BUTTON_BACK)
+ − 640 {
+ − 641 digitContentNew = digitContent - 1;
+ − 642 if(digitContentNew < '0')
+ − 643 digitContentNew = '9';
+ − 644 }
+ − 645 return digitContentNew;
+ − 646 }
+ − 647 #endif
+ − 648
+ − 649