comparison Discovery/Src/settings.c @ 805:dd7ce655db26

Adds a simple countdown timer, available as a custom view in surface and dive mode. This can be used to time safety stops, or to prebreathe a CCR (or to boil your breakfast eggs if you are so inclined). The duration of the timer is configurable from 1 second to 9:59 minutes in the System menu. The timer is started by switching to the custom view, and remaining on it until a 10 second delay has elapsed. Once the timer has started the custom view can be changed and the timer will continue running in the background. After the timer has run out 'Finished' will be shown for 10 seconds in the timer custom view, and then automatic switching of custom views (if configured) resumes. In surface mode the dive computer will not go to sleep while the timer is running, and a mini timer will be shown when the timer custom view is not showing. (mikeller)
author heinrichsweikamp
date Mon, 21 Aug 2023 17:20:07 +0200
parents ff66b41d6fe4
children 9e2ebfc72e8c
comparison
equal deleted inserted replaced
804:391b3d420a39 805:dd7ce655db26
335 .ext_sensor_map[6] = SENSOR_NONE, 335 .ext_sensor_map[6] = SENSOR_NONE,
336 .ext_sensor_map[7] = SENSOR_NONE, 336 .ext_sensor_map[7] = SENSOR_NONE,
337 .buttonLockActive = 0, 337 .buttonLockActive = 0,
338 .compassDeclinationDeg = 0, 338 .compassDeclinationDeg = 0,
339 .delaySetpointLow = false, 339 .delaySetpointLow = false,
340 .timerDurationS = 180,
340 }; 341 };
341 342
342 /* Private function prototypes -----------------------------------------------*/ 343 /* Private function prototypes -----------------------------------------------*/
343 uint8_t checkValue(uint8_t value,uint8_t from, uint8_t to); 344 uint8_t checkValue(uint8_t value,uint8_t from, uint8_t to);
344 345
542 pSettings->compassDeclinationDeg = pStandard->compassDeclinationDeg; 543 pSettings->compassDeclinationDeg = pStandard->compassDeclinationDeg;
543 pSettings->delaySetpointLow = pStandard->delaySetpointLow; 544 pSettings->delaySetpointLow = pStandard->delaySetpointLow;
544 // Disable auto setpoint to avoid a configuration warning being triggered by the new auto setpoint validation 545 // Disable auto setpoint to avoid a configuration warning being triggered by the new auto setpoint validation
545 // This ensures that users don't lose setpoint information if it is not in the right spot for the new configuration 546 // This ensures that users don't lose setpoint information if it is not in the right spot for the new configuration
546 pSettings->autoSetpoint = false; 547 pSettings->autoSetpoint = false;
548
549 pSettings->timerDurationS = pStandard->timerDurationS;
550
547 // no break; 551 // no break;
548 case 0xFFFF0026: 552 case 0xFFFF0026:
549 pSettings->ext_sensor_map[0] = pSettings->ext_sensor_map_Obsolete[0]; 553 pSettings->ext_sensor_map[0] = pSettings->ext_sensor_map_Obsolete[0];
550 pSettings->ext_sensor_map[1] = pSettings->ext_sensor_map_Obsolete[1]; 554 pSettings->ext_sensor_map[1] = pSettings->ext_sensor_map_Obsolete[1];
551 pSettings->ext_sensor_map[2] = pSettings->ext_sensor_map_Obsolete[2]; 555 pSettings->ext_sensor_map[2] = pSettings->ext_sensor_map_Obsolete[2];
552 pSettings->ext_sensor_map[3] = pSettings->ext_sensor_map_Obsolete[3]; 556 pSettings->ext_sensor_map[3] = pSettings->ext_sensor_map_Obsolete[3];
553 pSettings->ext_sensor_map[4] = pSettings->ext_sensor_map_Obsolete[4]; 557 pSettings->ext_sensor_map[4] = pSettings->ext_sensor_map_Obsolete[4];
554 pSettings->ext_sensor_map[5] = SENSOR_NONE; 558 pSettings->ext_sensor_map[5] = SENSOR_NONE;
555 pSettings->ext_sensor_map[6] = SENSOR_NONE; 559 pSettings->ext_sensor_map[6] = SENSOR_NONE;
556 pSettings->ext_sensor_map[7] = SENSOR_NONE; 560 pSettings->ext_sensor_map[7] = SENSOR_NONE;
557 // no break; 561
562 // no break;
558 default: 563 default:
559 pSettings->header = pStandard->header; 564 pSettings->header = pStandard->header;
560 break; // no break before!! 565 break; // no break before!!
561 } 566 }
562 } 567 }
1615 Settings.compassDeclinationDeg = 99; 1620 Settings.compassDeclinationDeg = 99;
1616 1621
1617 corrections++; 1622 corrections++;
1618 } else if (Settings.compassDeclinationDeg < -99) { 1623 } else if (Settings.compassDeclinationDeg < -99) {
1619 Settings.compassDeclinationDeg = -99; 1624 Settings.compassDeclinationDeg = -99;
1625
1626 corrections++;
1627 }
1628
1629 if (Settings.timerDurationS > 599) {
1630 Settings.timerDurationS = 599;
1631
1632 corrections++;
1633 } else if (Settings.timerDurationS < 1) {
1634 Settings.timerDurationS = 1;
1620 1635
1621 corrections++; 1636 corrections++;
1622 } 1637 }
1623 1638
1624 if(corrections) 1639 if(corrections)