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
This commit is contained in:
parent
72f93e7fc2
commit
10cdd00751
1 changed files with 6 additions and 6 deletions
|
@ -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 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) {
|
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 = ' ';
|
key_name = ' ';
|
||||||
last_keycode = keycode;
|
last_keycode = keycode;
|
||||||
if (IS_QK_MOD_TAP(keycode)) {
|
if (IS_QK_MOD_TAP(keycode)) {
|
||||||
|
@ -92,8 +96,6 @@ static void set_keylog(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
|
||||||
// update keylog
|
// update keylog
|
||||||
key_name = pgm_read_byte(&code_to_name[keycode]);
|
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) {
|
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) {
|
static void oled_render_keylog(void) {
|
||||||
const char *last_row_str = get_u8_str(last_row, ' ');
|
oled_write_char('0' + last_row, false);
|
||||||
oled_write(depad_str(last_row_str, ' '), false);
|
|
||||||
oled_write_P(PSTR("x"), false);
|
oled_write_P(PSTR("x"), false);
|
||||||
const char *last_col_str = get_u8_str(last_col, ' ');
|
oled_write_char('0' + last_col, false);
|
||||||
oled_write(depad_str(last_col_str, ' '), false);
|
|
||||||
oled_write_P(PSTR(", k"), false);
|
oled_write_P(PSTR(", k"), false);
|
||||||
const char *last_keycode_str = get_u16_str(last_keycode, ' ');
|
const char *last_keycode_str = get_u16_str(last_keycode, ' ');
|
||||||
oled_write(depad_str(last_keycode_str, ' '), false);
|
oled_write(depad_str(last_keycode_str, ' '), false);
|
||||||
|
|
Loading…
Reference in a new issue