From 26508214753fdbb23bc4123475a8e86e2c876ef8 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Mon, 28 Jun 2021 08:57:18 +0200 Subject: [PATCH] Fix timer countdown time setting Resolves #358 --- radio/src/gui/128x64/model_setup.cpp | 11 +++++++---- radio/src/gui/212x64/model_setup.cpp | 12 +++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/radio/src/gui/128x64/model_setup.cpp b/radio/src/gui/128x64/model_setup.cpp index 08f1072c1..9a5f4bd69 100644 --- a/radio/src/gui/128x64/model_setup.cpp +++ b/radio/src/gui/128x64/model_setup.cpp @@ -240,7 +240,10 @@ inline uint8_t MODULE_SUBTYPE_ROWS(int moduleIdx) } #define POT_WARN_ROWS ((g_model.potsWarnMode) ? (uint8_t)(NUM_POTS+NUM_SLIDERS) : (uint8_t)0) -#define TIMER_ROWS 1, 0, 1, 0, 0, 0 +#define TIMER_ROWS(x) \ + 1, 0, 1, 0, 0, \ + g_model.timers[x].countdownBeep != COUNTDOWN_SILENT ? (uint8_t)1 \ + : (uint8_t)0 #if defined(PCBSKY9X) #define EXTRA_MODULE_ROWS LABEL(ExtraModule), 1, 2, @@ -411,9 +414,9 @@ void menuModelSetup(event_t event) MENU_TAB({ HEADER_LINE_COLUMNS 0, - TIMER_ROWS, - TIMER_ROWS, - TIMER_ROWS, + TIMER_ROWS(0), + TIMER_ROWS(1), + TIMER_ROWS(2), 0, // Extended limits 1, // Extended trims 0, // Show trims diff --git a/radio/src/gui/212x64/model_setup.cpp b/radio/src/gui/212x64/model_setup.cpp index 86878a30b..5b187a545 100644 --- a/radio/src/gui/212x64/model_setup.cpp +++ b/radio/src/gui/212x64/model_setup.cpp @@ -275,8 +275,10 @@ void editTimerCountdown(int timerIdx, coord_t y, LcdFlags attr, event_t event) #define TRAINER_ROWS LABEL(Trainer), 0, TRAINER_CHANNELS_ROW, TRAINER_PPM_PARAMS_ROW #endif -#define TIMER_ROWS \ - 1 | NAVIGATION_LINE_BY_LINE, 0, 1 | NAVIGATION_LINE_BY_LINE, 0, 0, 0 +#define TIMER_ROWS(x) \ + 1 | NAVIGATION_LINE_BY_LINE, 0, 1 | NAVIGATION_LINE_BY_LINE, 0, 0, \ + g_model.timers[x].countdownBeep != COUNTDOWN_SILENT ? (uint8_t)1 \ + : (uint8_t)0 inline uint8_t EXTERNAL_MODULE_TYPE_ROW() { @@ -287,11 +289,11 @@ inline uint8_t EXTERNAL_MODULE_TYPE_ROW() } #if TIMERS == 1 - #define TIMERS_ROWS TIMER_ROWS +#define TIMERS_ROWS TIMER_ROWS(0) #elif TIMERS == 2 - #define TIMERS_ROWS TIMER_ROWS, TIMER_ROWS +#define TIMERS_ROWS TIMER_ROWS(0), TIMER_ROWS(1) #elif TIMERS == 3 - #define TIMERS_ROWS TIMER_ROWS, TIMER_ROWS, TIMER_ROWS +#define TIMERS_ROWS TIMER_ROWS(0), TIMER_ROWS(1), TIMER_ROWS(2) #endif #if defined(PCBX9E) #define SW_WARN_ROWS uint8_t(NAVIGATION_LINE_BY_LINE|(getSwitchWarningsCount()-1)), uint8_t(getSwitchWarningsCount() > 8 ? TITLE_ROW : HIDDEN_ROW), uint8_t(getSwitchWarningsCount() > 16 ? TITLE_ROW : HIDDEN_ROW)