From dfcb569a132c0869ef3d137db33379f77e4f6b6f Mon Sep 17 00:00:00 2001 From: Marius Alwan Meyer <22202402+sporqist@users.noreply.github.com> Date: Sat, 3 Jun 2023 20:45:02 +0200 Subject: [PATCH] overhaul oled code; set render function at startup; set OLED_UPDATE_INTERVAL to FRAME_TIMEOUT; use smaller data types; formatting --- .../splitkb/aurora/corne/keymaps/sporq/oled.c | 128 ++++++++++-------- 1 file changed, 74 insertions(+), 54 deletions(-) diff --git a/keyboards/splitkb/aurora/corne/keymaps/sporq/oled.c b/keyboards/splitkb/aurora/corne/keymaps/sporq/oled.c index 5b1c61eb61..8714511a02 100644 --- a/keyboards/splitkb/aurora/corne/keymaps/sporq/oled.c +++ b/keyboards/splitkb/aurora/corne/keymaps/sporq/oled.c @@ -14,19 +14,12 @@ enum layers { }; static uint16_t animation_timer = 0; -// 40 fps -#define FRAME_TIMEOUT (1000/40) +#define FRAME_TIMEOUT (1000/60) +#undef OLED_UPDATE_INTERVAL +#define OLED_UPDATE_INTERVAL FRAME_TIMEOUT // 30 sec #define SLEEP_TIMEOUT 30000 -oled_rotation_t oled_init_user(oled_rotation_t rotation) { - if (!is_keyboard_master()) { - return OLED_ROTATION_0; - } - return OLED_ROTATION_270; - animation_timer = timer_read(); -} - // Spaceship OLED starts here // code made by JBaguley and copied from crkbd/keymaps/retrograde/keymap.c @@ -230,47 +223,49 @@ static const char PROGMEM mask_row_4[] = { }; static void render_space_animation(void) { - const char wpm = get_current_wpm(); + const uint8_t wpm = get_current_wpm(); + const uint8_t wpm_div = wpm / 4; char render_row[128]; - int i; - oled_set_cursor(0,0); - for(i=0; i