1
0
Fork 0

Get rid of USB_LED_SCROLL_LOCK (#21405)

This commit is contained in:
Ryan 2023-07-03 04:24:22 +10:00 committed by GitHub
parent 9dbad1fa5c
commit 7ff80a57cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 399 additions and 479 deletions

View file

@ -87,27 +87,27 @@ static void render_status(void) {
// Host Keyboard LED Status
oled_set_cursor(0, 1);
static uint8_t persistent_led_state = 0;
uint8_t led_usb_state = host_keyboard_leds();
static led_t persistent_led_state = {0};
led_t led_state = host_keyboard_led_state();
// Only update if the LED state has changed
// Otherwise, the OLED will not turn off if an LED is on.
if (persistent_led_state != led_usb_state) {
persistent_led_state = led_usb_state;
if (persistent_led_state != led_state) {
persistent_led_state = led_state;
oled_write_ln_P(PSTR(""), false);
if (IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK)) {
if (led_state.caps_lock) {
oled_set_cursor(0, 1);
oled_write_P(PSTR("CAPS"), false);
}
if (IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK)) {
if (led_state.num_lock) {
oled_set_cursor(5, 1);
oled_write_P(PSTR("NUM"), true);
}
if (IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK)) {
if (led_state.scroll_lock) {
oled_set_cursor(9, 1);
oled_write_P(PSTR("SCR"), false);
}

View file

@ -114,27 +114,27 @@ static void render_status(void) {
// Host Keyboard LED Status
oled_set_cursor(0, 1);
static uint8_t persistent_led_state = 0;
uint8_t led_usb_state = host_keyboard_leds();
static led_t persistent_led_state = {0};
led_t led_state = host_keyboard_led_state();
// Only update if the LED state has changed
// Otherwise, the OLED will not turn off if an LED is on.
if (persistent_led_state != led_usb_state) {
persistent_led_state = led_usb_state;
if (persistent_led_state != led_state) {
persistent_led_state = led_state;
oled_write_ln_P(PSTR(""), false);
if (IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK)) {
if (led_state.caps_lock) {
oled_set_cursor(0, 1);
oled_write_P(PSTR("CAPS"), false);
}
if (IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK)) {
if (led_state.num_lock) {
oled_set_cursor(5, 1);
oled_write_P(PSTR("NUM"), true);
}
if (IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK)) {
if (led_state.scroll_lock) {
oled_set_cursor(9, 1);
oled_write_P(PSTR("SCR"), false);
}

View file

@ -94,27 +94,27 @@ static void render_status(void) {
// Host Keyboard LED Status
oled_set_cursor(0, 1);
static uint8_t persistent_led_state = 0;
uint8_t led_usb_state = host_keyboard_leds();
static led_t persistent_led_state = {0};
led_t led_state = host_keyboard_led_state();
// Only update if the LED state has changed
// Otherwise, the OLED will not turn off if an LED is on.
if (persistent_led_state != led_usb_state) {
persistent_led_state = led_usb_state;
if (persistent_led_state != led_state) {
persistent_led_state = led_state;
oled_write_ln_P(PSTR(" "), false);
if (IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK)) {
if (led_state.caps_lock) {
oled_set_cursor(0, 1);
oled_write_P(PSTR("CAPS"), false);
}
if (IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK)) {
if (led_state.num_lock) {
oled_set_cursor(5, 1);
oled_write_P(PSTR("NUM"), true);
}
if (IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK)) {
if (led_state.scroll_lock) {
oled_set_cursor(9, 1);
oled_write_P(PSTR("SCR"), false);
}

View file

@ -179,13 +179,13 @@ static void render_wpm_counters(uint8_t current_wpm) {
static void render_led_status(void) {
// Host Keyboard LED Status
uint8_t led_usb_state = host_keyboard_leds();
led_t led_state = host_keyboard_led_state();
oled_set_cursor(0, 8);
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK) ? PSTR(CAPLCK_STR) : PSTR(EMPTY_STR), false);
oled_write_P(led_state.caps_lock ? PSTR(CAPLCK_STR) : PSTR(EMPTY_STR), false);
oled_set_cursor(0, 9);
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK) ? PSTR(NUMLCK_STR) : PSTR(EMPTY_STR), false);
oled_write_P(led_state.num_lock ? PSTR(NUMLCK_STR) : PSTR(EMPTY_STR), false);
oled_set_cursor(0, 10);
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK) ? PSTR(SCRLK_STR) : PSTR(EMPTY_STR), false);
oled_write_P(led_state.scroll_lock ? PSTR(SCRLK_STR) : PSTR(EMPTY_STR), false);
}
// Update WPM snail icon