From 3a3e5abac992712a8bb4e9b61430f5fc62dc6043 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Wed, 31 May 2023 11:44:06 -0700 Subject: [Keymap] Drashna Keymap updates for 0.21.0 (#21073) --- users/drashna/oled/oled_stuff.c | 421 ++++++++++++++-------------------------- 1 file changed, 151 insertions(+), 270 deletions(-) (limited to 'users/drashna/oled/oled_stuff.c') diff --git a/users/drashna/oled/oled_stuff.c b/users/drashna/oled/oled_stuff.c index 98506247df..d232e90fb2 100644 --- a/users/drashna/oled/oled_stuff.c +++ b/users/drashna/oled/oled_stuff.c @@ -16,6 +16,10 @@ */ #include "drashna.h" +#include +#include +#include +#include "lib/lib8tion/lib8tion.h" #ifdef UNICODE_COMMON_ENABLE # include "process_unicode_common.h" # include "keyrecords/unicode.h" @@ -23,42 +27,39 @@ #ifdef AUDIO_CLICKY # include "process_clicky.h" #endif -#include -bool is_oled_enabled = true, is_oled_locked = false; +#ifndef OLED_BRIGHTNESS_STEP +# define OLED_BRIGHTNESS_STEP 32 +#endif -extern bool host_driver_disabled; +bool is_oled_enabled = true, is_oled_locked = false, is_oled_force_off = false; -uint32_t oled_timer = 0; -char keylog_str[OLED_KEYLOGGER_LENGTH] = {0}; -static uint16_t log_timer = 0; -#ifdef OLED_DISPLAY_VERBOSE -const char PROGMEM display_border[3] = {0x0, 0xFF, 0x0}; -#endif +uint32_t oled_timer = 0; +char oled_keylog_str[OLED_KEYLOGGER_LENGTH + 1] = {0}; deferred_token kittoken; -// clang-format off -static const char PROGMEM code_to_name[256] = { -// 0 1 2 3 4 5 6 7 8 9 A B c D E F - ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', // 0x - 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', // 1x - '3', '4', '5', '6', '7', '8', '9', '0', 20, 19, 27, 26, 22, '-', '=', '[', // 2x - ']','\\', '#', ';','\'', '`', ',', '.', '/', 128,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA, // 3x - 0xDB,0xDC,0xDD,0xDE,0XDF,0xFB,'P', 'S', 19, ' ', 17, 30, 16, 16, 31, 26, // 4x - 27, 25, 24, 'N', '/', '*', '-', '+', 23, '1', '2', '3', '4', '5', '6', '7', // 5x - '8', '9', '0', '.','\\', 'A', 0, '=', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 6x - ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 7x - ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 8x - ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 9x - ' ', ' ', ' ', ' ', ' ', 0, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ax - ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Bx - ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Cx - ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Dx - 'C', 'S', 'A', 'C', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 24, 26, 24, // Ex - 25,0x9D,0x9D,0x9D,0x9D,0x9D,0x9D,0x9D,0x9D, 24, 25, 27, 26, ' ', ' ', ' ' // Fx -}; -// clang-format on +extern uint8_t oled_buffer[OLED_MATRIX_SIZE]; +extern OLED_BLOCK_TYPE oled_dirty; + +void oled_pan_section(bool left, uint16_t y_start, uint16_t y_end, uint16_t x_start, uint16_t x_end) { + uint16_t i = 0; + for (uint16_t y = y_start; y < y_end; y++) { + if (left) { + for (uint16_t x = x_start; x < x_end - 1; x++) { + i = y * OLED_DISPLAY_WIDTH + x; + oled_buffer[i] = oled_buffer[i + 1]; + oled_dirty |= ((OLED_BLOCK_TYPE)1 << (i / OLED_BLOCK_SIZE)); + } + } else { + for (uint16_t x = x_end - 1; x > 0; x--) { + i = y * OLED_DISPLAY_WIDTH + x; + oled_buffer[i] = oled_buffer[i - 1]; + oled_dirty |= ((OLED_BLOCK_TYPE)1 << (i / OLED_BLOCK_SIZE)); + } + } + } +} /** * @brief parses pressed keycodes and saves to buffer @@ -67,32 +68,34 @@ static const char PROGMEM code_to_name[256] = { * @param record keyrecord_t data structure */ void add_keylog(uint16_t keycode, keyrecord_t *record) { - if (keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) { - keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode); - } else if (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) { - keycode = QK_LAYER_TAP_GET_TAP_KEYCODE(keycode); - } else if (keycode >= QK_MODS && keycode <= QK_MODS_MAX) { - keycode = QK_MODS_GET_BASIC_KEYCODE(keycode); + if (IS_QK_MOD_TAP(keycode)) { + if (record->tap.count) { + keycode = keycode_config(QK_MOD_TAP_GET_TAP_KEYCODE(keycode)); + } else { + keycode = keycode_config(0xE0 + biton(QK_MOD_TAP_GET_MODS(keycode) & 0xF) + biton(QK_MOD_TAP_GET_MODS(keycode) & 0x10)); + } + } else if (IS_QK_LAYER_TAP(keycode) && record->tap.count) { + keycode = keycode_config(QK_LAYER_TAP_GET_TAP_KEYCODE(keycode)); + } else if (IS_QK_MODS(keycode)) { + keycode = keycode_config(QK_MODS_GET_BASIC_KEYCODE(keycode)); + } else if (IS_QK_ONE_SHOT_MOD(keycode)) { + keycode = keycode_config(0xE0 + biton(QK_ONE_SHOT_MOD_GET_MODS(keycode) & 0xF) + biton(QK_ONE_SHOT_MOD_GET_MODS(keycode) & 0x10)); + } else if (IS_QK_BASIC(keycode)) { + keycode = keycode_config(keycode); } if ((keycode == KC_BSPC) && mod_config(get_mods() | get_oneshot_mods()) & MOD_MASK_CTRL) { - memset(keylog_str, ' ', OLED_KEYLOGGER_LENGTH); - keylog_str[OLED_KEYLOGGER_LENGTH-1] = 0x00; - return; - } - if (record->tap.count) { - keycode &= 0xFF; - } else if (keycode > 0xFF) { + memset(oled_keylog_str, ' ', OLED_KEYLOGGER_LENGTH); + oled_keylog_str[OLED_KEYLOGGER_LENGTH] = 0x00; return; } - memmove(keylog_str, keylog_str + 1, OLED_KEYLOGGER_LENGTH - 2); - - if (keycode < ARRAY_SIZE(code_to_name)) { - keylog_str[(OLED_KEYLOGGER_LENGTH - 2)] = pgm_read_byte(&code_to_name[keycode]); + if (keycode > ARRAY_SIZE(code_to_name)) { + return; } - log_timer = timer_read(); + memmove(oled_keylog_str, oled_keylog_str + 1, OLED_KEYLOGGER_LENGTH - 1); + oled_keylog_str[(OLED_KEYLOGGER_LENGTH - 1)] = pgm_read_byte(&code_to_name[keycode]); } /** @@ -107,15 +110,25 @@ void add_keylog(uint16_t keycode, keyrecord_t *record) { */ bool process_record_user_oled(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { - oled_timer_reset(); add_keylog(keycode, record); + if (keycode == OLED_BRIGHTNESS_INC) { + userspace_config.oled_brightness = qadd8(userspace_config.oled_brightness, OLED_BRIGHTNESS_STEP); + oled_set_brightness(userspace_config.oled_brightness); + eeconfig_update_user_config(&userspace_config.raw); + } else if (keycode == OLED_BRIGHTNESS_DEC) { + userspace_config.oled_brightness = qsub8(userspace_config.oled_brightness, OLED_BRIGHTNESS_STEP); + oled_set_brightness(userspace_config.oled_brightness); + eeconfig_update_user_config(&userspace_config.raw); + } else if (keycode == OLED_LOCK) { + is_oled_locked = !is_oled_locked; + if (is_oled_locked) { + oled_on(); + } + } } return true; } -void oled_timer_reset(void) { - oled_timer = timer_read32(); -} /** * @brief Renders keylogger buffer to oled * @@ -125,7 +138,7 @@ void render_keylogger_status(uint8_t col, uint8_t line) { oled_set_cursor(col, line); #endif oled_write_P(PSTR(OLED_RENDER_KEYLOGGER), false); - oled_write(keylog_str, false); + oled_write(oled_keylog_str, false); #ifdef OLED_DISPLAY_VERBOSE oled_advance_page(true); #endif @@ -138,7 +151,18 @@ void render_keylogger_status(uint8_t col, uint8_t line) { void render_default_layer_state(uint8_t col, uint8_t line) { #ifdef OLED_DISPLAY_VERBOSE oled_set_cursor(col, line); -#endif + oled_write_P(PSTR(OLED_RENDER_LAYOUT_NAME), false); + + static char layer_state_buffer[11] = {0}; + static layer_state_t old_state = 0; + + if (old_state != default_layer_state) { + snprintf(layer_state_buffer, sizeof(layer_state_buffer), "%-10s", get_layer_name_string(default_layer_state, false)); + old_state = default_layer_state; + } + oled_write(layer_state_buffer, false); + oled_advance_page(true); +#else oled_write_P(PSTR(OLED_RENDER_LAYOUT_NAME), false); switch (get_highest_layer(default_layer_state)) { case _QWERTY: @@ -154,8 +178,6 @@ void render_default_layer_state(uint8_t col, uint8_t line) { oled_write_P(PSTR(OLED_RENDER_LAYOUT_DVORAK), false); break; } -#ifdef OLED_DISPLAY_VERBOSE - oled_advance_page(true); #endif } @@ -165,114 +187,6 @@ void render_default_layer_state(uint8_t col, uint8_t line) { */ void render_layer_state(uint8_t col, uint8_t line) { #ifdef OLED_DISPLAY_VERBOSE - // clang-format off - static const char PROGMEM tri_layer_image[][3][24] = { - // base - { - { - 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, - 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, - 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, - 0x40, 0x80, 0x80, 0x00, 0x00, 0x00 - }, - { - 0x00, 0x00, 0x00, 0x88, 0x88, 0x5D, - 0x5D, 0x3E, 0x3E, 0x7C, 0x7C, 0xF8, - 0xF8, 0x7C, 0x7C, 0x3E, 0x3E, 0x5D, - 0x5D, 0x88, 0x88, 0x00, 0x00, 0x00 - }, - { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, - 0x08, 0x04, 0x04, 0x02, 0x02, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - } - }, - // raise - { - { - 0x00, 0x00, 0x00, 0x80, 0x80, 0xC0, - 0xC0, 0xE0, 0xE0, 0xF0, 0xF0, 0xF8, - 0xF8, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0, - 0xC0, 0x80, 0x80, 0x00, 0x00, 0x00 - }, - { - 0x00, 0x00, 0x00, 0x88, 0x88, 0x55, - 0x55, 0x23, 0x23, 0x47, 0x47, 0x8F, - 0x8F, 0x47, 0x47, 0x23, 0x23, 0x55, - 0x55, 0x88, 0x88, 0x00, 0x00, 0x00 - }, - { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, - 0x08, 0x04, 0x04, 0x02, 0x02, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - } - }, - // lower - { - { - 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, - 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, - 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, - 0x40, 0x80, 0x80, 0x00, 0x00, 0x00 - }, - { - 0x00, 0x00, 0x00, 0x88, 0x88, 0xD5, - 0xD5, 0xE2, 0xE2, 0xC4, 0xC4, 0x88, - 0x88, 0xC4, 0xC4, 0xE2, 0xE2, 0xD5, - 0xD5, 0x88, 0x88, 0x00, 0x00, 0x00 - }, - { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x01, 0x03, 0x03, 0x07, 0x07, 0x0F, - 0x0F, 0x07, 0x07, 0x03, 0x03, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - } - }, - // adjust - { - { - 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, - 0xC0, 0x60, 0xA0, 0x50, 0xB0, 0x58, - 0xA8, 0x50, 0xB0, 0x60, 0xA0, 0x40, - 0xC0, 0x80, 0x80, 0x00, 0x00, 0x00 - }, - { - 0x00, 0x00, 0x00, 0x88, 0x88, 0x5D, - 0xD5, 0x6B, 0xB6, 0x6D, 0xD6, 0xAD, - 0xDA, 0x6D, 0xD6, 0x6B, 0xB6, 0x5D, - 0xD5, 0x88, 0x88, 0x00, 0x00, 0x00 - }, - { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x01, 0x03, 0x02, 0x05, 0x06, 0x0D, - 0x0A, 0x05, 0x06, 0x03, 0x02, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - } - }, - // blank - { - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } - }, - // better gamepad - { - { 0, 0, 0,192,224,224,112,240,240,240,240,144,144,240,240,240,240,112,224,224,192, 0, 0, 0 }, - { 128,248,255,255,255,254,252,230,195,195,230,255,255,254,247,227,246,253,254,255,255,255,248,128 }, - { 7, 15, 15, 15, 7, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 15, 15, 7 } - - }, - // mouse - { - { 0, 0, 0, 0, 0, 0, 0, 0,192, 32, 32, 32,160, 32, 32, 32,192, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0,240, 15, 0, 0, 0, 3, 0, 0, 0, 15,240, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 3, 6, 4, 4, 4, 4, 4, 4, 4, 6, 3, 0, 0, 0, 0, 0, 0 } - } - }; - - // clang-format on uint8_t layer_is[4] = {0, 4, 4, 4}; if (layer_state_is(_ADJUST)) { layer_is[0] = 3; @@ -376,19 +290,23 @@ void render_mod_status(uint8_t modifiers, uint8_t col, uint8_t line) { static const char PROGMEM mod_status[5][3] = {{0xE8, 0xE9, 0}, {0xE4, 0xE5, 0}, {0xE6, 0xE7, 0}, {0xEA, 0xEB, 0}, {0xEC, 0xED, 0}}; #if defined(OLED_DISPLAY_VERBOSE) oled_set_cursor(col, line); +#endif + bool is_caps = host_keyboard_led_state().caps_lock; +#ifdef CAPS_WORD_ENABLE + is_caps |= is_caps_word_on(); #endif oled_write_P(PSTR(OLED_RENDER_MODS_NAME), false); #if defined(OLED_DISPLAY_VERBOSE) - oled_write_P(mod_status[0], (modifiers & MOD_BIT(KC_LSFT))); + oled_write_P(mod_status[0], (modifiers & MOD_BIT(KC_LSFT)) || is_caps); oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_BIT(KC_LGUI))); oled_write_P(mod_status[2], (modifiers & MOD_BIT(KC_LALT))); oled_write_P(mod_status[1], (modifiers & MOD_BIT(KC_LCTL))); oled_write_P(mod_status[1], (modifiers & MOD_BIT(KC_RCTL))); oled_write_P(mod_status[2], (modifiers & MOD_BIT(KC_RALT))); oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_BIT(KC_RGUI))); - oled_write_P(mod_status[0], (modifiers & MOD_BIT(KC_RSFT))); + oled_write_P(mod_status[0], (modifiers & MOD_BIT(KC_RSFT)) || is_caps); #else - oled_write_P(mod_status[0], (modifiers & MOD_MASK_SHIFT)); + oled_write_P(mod_status[0], (modifiers & MOD_MASK_SHIFT) || is_caps); oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_MASK_GUI)); oled_write_P(PSTR(" "), false); oled_write_P(mod_status[2], (modifiers & MOD_MASK_ALT)); @@ -508,7 +426,7 @@ void render_user_status(uint8_t col, uint8_t line) { static const char PROGMEM rgb_layer_status[2][3] = {{0xEE, 0xEF, 0}, {0xF0, 0xF1, 0}}; oled_write_P(rgb_layer_status[userspace_config.rgb_layer_change], false); static const char PROGMEM cat_mode[2][3] = {{0xF8, 0xF9, 0}, {0xF6, 0xF7, 0}}; - oled_write_P(cat_mode[0], host_driver_disabled); + oled_write_P(cat_mode[0], get_keyboard_lock()); #if defined(UNICODE_COMMON_ENABLE) static const char PROGMEM uc_mod_status[5][3] = {{0xEC, 0xED, 0}, {0x20, 0x20, 0}, {0x20, 0x20, 0}, {0x20, 0x20, 0}, {0xEA, 0xEB, 0}}; oled_write_P(uc_mod_status[get_unicode_input_mode()], false); @@ -538,12 +456,51 @@ void render_rgb_hsv(uint8_t col, uint8_t line) { oled_write_P(PSTR(", "), false); oled_write(get_u8_str(rgb_matrix_get_val(), ' '), false); #elif RGBLIGHT_ENABLE - oled_write(get_u8_str(rgblight_get_hue(), ' '), false); - oled_write_P(PSTR(", "), false); - oled_write(get_u8_str(rgblight_get_sat(), ' '), false); - oled_write_P(PSTR(", "), false); - oled_write(get_u8_str(rgblight_get_val(), ' '), false); + if (is_rgblight_startup_running()) { + oled_write_P(PSTR("Start Animation"), false); + } else { + oled_write(get_u8_str(rgblight_get_hue(), ' '), false); + oled_write_P(PSTR(", "), false); + oled_write(get_u8_str(rgblight_get_sat(), ' '), false); + oled_write_P(PSTR(", "), false); + oled_write(get_u8_str(rgblight_get_val(), ' '), false); + } +#endif +} + +void render_rgb_mode(uint8_t col, uint8_t line) { + oled_set_cursor(col, line); + __attribute__((unused)) static uint8_t mode; + bool need_update = false; + static char buf[21] = {0}; + +#ifdef RGB_MATRIX_ENABLE + if (mode != rgb_matrix_get_mode()) { + snprintf(buf, sizeof(buf), "%-20s", rgb_matrix_name(rgb_matrix_get_mode())); + mode = rgb_matrix_get_mode(); + need_update = true; + } +#elif RGBLIGHT_ENABLE + if (mode != rgblight_get_mode()) { + snprintf(buf, sizeof(buf), "%-20s", rgblight_name(rgblight_get_mode())); + mode = rgblight_get_mode(); + need_update = true; + } #endif + if (need_update) { + for (uint8_t i = 1; i < sizeof(buf); ++i) { + if (buf[i] == 0) + break; + else if (buf[i] == '_') + buf[i] = ' '; + else if (buf[i - 1] == ' ') + buf[i] = toupper(buf[i]); + else if (buf[i - 1] != ' ') + buf[i] = tolower(buf[i]); + } + } + + oled_write(buf, false); } void render_wpm(uint8_t padding, uint8_t col, uint8_t line) { @@ -642,9 +599,6 @@ void render_pointing_dpi_status(uint16_t cpi, uint8_t padding, uint8_t col, uint // #define ANIM_FRAME_DURATION 500 // how long each frame lasts in ms // #define SLEEP_TIMER 60000 // should sleep after this period of 0 wpm, needs fixing -#define OLED_ANIM_SIZE 36 -#define OLED_ANIM_ROWS 4 -#define OLED_ANIM_MAX_FRAMES 3 #if (OLED_SLEEP_FRAMES > OLED_ANIM_MAX_FRAMES) || (OLED_WAKE_FRAMES > OLED_ANIM_MAX_FRAMES) || (OLED_KAKI_FRAMES > OLED_ANIM_MAX_FRAMES) || (OLED_RTOGI_FRAMES > OLED_ANIM_MAX_FRAMES) # error frame size too large #endif @@ -653,81 +607,6 @@ static uint8_t animation_frame = 0; static uint8_t animation_type = 0; void render_kitty(uint8_t col, uint8_t line) { - // Images credit j-inc(/James Incandenza) and pixelbenny. - // Credit to obosob for initial animation approach. - // heavily modified by drashna because he's a glutton for punishment - - // clang-format off - static const char PROGMEM animation[4][OLED_ANIM_MAX_FRAMES][OLED_ANIM_ROWS][OLED_ANIM_SIZE] = { - // sleep frames - { - { - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xa8, 0x48, 0xa8, 0x18, 0x08, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x80, 0x44, 0x84, 0x06, 0x05, 0x04, 0x80, 0x40, 0x20, 0x10, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x18, 0x04, 0x04, 0x02, 0x7a, 0x86, 0x01, 0x80, 0x80, 0x01, 0x03, 0x05, 0x07, 0x01, 0x00, 0x00, 0x80, 0x83, 0x45, 0xfa, 0x3c, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x33, 0x24, 0x28, 0x28, 0x29, 0x29, 0x29, 0x3a, 0x18, 0x1c, 0x39, 0x24, 0x24, 0x3a, 0x2d, 0x26, 0x31, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00 } - }, - { - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x3a, 0x2a, 0x26, 0x22, 0x80, 0xc0, 0x80, 0x00, 0x24, 0x34, 0x2c, 0xe4, 0x60, 0x10, 0x70, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x38, 0x04, 0x02, 0x02, 0x01, 0x79, 0x87, 0x01, 0x80, 0x81, 0x83, 0x05, 0x05, 0x03, 0x01, 0x00, 0x00, 0x80, 0x43, 0x05, 0xfa, 0x3c, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x33, 0x24, 0x28, 0x28, 0x28, 0x29, 0x29, 0x3a, 0x18, 0x1c, 0x39, 0x24, 0x24, 0x3a, 0x2d, 0x26, 0x31, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00 } - } - }, - // wake frames - { - { - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x30, 0x08, 0x10, 0x60, 0x80, 0x00, 0x80, 0x60, 0x10, 0x08, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0x40, 0x40, 0x5c, 0x00, 0x01, 0x41, 0x01, 0x00, 0x5c, 0x40, 0x40, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x80, 0xe1, 0x12, 0x0a, 0x06, 0x00, 0x80, 0x00, 0x06, 0x0a, 0x12, 0xe1, 0x80, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x11, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1c, 0x14, 0x14, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00 } - }, - { - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x30, 0x08, 0x10, 0x60, 0x80, 0x00, 0x80, 0x60, 0x10, 0x08, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x90, 0x12, 0x0a, 0x02, 0xf4, 0x09, 0x0d, 0xf1, 0x04, 0x02, 0x0a, 0x12, 0x90, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x80, 0xe1, 0x12, 0x0a, 0x06, 0x01, 0x81, 0x00, 0x06, 0x0a, 0x12, 0xe1, 0x80, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x11, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1c, 0x14, 0x14, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00 } - } - }, - // kaki frames - { - { - { 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x40, 0x80, 0x80, 0x80, 0x00, 0xfc, 0x84, 0x08, 0x08, 0x10, 0x20, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1e, 0x60, 0x80, 0x00, 0x00, 0x91, 0xa1, 0x80, 0x00, 0x00, 0x22, 0x84, 0x40, 0x50, 0x48, 0xc1, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x41, 0x82, 0xe2, 0x12, 0x0a, 0x06, 0x00, 0x80, 0x88, 0x4f, 0x02, 0x22, 0xe2, 0x9f, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x14, 0x10, 0x10, 0x10, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1a, 0x0a, 0x0a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 } - }, - { - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x06, 0x1a, 0x22, 0xc2, 0x04, 0x04, 0x04, 0x07, 0x00, 0xc0, 0x20, 0x10, 0x80, 0x80, 0x01, 0x01, 0x02, 0xfc, 0xfe, 0x02, 0x3c, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0d, 0x8d, 0x55, 0x50, 0x94, 0xf0, 0x10, 0x09, 0x08, 0x00, 0x80, 0x00, 0x06, 0x09, 0x1b, 0xee, 0x00, 0x00, 0x00, 0x00, 0x81, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x19, 0x18, 0x1c, 0x14, 0x16, 0x15, 0x14, 0x14, 0x14, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00 } - }, - { - { 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x01, 0x02, 0x04, 0x04, 0x03, 0x80, 0x40, 0x40, 0x20, 0x00, 0x01, 0x02, 0x8c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0d, 0x8d, 0x55, 0x50, 0x94, 0xf0, 0x10, 0x0a, 0x0e, 0x1d, 0x95, 0x24, 0x24, 0x27, 0x13, 0xe1, 0x01, 0x01, 0x01, 0x01, 0x02, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x19, 0x18, 0x1c, 0x14, 0x14, 0x17, 0x14, 0x14, 0x14, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00 } - } - }, - // rtogi frames - { - { - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0x0f, 0x90, 0x10, 0x20, 0xf0, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x48, 0x47, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x88, 0xc7, 0xc4, 0x62, 0x23, 0x11, 0x3f, 0x00, 0x00, 0x00, 0x00 }, - { 0x80, 0x40, 0x20, 0x10, 0x88, 0xcc, 0x43, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0, 0x80, 0x80, 0xc0, 0xe1, 0xfe, 0xb8, 0x88, 0x0c, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x07, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } - }, - { - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0x1f, 0xa0, 0x20, 0x40, 0x80, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x48, 0x47, 0x88, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x28, 0x6b, 0x40, 0xa0, 0x99, 0x86, 0xff, 0x00, 0x00, 0x00, 0x00 }, - { 0x0f, 0x11, 0x22, 0x44, 0x48, 0x4c, 0x43, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0, 0x80, 0x80, 0xc0, 0xe1, 0xfe, 0xb8, 0x88, 0x0c, 0x04, 0x06, 0x06, 0x06, 0x0e, 0x0e, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x07, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } - } - } - }; - // clang-format on - for (uint8_t i = 0; i < 4; i++) { oled_set_cursor(col, line + i); oled_write_raw_P(animation[animation_type][animation_frame][i], OLED_ANIM_SIZE); @@ -776,13 +655,6 @@ uint32_t kitty_animation_phases(uint32_t triger_time, void *cb_arg) { void render_mouse_mode(uint8_t col, uint8_t line) { #if (defined(KEYBOARD_bastardkb_charybdis) || defined(KEYBOARD_handwired_tractyl_manuform)) && defined(POINTING_DEVICE_ENABLE) // credit and thanks to jaspertandy on discord for these images - static const char PROGMEM mouse_logo[3][2][16] = {// mouse icon - {{0, 0, 0, 252, 2, 2, 2, 58, 2, 2, 2, 252, 0, 0, 0, 0}, {0, 0, 63, 96, 64, 64, 64, 64, 64, 64, 64, 96, 63, 0, 0, 0}}, - // crosshair icon - {{128, 240, 136, 228, 146, 138, 202, 127, 202, 138, 146, 228, 136, 240, 128, 0}, {0, 7, 8, 19, 36, 40, 41, 127, 41, 40, 36, 19, 8, 7, 0, 0}}, - // dragscroll icon - {{0, 0, 112, 136, 156, 2, 15, 1, 15, 2, 140, 68, 56, 0, 0, 0}, {0, 0, 2, 6, 15, 28, 60, 124, 60, 28, 15, 6, 2, 0, 0, 0}}}; - uint8_t image_index = 0; # ifdef OLED_DISPLAY_TEST image_index = animation_frame; @@ -848,7 +720,18 @@ void render_status_left(void) { } __attribute__((weak)) void oled_render_large_display(bool side) { - if (!side) { + if (side) { + render_rgb_hsv(1, 7); + render_rgb_mode(1, 8); + + render_wpm_graph(48, 72); + } else { + oled_advance_page(true); + oled_advance_page(true); + + oled_set_cursor(0, 9); + oled_write_raw_P(qmk_logo, 384); // is 3 rows of 128 pixels, so 384 bytes. + render_unicode_mode(1, 14); } } @@ -864,7 +747,7 @@ __attribute__((weak)) oled_rotation_t oled_init_keymap(oled_rotation_t rotation) oled_rotation_t oled_init_user(oled_rotation_t rotation) { if (is_keyboard_master()) { - memset(keylog_str, ' ', OLED_KEYLOGGER_LENGTH); + memset(oled_keylog_str, ' ', OLED_KEYLOGGER_LENGTH); } kittoken = defer_exec(3000, kitty_animation_phases, NULL); @@ -894,12 +777,7 @@ bool oled_task_user(void) { } #if defined(OLED_DISPLAY_VERBOSE) - static const char PROGMEM header_image[] = { - 0, 192, 32, 16, 8, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 7, 15, 31, 63, 127, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 63, 31, 15, 7, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 8, 16, 32, 192, 0, - // 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 7, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 7, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, 0 - }; oled_write_raw_P(header_image, sizeof(header_image)); - oled_set_cursor(4, 0); render_oled_title(is_keyboard_left()); #endif @@ -934,7 +812,6 @@ bool oled_task_user(void) { oled_write_raw_P(display_border, sizeof(display_border)); } - static const char PROGMEM footer_image[] = {0, 3, 4, 8, 16, 32, 64, 128, 128, 128, 128, 128, 128, 128, 192, 224, 240, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 240, 224, 192, 128, 128, 128, 128, 128, 128, 128, 64, 32, 16, 8, 4, 3, 0}; oled_set_cursor(0, num_of_rows); oled_write_raw_P(footer_image, sizeof(footer_image)); #endif @@ -942,8 +819,12 @@ bool oled_task_user(void) { return false; } -extern bool oled_initialized; - -__attribute__((weak)) void housekeeping_task_oled(void) { - is_oled_enabled = is_oled_locked ? true : !(timer_elapsed32(oled_timer) > 60000); +void housekeeping_task_oled(void) { + is_oled_enabled = false; + if ((is_oled_locked || (last_input_activity_elapsed() < 60000)) && !is_oled_force_off) { + is_oled_enabled = true; + } + if (oled_get_brightness() != userspace_config.oled_brightness) { + oled_set_brightness(userspace_config.oled_brightness); + } } -- cgit v1.2.3