Simu: add support for backlight off

This commit is contained in:
Raphael Coeffic
2022-06-13 22:43:45 +02:00
committed by Raphael Coeffic
parent 3ae39a3050
commit dc75b4916d
6 changed files with 68 additions and 44 deletions
+1 -2
View File
@@ -329,8 +329,7 @@ void boardOff()
bool isBacklightEnabled()
{
if(globalData.unexpectedShutdown)
return true;
if (globalData.unexpectedShutdown) return true;
return boardBacklightOn;
}
+16 -8
View File
@@ -557,16 +557,24 @@ void backlightEnable(uint8_t dutyCycle = 0);
#else
#define BACKLIGHT_LEVEL_MIN 46
#endif
#if defined(SIMU)
#define BACKLIGHT_ENABLE()
#define BACKLIGHT_DISABLE()
#define isBacklightEnabled(...) true
#else
extern bool boardBacklightOn;
#define BACKLIGHT_ENABLE() {boardBacklightOn = true; backlightEnable(globalData.unexpectedShutdown ? BACKLIGHT_LEVEL_MAX : BACKLIGHT_LEVEL_MAX - currentBacklightBright);}
#define BACKLIGHT_DISABLE() {boardBacklightOn = false; backlightEnable(globalData.unexpectedShutdown ? BACKLIGHT_LEVEL_MAX : ((g_eeGeneral.blOffBright == BACKLIGHT_LEVEL_MIN) && (g_eeGeneral.backlightMode != e_backlight_mode_off)) ? 0 : g_eeGeneral.blOffBright);}
#define BACKLIGHT_ENABLE() \
{ \
boardBacklightOn = true; \
backlightEnable(globalData.unexpectedShutdown \
? BACKLIGHT_LEVEL_MAX \
: BACKLIGHT_LEVEL_MAX - currentBacklightBright); \
}
#define BACKLIGHT_DISABLE() \
{ \
boardBacklightOn = false; \
backlightEnable(globalData.unexpectedShutdown ? BACKLIGHT_LEVEL_MAX \
: ((g_eeGeneral.blOffBright == BACKLIGHT_LEVEL_MIN) && \
(g_eeGeneral.backlightMode != e_backlight_mode_off)) \
? 0 \
: g_eeGeneral.blOffBright); \
}
bool isBacklightEnabled();
#endif
#if !defined(SIMU)
void usbJoystickUpdate();