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