Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[keyboard] Prevent LED flicker when connecting AnnePro 2 #19709

Merged
merged 2 commits into from
Mar 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions keyboards/annepro2/annepro2.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,9 @@ 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_enable();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the line that is causing flicker on my keyboard. It enables lighting profiles first followed by the call to enable manual control. It is possible to prevent flicker by defaulting to manual control enabled in Shine but I believe that the adjustment should be done here.

Another issue that is fixed by this PR - if I disable LEDs, disconnect the keyboard then it will light up momentarily before shutting down LEDs during the next connection.

ap2_led_set_manual_control(1);
ap2_led_enable();
#endif

keyboard_post_init_user();
Expand Down
2 changes: 0 additions & 2 deletions keyboards/annepro2/ap2_led.c
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand Down
1 change: 0 additions & 1 deletion keyboards/annepro2/ap2_led.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion keyboards/annepro2/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down