0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-05-19 00:11:18 +03:00

Backlight improvement when set to off

This commit is contained in:
OneOfEleven 2023-09-20 13:01:08 +01:00
parent 1424ce8401
commit fd7f09a3ff
6 changed files with 27 additions and 22 deletions

View File

@ -1825,9 +1825,10 @@ void APP_TimeSlice500ms(void)
#endif
{
if (gBacklightCountdown > 0)
if (--gBacklightCountdown == 0)
if (gEeprom.BACKLIGHT < 5)
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn backlight off
if (gScreenToDisplay != DISPLAY_MENU || gMenuCursor != MENU_ABR) // don't turn off backlight if user is in backlight menu option
if (--gBacklightCountdown == 0)
if (gEeprom.BACKLIGHT < 5)
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn backlight off
#ifdef ENABLE_AIRCOPY
if (gScanState == SCAN_OFF && gScreenToDisplay != DISPLAY_AIRCOPY && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
@ -1847,6 +1848,12 @@ void APP_TimeSlice500ms(void)
{
if (--gVoltageMenuCountdown == 0)
{
if (gEeprom.BACKLIGHT == 0 && gScreenToDisplay == DISPLAY_MENU)
{
gBacklightCountdown = 0;
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
}
if (gInputBoxIndex > 0 || gDTMF_InputMode || gScreenToDisplay == DISPLAY_MENU)
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);

View File

@ -518,8 +518,6 @@ void MENU_AcceptSetting(void)
break;
case MENU_ABR:
gEeprom.BACKLIGHT = 1; // turn the light on to let them find there way around for a bit
BACKLIGHT_TurnOn();
gEeprom.BACKLIGHT = gSubMenuSelection;
break;
@ -908,15 +906,10 @@ void MENU_ShowCurrentSetting(void)
break;
case MENU_ABR:
if (gEeprom.BACKLIGHT == 0)
{ // turn the light on so the user can see the screen
const uint8_t value = gEeprom.BACKLIGHT;
gEeprom.BACKLIGHT = 1;
BACKLIGHT_TurnOn();
gEeprom.BACKLIGHT = value; // restore the setting
}
gSubMenuSelection = gEeprom.BACKLIGHT;
gBacklightCountdown = 0;
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight ON while in backlight menu
break;
case MENU_TDR:
@ -1287,6 +1280,12 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
#endif
gRequestDisplayScreen = DISPLAY_MAIN;
if (gEeprom.BACKLIGHT == 0)
{
gBacklightCountdown = 0;
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
}
}
else
{
@ -1597,6 +1596,13 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
gMenuCursor = NUMBER_AddWithWraparound(gMenuCursor, -Direction, 0, gMenuListCount - 1);
gFlagRefreshSetting = true;
gRequestDisplayScreen = DISPLAY_MENU;
if (gMenuCursor != MENU_ABR && gEeprom.BACKLIGHT == 0)
{
gBacklightCountdown = 0;
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
}
return;
}
@ -1632,7 +1638,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
bCheckScanList = true;
break;
default:
default:
MENU_ClampSelection(Direction);
gRequestDisplayScreen = DISPLAY_MENU;
return;

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -395,14 +395,6 @@ void UI_DisplayMenu(void)
break;
case MENU_ABR:
if (gEeprom.BACKLIGHT == 0)
{ // turn the light on so the user can see the screen
const uint8_t value = gEeprom.BACKLIGHT;
gEeprom.BACKLIGHT = 1;
BACKLIGHT_TurnOn();
gEeprom.BACKLIGHT = value; // restore the setting
}
strcpy(String, gSubMenu_BACK_LIGHT[gSubMenuSelection]);
break;