summaryrefslogtreecommitdiff
path: root/keyboards/crkbd
diff options
context:
space:
mode:
authorJohn Barbero <john@lsrkttn.com>2023-11-09 02:55:08 +0100
committerGitHub <noreply@github.com>2023-11-09 01:55:08 +0000
commit10cdd007515788c3bd95bbe3b485f14548f7fb31 (patch)
tree5437c51fe087a0fbdb9bfa0894f5c56d328bbc42 /keyboards/crkbd
parent72f93e7fc2f6eae29c4b4a5a0875714c48e1a69b (diff)
Fix corne keylog (#22420)
* [Keyboard] Fix bug in set_keylog function Fixes issue where some keys would not trigger the oled to output the row and column of a pressed key (would happen with LT(...) for my keymap) * [Keyboard] Tiny improvement to oled_render_keylog for crkbd Added improvement suggestion I got for another keyboard
Diffstat (limited to 'keyboards/crkbd')
-rw-r--r--keyboards/crkbd/crkbd.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/keyboards/crkbd/crkbd.c b/keyboards/crkbd/crkbd.c
index 3c1cd5565b..2ac0e63125 100644
--- a/keyboards/crkbd/crkbd.c
+++ b/keyboards/crkbd/crkbd.c
@@ -71,6 +71,10 @@ uint8_t last_col;
static const char PROGMEM code_to_name[60] = {' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\', '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '};
static void set_keylog(uint16_t keycode, keyrecord_t *record) {
+ // save the row and column (useful even if we can't find a keycode to show)
+ last_row = record->event.key.row;
+ last_col = record->event.key.col;
+
key_name = ' ';
last_keycode = keycode;
if (IS_QK_MOD_TAP(keycode)) {
@@ -92,8 +96,6 @@ static void set_keylog(uint16_t keycode, keyrecord_t *record) {
// update keylog
key_name = pgm_read_byte(&code_to_name[keycode]);
- last_row = record->event.key.row;
- last_col = record->event.key.col;
}
static const char *depad_str(const char *depad_str, char depad_char) {
@@ -103,11 +105,9 @@ static const char *depad_str(const char *depad_str, char depad_char) {
}
static void oled_render_keylog(void) {
- const char *last_row_str = get_u8_str(last_row, ' ');
- oled_write(depad_str(last_row_str, ' '), false);
+ oled_write_char('0' + last_row, false);
oled_write_P(PSTR("x"), false);
- const char *last_col_str = get_u8_str(last_col, ' ');
- oled_write(depad_str(last_col_str, ' '), false);
+ oled_write_char('0' + last_col, false);
oled_write_P(PSTR(", k"), false);
const char *last_keycode_str = get_u16_str(last_keycode, ' ');
oled_write(depad_str(last_keycode_str, ' '), false);