fix led issue

This commit is contained in:
lokher 2023-04-20 15:51:23 +08:00
parent 4555003019
commit 103badc87c
2 changed files with 19 additions and 12 deletions

View File

@ -476,7 +476,7 @@ void indicator_task(void) {
}
#if defined(LED_MATRIX_ENABLE) || defined(RGB_MATRIX_ENABLE)
static void os_state_indicate(void) {
__attribute__((weak)) void os_state_indicate(void) {
# if defined(NUM_LOCK_INDEX)
if (host_keyboard_led_state().num_lock) {
SET_LED_ON(NUM_LOCK_INDEX);
@ -559,18 +559,24 @@ bool LED_INDICATORS_KB(void) {
}
bool led_update_kb(led_t led_state) {
if (!LED_DRIVER_IS_ENABLED()) {
# if defined(LED_MATRIX_DRIVER_SHUTDOWN_ENABLE) || defined(RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE)
LED_DRIVER.exit_shutdown();
# endif
SET_ALL_LED_OFF();
os_state_indicate();
LED_DRIVER.flush();
# if defined(LED_MATRIX_DRIVER_SHUTDOWN_ENABLE) || defined(RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE)
if (LED_DRIVER_ALLOW_SHUTDOWN()) LED_DRIVER.shutdown();
# endif
bool res = led_update_user(led_state);
if (res) {
led_update_ports(led_state);
if (!LED_DRIVER_IS_ENABLED()) {
# if defined(LED_MATRIX_DRIVER_SHUTDOWN_ENABLE) || defined(RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE)
LED_DRIVER.exit_shutdown();
# endif
SET_ALL_LED_OFF();
os_state_indicate();
LED_DRIVER.flush();
# if defined(LED_MATRIX_DRIVER_SHUTDOWN_ENABLE) || defined(RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE)
if (LED_DRIVER_ALLOW_SHUTDOWN()) LED_DRIVER.shutdown();
# endif
}
}
return true;
return res;
}
void LED_NONE_INDICATORS_KB(void) {

View File

@ -106,6 +106,7 @@ void indicator_stop(void);
void indicator_eeconfig_reload(void);
bool indicator_is_enabled(void);
bool indicator_is_running(void);
void os_state_indicate(void);
#ifdef BAT_LOW_LED_PIN
void indicator_battery_low_enable(bool enable);