sm1000_main: Clamp warn period to time-out period.
authorsjlongland <sjlongland@01035d8c-6547-0410-b346-abe4f91aad63>
Sat, 24 Oct 2015 23:13:16 +0000 (23:13 +0000)
committersjlongland <sjlongland@01035d8c-6547-0410-b346-abe4f91aad63>
Sat, 24 Oct 2015 23:13:16 +0000 (23:13 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2473 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/stm32/src/sm1000_main.c

index 93da72d8c255dbfaa37f7283d5c37663b30f7c7e..b7dff1d87d0e508413bb391fdb1d1364e49a38e2 100644 (file)
@@ -992,7 +992,10 @@ static void menu_tot_warn_cb(struct menu_t* const menu, uint32_t event)
         case MENU_EVT_ENTERED:
             sfx_play(&sfx_player, sound_startup);
             /* Get the current period */
-            menu->current = prefs.tot_warn_period;
+            if (prefs.tot_warn_period < prefs.tot_period)
+                menu->current = prefs.tot_warn_period;
+            else
+                menu->current = prefs.tot_period;
         case MENU_EVT_RETURNED:
             /* Shouldn't happen, but we handle it anyway */
             announce = 1;
@@ -1000,7 +1003,7 @@ static void menu_tot_warn_cb(struct menu_t* const menu, uint32_t event)
         case MENU_EVT_NEXT:
             sfx_play(&sfx_player, sound_click);
             /* Adjust the frequency up by 50 Hz */
-            if (prefs.tot_warn_period < 600)
+            if (prefs.tot_warn_period < prefs.tot_period)
                 prefs.tot_warn_period += 5;
             announce = 1;
             break;