Rework Horus BL handling (#5800)

This commit is contained in:
3djc
2018-04-03 23:05:27 +02:00
committed by Bertrand Songis
parent 329b753df5
commit b02344ffc5
3 changed files with 11 additions and 3 deletions
+2 -1
View File
@@ -360,7 +360,8 @@ bool menuRadioSetup(event_t event)
case ITEM_SETUP_BACKLIGHT_MODE:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MODE);
g_eeGeneral.backlightMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_VBLMODE, g_eeGeneral.backlightMode, e_backlight_mode_off, e_backlight_mode_on, attr, event);
if (attr & INVERS) g_eeGeneral.backlightMode = checkIncDec(event, g_eeGeneral.backlightMode, e_backlight_mode_keys, e_backlight_mode_on, EE_GENERAL);
lcdDrawTextAtIndex(RADIO_SETUP_2ND_COLUMN, y, STR_VBLMODE, g_eeGeneral.backlightMode, attr);
break;
case ITEM_SETUP_FLASH_BEEP:
+8 -1
View File
@@ -31,7 +31,7 @@ void backlightInit()
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(BACKLIGHT_GPIO, &GPIO_InitStructure);
GPIO_PinAFConfig(BACKLIGHT_GPIO, BACKLIGHT_GPIO_PinSource, BACKLIGHT_GPIO_AF);
// TIMER init
#if defined(PCBX12S)
if (IS_HORUS_PROD()) {
@@ -77,4 +77,11 @@ void backlightEnable(uint8_t dutyCycle)
#elif defined(PCBX10)
BACKLIGHT_TIMER->CCR3 = BACKLIGHT_LEVEL_MAX - dutyCycle;
#endif
if (dutyCycle == 0) {
BACKLIGHT_TIMER->BDTR &= ~TIM_BDTR_MOE;
}
else if ((BACKLIGHT_TIMER->BDTR & TIM_BDTR_MOE) == 0) {
BACKLIGHT_TIMER->BDTR |= TIM_BDTR_MOE;
}
}
+1 -1
View File
@@ -465,7 +465,7 @@ void backlightEnable(uint8_t dutyCycle);
#define BACKLIGHT_LEVEL_MIN 46
#endif
#define BACKLIGHT_ENABLE() backlightEnable(unexpectedShutdown ? BACKLIGHT_LEVEL_MAX : BACKLIGHT_LEVEL_MAX-g_eeGeneral.backlightBright)
#define BACKLIGHT_DISABLE() backlightEnable(unexpectedShutdown ? BACKLIGHT_LEVEL_MAX : g_eeGeneral.blOffBright)
#define BACKLIGHT_DISABLE() backlightEnable(unexpectedShutdown ? BACKLIGHT_LEVEL_MAX : (g_eeGeneral.blOffBright == BACKLIGHT_LEVEL_MIN) ? 0 : g_eeGeneral.blOffBright)
#define isBacklightEnabled() true
#if !defined(SIMU)