From 75946def7eda2c56ce278d7e6f1c93031b2ddc66 Mon Sep 17 00:00:00 2001 From: Darkhan Kubigenov Date: Sun, 29 Jan 2023 00:56:55 +0000 Subject: [PATCH 1/2] Prevent LED flicker when connecting the keyboard The current implementation enables LEDs and then sets mode to manual. Because of this, [shine firmware](https://github.com/OpenAnnePro/AnnePro2-Shine) initially starts it own LED profiles and after processing next message switches to manual mode where LEDs are controlled by QMK. The effect of this is that for less than a second, keyboard lights up all white and then switches to QMK profile. The adjustment makes sure that no Shine profile logic is used at all. --- keyboards/annepro2/annepro2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/annepro2/annepro2.c b/keyboards/annepro2/annepro2.c index e1292b351720..ec69a8bd77d1 100644 --- a/keyboards/annepro2/annepro2.c +++ b/keyboards/annepro2/annepro2.c @@ -104,8 +104,8 @@ void keyboard_post_init_kb(void) { ap2_led_get_status(); #ifdef RGB_MATRIX_ENABLE - ap2_led_enable(); ap2_led_set_manual_control(1); + ap2_led_enable(); #endif keyboard_post_init_user(); From b264f939042ac567aadf70ef42e914b627b9c190 Mon Sep 17 00:00:00 2001 From: Darkhan Kubigenov Date: Sun, 29 Jan 2023 01:18:23 +0000 Subject: [PATCH 2/2] Remove unhandled CMD_LED_GET_STATUS command Shine currently does not respond to CMD_LED_GET_STATUS. This is probably leftover code from previous refactoring. Shine logic does send status when any of the commands "update" its status. So no separate "getStatus" is necessary. --- keyboards/annepro2/annepro2.c | 2 -- keyboards/annepro2/ap2_led.c | 2 -- keyboards/annepro2/ap2_led.h | 1 - keyboards/annepro2/protocol.h | 2 +- 4 files changed, 1 insertion(+), 6 deletions(-) diff --git a/keyboards/annepro2/annepro2.c b/keyboards/annepro2/annepro2.c index ec69a8bd77d1..170eb8c175aa 100644 --- a/keyboards/annepro2/annepro2.c +++ b/keyboards/annepro2/annepro2.c @@ -101,8 +101,6 @@ void keyboard_post_init_kb(void) { // loop to clear out receive buffer from ble wakeup while (!sdGetWouldBlock(&SD1)) sdGet(&SD1); - ap2_led_get_status(); - #ifdef RGB_MATRIX_ENABLE ap2_led_set_manual_control(1); ap2_led_enable(); diff --git a/keyboards/annepro2/ap2_led.c b/keyboards/annepro2/ap2_led.c index c1d7c8166e88..70585a511fcb 100644 --- a/keyboards/annepro2/ap2_led.c +++ b/keyboards/annepro2/ap2_led.c @@ -60,8 +60,6 @@ void ap2_led_enable(void) { proto_tx(CMD_LED_ON, NULL, 0, 3); } void ap2_led_set_profile(uint8_t prof) { proto_tx(CMD_LED_SET_PROFILE, &prof, sizeof(prof), 3); } -void ap2_led_get_status(void) { proto_tx(CMD_LED_GET_STATUS, NULL, 0, 3); } - void ap2_led_next_profile(void) { proto_tx(CMD_LED_NEXT_PROFILE, NULL, 0, 3); } void ap2_led_next_intensity(void) { proto_tx(CMD_LED_NEXT_INTENSITY, NULL, 0, 3); } diff --git a/keyboards/annepro2/ap2_led.h b/keyboards/annepro2/ap2_led.h index ff2a05aff51d..494ada54ec22 100644 --- a/keyboards/annepro2/ap2_led.h +++ b/keyboards/annepro2/ap2_led.h @@ -49,7 +49,6 @@ void ap2_set_IAP(void); void ap2_led_disable(void); void ap2_led_enable(void); void ap2_led_set_profile(uint8_t prof); -void ap2_led_get_status(void); void ap2_led_next_profile(void); void ap2_led_prev_profile(void); void ap2_led_next_intensity(void); diff --git a/keyboards/annepro2/protocol.h b/keyboards/annepro2/protocol.h index d38fd0a66ef7..0211ccefc455 100644 --- a/keyboards/annepro2/protocol.h +++ b/keyboards/annepro2/protocol.h @@ -36,7 +36,7 @@ enum { CMD_LED_MASK_SET_MONO = 0x12, /* Reactive / status */ - CMD_LED_GET_STATUS = 0x20, + CMD_LED_GET_STATUS = 0x20, /* unused */ CMD_LED_KEY_BLINK = 0x21, CMD_LED_KEY_DOWN = 0x22, CMD_LED_KEY_UP = 0x23, /* TODO */