Make ParseConfig() restore indicator icons. Fixes #107
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
uint8_t IconsAndLayerTextsBrightness = 0xff;
|
||||
uint8_t AlphanumericSegmentsBrightness = 0xff;
|
||||
bool ledIconStates[LedDisplayIcon_Last];
|
||||
|
||||
static const uint16_t capitalLetterToSegmentMap[] = {
|
||||
0b0000000011110111,
|
||||
@@ -108,5 +109,13 @@ bool LedDisplay_GetIcon(led_display_icon_t icon)
|
||||
|
||||
void LedDisplay_SetIcon(led_display_icon_t icon, bool isEnabled)
|
||||
{
|
||||
LedDriverValues[LedDriverId_Left][8 + icon] = isEnabled ? IconsAndLayerTextsBrightness : 0;
|
||||
ledIconStates[icon] = isEnabled;
|
||||
LedDriverValues[LedDriverId_Left][icon + 8] = isEnabled ? IconsAndLayerTextsBrightness : 0;
|
||||
}
|
||||
|
||||
void LedDisplay_UpdateIcons(void)
|
||||
{
|
||||
for (uint8_t i=0; i<=LedDisplayIcon_Last; i++) {
|
||||
LedDisplay_SetIcon(i, ledIconStates[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
LedDisplayIcon_CapsLock,
|
||||
LedDisplayIcon_Agent,
|
||||
LedDisplayIcon_Adaptive,
|
||||
LedDisplayIcon_Last = LedDisplayIcon_Adaptive,
|
||||
} led_display_icon_t;
|
||||
|
||||
// Variables:
|
||||
@@ -25,8 +26,8 @@
|
||||
void LedDisplay_SetText(uint8_t length, const char* text);
|
||||
void LedDisplay_SetCurrentKeymapText(void);
|
||||
void LedDisplay_SetLayer(layer_id_t layerId);
|
||||
void LedDisplay_SetIcon(led_display_icon_t icon, bool isEnabled);
|
||||
|
||||
bool LedDisplay_GetIcon(led_display_icon_t icon);
|
||||
void LedDisplay_SetIcon(led_display_icon_t icon, bool isEnabled);
|
||||
void LedDisplay_UpdateIcons(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -74,9 +74,7 @@ void LedSlaveDriver_Init(uint8_t ledDriverId)
|
||||
memset(LedDriverValues[ledDriverId], KeyBacklightBrightness, LED_DRIVER_LED_COUNT);
|
||||
|
||||
if (ledDriverId == LedDriverId_Left) {
|
||||
LedDisplay_SetIcon(LedDisplayIcon_CapsLock, false);
|
||||
LedDisplay_SetIcon(LedDisplayIcon_Agent, false);
|
||||
LedDisplay_SetIcon(LedDisplayIcon_Adaptive, false);
|
||||
LedDisplay_UpdateIcons();
|
||||
LedDisplay_SetCurrentKeymapText();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,14 +165,9 @@ static usb_device_class_config_list_struct_t UsbDeviceCompositeConfigList = {
|
||||
|
||||
bool IsHostSleeping = false;
|
||||
static uint8_t oldKeyBacklightBrightness = 0xFF;
|
||||
static bool capsLockOn = false, agentOn = false, adaptiveOn = false;
|
||||
|
||||
static void suspendHost(void) {
|
||||
IsHostSleeping = true;
|
||||
// Save the state of the icons
|
||||
capsLockOn = LedDisplay_GetIcon(LedDisplayIcon_CapsLock);
|
||||
agentOn = LedDisplay_GetIcon(LedDisplayIcon_Agent);
|
||||
adaptiveOn = LedDisplay_GetIcon(LedDisplayIcon_Adaptive);
|
||||
|
||||
// Disable keyboard backlight
|
||||
oldKeyBacklightBrightness = KeyBacklightBrightness;
|
||||
@@ -204,9 +199,7 @@ void WakeUpHost(bool sendResume) {
|
||||
LedDisplay_SetLayer(GetActiveLayer());
|
||||
|
||||
// Restore icon states
|
||||
LedDisplay_SetIcon(LedDisplayIcon_CapsLock, capsLockOn);
|
||||
LedDisplay_SetIcon(LedDisplayIcon_Agent, agentOn);
|
||||
LedDisplay_SetIcon(LedDisplayIcon_Adaptive, adaptiveOn);
|
||||
LedDisplay_UpdateIcons();
|
||||
}
|
||||
|
||||
static usb_status_t usbDeviceCallback(usb_device_handle handle, uint32_t event, void *param)
|
||||
|
||||
Reference in New Issue
Block a user