diff 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
line wrap: on
line diff
--- a/Discovery/Src/settings.c	Thu Aug 10 21:35:34 2023 +0200
+++ b/Discovery/Src/settings.c	Mon Aug 21 17:20:07 2023 +0200
@@ -337,6 +337,7 @@
 	.buttonLockActive = 0,
     .compassDeclinationDeg = 0,
     .delaySetpointLow = false,
+    .timerDurationS = 180,
 };
 
 /* Private function prototypes -----------------------------------------------*/
@@ -544,6 +545,9 @@
         // Disable auto setpoint to avoid a configuration warning being triggered by the new auto setpoint validation
         // This ensures that users don't lose setpoint information if it is not in the right spot for the new configuration
         pSettings->autoSetpoint = false;
+
+        pSettings->timerDurationS = pStandard->timerDurationS;
+
     	// no break;
     case 0xFFFF0026:
     	pSettings->ext_sensor_map[0] = pSettings->ext_sensor_map_Obsolete[0];
@@ -554,7 +558,8 @@
     	pSettings->ext_sensor_map[5] = SENSOR_NONE;
     	pSettings->ext_sensor_map[6] = SENSOR_NONE;
     	pSettings->ext_sensor_map[7] = SENSOR_NONE;
-    	// no break;
+
+        // no break;
     default:
         pSettings->header = pStandard->header;
         break; // no break before!!
@@ -1621,6 +1626,16 @@
         corrections++;
     }
 
+    if (Settings.timerDurationS > 599) {
+        Settings.timerDurationS = 599;
+
+        corrections++;
+    } else if (Settings.timerDurationS < 1) {
+        Settings.timerDurationS = 1;
+
+        corrections++;
+    }
+
     if(corrections)
     {
     	settingsWarning = 1;