From 68ceb59e4e2a5c29f4af1a29d68127cafbd03cca Mon Sep 17 00:00:00 2001 From: Drashna Jael're Date: Mon, 23 Mar 2020 17:25:20 -0700 Subject: [PATCH] Additional OLED cleanup --- users/drashna/oled_stuff.c | 51 ++++++++++++++++++++++++++++---------- users/drashna/oled_stuff.h | 8 +++--- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/users/drashna/oled_stuff.c b/users/drashna/oled_stuff.c index e55e37187982..7580de1d33b2 100644 --- a/users/drashna/oled_stuff.c +++ b/users/drashna/oled_stuff.c @@ -34,7 +34,7 @@ static const char PROGMEM code_to_name[0xFF] = { 'C', 'S', 'A', 'C', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ex ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' // Fx }; - +// clang-format on void add_keylog(uint16_t keycode) { if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) || (keycode >= QK_MODS && keycode <= QK_MODS_MAX)) { @@ -64,7 +64,6 @@ bool process_record_user_oled(uint16_t keycode, keyrecord_t *record) { return true; } - void update_log(void) { if (timer_elapsed(log_timer) > 750) { // add_keylog(0); @@ -79,14 +78,30 @@ void render_keylogger_status(void) { void render_default_layer_state(void) { oled_write_P(PSTR(OLED_RENDER_LAYOUT_NAME), false); switch (get_highest_layer(default_layer_state)) { - case _QWERTY: oled_write_P(PSTR(OLED_RENDER_LAYOUT_QWERTY), false); break; - case _COLEMAK: oled_write_P(PSTR(OLED_RENDER_LAYOUT_COLEMAK), false); break; - case _DVORAK: oled_write_P(PSTR(OLED_RENDER_LAYOUT_DVORAK), false); break; - case _WORKMAN: oled_write_P(PSTR(OLED_RENDER_LAYOUT_WORKMAN), false); break; - case _NORMAN: oled_write_P(PSTR(OLED_RENDER_LAYOUT_NORMAN), false); break; - case _MALTRON: oled_write_P(PSTR(OLED_RENDER_LAYOUT_MALTRON), false); break; - case _EUCALYN: oled_write_P(PSTR(OLED_RENDER_LAYOUT_EUCALYN), false); break; - case _CARPLAX: oled_write_P(PSTR(OLED_RENDER_LAYOUT_CARPLAX), false); break; + case _QWERTY: + oled_write_P(PSTR(OLED_RENDER_LAYOUT_QWERTY), false); + break; + case _COLEMAK: + oled_write_P(PSTR(OLED_RENDER_LAYOUT_COLEMAK), false); + break; + case _DVORAK: + oled_write_P(PSTR(OLED_RENDER_LAYOUT_DVORAK), false); + break; + case _WORKMAN: + oled_write_P(PSTR(OLED_RENDER_LAYOUT_WORKMAN), false); + break; + case _NORMAN: + oled_write_P(PSTR(OLED_RENDER_LAYOUT_NORMAN), false); + break; + case _MALTRON: + oled_write_P(PSTR(OLED_RENDER_LAYOUT_MALTRON), false); + break; + case _EUCALYN: + oled_write_P(PSTR(OLED_RENDER_LAYOUT_EUCALYN), false); + break; + case _CARPLAX: + oled_write_P(PSTR(OLED_RENDER_LAYOUT_CARPLAX), false); + break; } #ifdef OLED_DISPLAY_128X64 oled_advance_page(true); @@ -95,9 +110,18 @@ void render_default_layer_state(void) { void render_layer_state(void) { oled_write_P(PSTR(OLED_RENDER_LAYER_NAME), false); +#ifdef OLED_DISPLAY_128X64 + oled_write_P(PSTR(" "), false); +#endif oled_write_P(PSTR(OLED_RENDER_LAYER_LOWER), layer_state_is(_LOWER)); +#ifdef OLED_DISPLAY_128X64 + oled_write_P(PSTR(" "), false); +#endif oled_write_P(PSTR(OLED_RENDER_LAYER_RAISE), layer_state_is(_RAISE)); #if _MODS +# ifdef OLED_DISPLAY_128X64 + oled_write_P(PSTR(" "), false); +# endif oled_write_P(PSTR(OLED_RENDER_LAYER_MODS), layer_state_is(_MODS)); #endif #ifdef OLED_DISPLAY_128X64 @@ -180,8 +204,8 @@ void render_bootmagic_status(void) { oled_write_P(PSTR(" "), false); oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_CAPS), keymap_config.swap_control_capslock); oled_advance_page(true); - #else - oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NKRO), keymap_config.nkro); +#else + oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NKRO), keymap_config.nkro); #endif } @@ -199,11 +223,12 @@ void render_user_status(void) { } __attribute__((weak)) void oled_driver_render_logo(void) { + // clang-format off static const char PROGMEM qmk_logo[] = { 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0}; - + // clang-format on oled_write_P(qmk_logo, false); } diff --git a/users/drashna/oled_stuff.h b/users/drashna/oled_stuff.h index 88a48c2b6066..662e206b7607 100644 --- a/users/drashna/oled_stuff.h +++ b/users/drashna/oled_stuff.h @@ -20,10 +20,10 @@ bool process_record_user_oled(uint16_t keycode, keyrecord_t *record); # define OLED_RENDER_LAYOUT_CARPLAX "Carplax" # define OLED_RENDER_LAYER_NAME "Layer:\n" -# define OLED_RENDER_LAYER_LOWER " Lower" -# define OLED_RENDER_LAYER_RAISE " Raise" -# define OLED_RENDER_LAYER_ADJUST " Adjust" -# define OLED_RENDER_LAYER_MODS " Mods" +# define OLED_RENDER_LAYER_LOWER "Lower" +# define OLED_RENDER_LAYER_RAISE "Raise" +# define OLED_RENDER_LAYER_ADJUST "Adjust" +# define OLED_RENDER_LAYER_MODS "Mods" # define OLED_RENDER_LOCK_NAME "Lock: " # define OLED_RENDER_LOCK_NUML "NUML"