From 4cd00a0a976a8a8032724457dd8eaebb690efc31 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Fri, 5 Apr 2024 06:28:51 +0200 Subject: [PATCH] Improve BackLt (35/63) --- app/action.c | 4 ++-- app/app.c | 2 +- app/menu.c | 2 +- driver/backlight.c | 7 ++----- helper/battery.c | 2 +- main.c | 2 +- settings.c | 2 +- ui/menu.c | 8 ++------ 8 files changed, 11 insertions(+), 18 deletions(-) diff --git a/app/action.c b/app/action.c index 1f6afcb..c91879b 100644 --- a/app/action.c +++ b/app/action.c @@ -504,7 +504,7 @@ void ACTION_BackLightOnDemand(void) if(gBackLight == false) { gBacklightTimeOriginal = gEeprom.BACKLIGHT_TIME; - gEeprom.BACKLIGHT_TIME = 17; + gEeprom.BACKLIGHT_TIME = 61; gBackLight = true; } else @@ -515,7 +515,7 @@ void ACTION_BackLightOnDemand(void) } else { - gEeprom.BACKLIGHT_TIME = 17; + gEeprom.BACKLIGHT_TIME = 61; } } diff --git a/app/app.c b/app/app.c index a23ca02..65d8a56 100644 --- a/app/app.c +++ b/app/app.c @@ -1483,7 +1483,7 @@ void APP_TimeSlice500ms(void) // don't turn off backlight if user is in backlight menu option && !(gScreenToDisplay == DISPLAY_MENU && (UI_MENU_GetCurrentMenuId() == MENU_ABR || UI_MENU_GetCurrentMenuId() == MENU_ABR_MAX)) && --gBacklightCountdown_500ms == 0 - && gEeprom.BACKLIGHT_TIME < 17 + && gEeprom.BACKLIGHT_TIME < 61 ) { BACKLIGHT_TurnOff(); } diff --git a/app/menu.c b/app/menu.c index 533ba32..de8eb1e 100644 --- a/app/menu.c +++ b/app/menu.c @@ -129,7 +129,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) case MENU_ABR: //*pMin = 0; - *pMax = 17; + *pMax = 61; break; case MENU_ABR_MIN: diff --git a/driver/backlight.c b/driver/backlight.c index 79a093b..c072ef5 100644 --- a/driver/backlight.c +++ b/driver/backlight.c @@ -110,13 +110,10 @@ void BACKLIGHT_TurnOn(void) switch (gEeprom.BACKLIGHT_TIME) { default: - case 1 ... 11: // 5 sec * value + case 1 ... 60: // 5 sec * value gBacklightCountdown_500ms = 1 + (gEeprom.BACKLIGHT_TIME * 5) * 2; break; - case 12 ... 16: // 1 min $ value - gBacklightCountdown_500ms = 1 + ((gEeprom.BACKLIGHT_TIME - 11) * 60) * 2; - break; - case 17: // always on + case 61: // always on gBacklightCountdown_500ms = 0; break; } diff --git a/helper/battery.c b/helper/battery.c index f000a4a..c5ee465 100644 --- a/helper/battery.c +++ b/helper/battery.c @@ -219,7 +219,7 @@ void BATTERY_TimeSlice500ms(void) ST7565_HardwareReset(); - if (gEeprom.BACKLIGHT_TIME < 17) { + if (gEeprom.BACKLIGHT_TIME < 61) { BACKLIGHT_TurnOff(); } } diff --git a/main.c b/main.c index 5e71a79..90fc23b 100644 --- a/main.c +++ b/main.c @@ -151,7 +151,7 @@ void Main(void) { FUNCTION_Select(FUNCTION_POWER_SAVE); - if (gEeprom.BACKLIGHT_TIME < 17) // backlight is not set to be always on + if (gEeprom.BACKLIGHT_TIME < 61) // backlight is not set to be always on BACKLIGHT_TurnOff(); // turn the backlight OFF else BACKLIGHT_TurnOn(); // turn the backlight ON diff --git a/settings.c b/settings.c index 77cd2c0..5524f8e 100644 --- a/settings.c +++ b/settings.c @@ -67,7 +67,7 @@ void SETTINGS_InitEEPROM(void) gEeprom.CROSS_BAND_RX_TX = (Data[2] < 3) ? Data[2] : CROSS_BAND_OFF; gEeprom.BATTERY_SAVE = (Data[3] < 5) ? Data[3] : 4; gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A; - gEeprom.BACKLIGHT_TIME = (Data[5] < 18) ? Data[5] : 3; + gEeprom.BACKLIGHT_TIME = (Data[5] < 62) ? Data[5] : 12; gEeprom.TAIL_TONE_ELIMINATION = (Data[6] < 2) ? Data[6] : false; gEeprom.VFO_OPEN = (Data[7] < 2) ? Data[7] : true; diff --git a/ui/menu.c b/ui/menu.c index 3b85c2f..c96b765 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -662,13 +662,9 @@ void UI_DisplayMenu(void) { sprintf(String, "%s", "OFF"); } - else if(gSubMenuSelection < 12) + else if(gSubMenuSelection < 61) { - sprintf(String, "%d sec", gSubMenuSelection * 5); - } - else if(gSubMenuSelection < 17) - { - sprintf(String, "%d min", gSubMenuSelection - 11); + sprintf(String, "%02dm:%02ds", (((gSubMenuSelection) * 5) / 60), (((gSubMenuSelection) * 5) % 60)); } else {