summaryrefslogtreecommitdiff
path: root/users/drashna/oled/oled_stuff.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/drashna/oled/oled_stuff.c')
-rw-r--r--users/drashna/oled/oled_stuff.c403
1 files changed, 288 insertions, 115 deletions
diff --git a/users/drashna/oled/oled_stuff.c b/users/drashna/oled/oled_stuff.c
index 440b905fd0..c850c5336f 100644
--- a/users/drashna/oled/oled_stuff.c
+++ b/users/drashna/oled/oled_stuff.c
@@ -1,4 +1,5 @@
/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
+ * Copyright 2021 John Ezra - wpm graph
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,17 +16,17 @@
*/
#include "drashna.h"
-#ifdef CUSTOM_UNICODE_ENABLE
+#ifdef UNICODE_COMMON_ENABLE
# include "process_unicode_common.h"
#endif
#include <string.h>
extern bool host_driver_disabled;
-uint32_t oled_timer = 0;
-char keylog_str[OLED_KEYLOGGER_LENGTH] = {0};
-static uint16_t log_timer = 0;
-static const char PROGMEM display_border[3] = {0x0, 0xFF, 0x0};
+uint32_t oled_timer = 0;
+char keylog_str[OLED_KEYLOGGER_LENGTH] = {0};
+static uint16_t log_timer = 0;
+static const char PROGMEM display_border[3] = {0x0, 0xFF, 0x0};
deferred_token kittoken;
@@ -112,7 +113,7 @@ void update_log(void) {
*/
void render_keylogger_status(void) {
#ifdef OLED_DISPLAY_VERBOSE
- oled_set_cursor(1, 7);
+ oled_set_cursor(1, 6);
#endif
oled_write_P(PSTR(OLED_RENDER_KEYLOGGER), false);
oled_write(keylog_str, false);
@@ -127,7 +128,7 @@ void render_keylogger_status(void) {
*/
void render_default_layer_state(void) {
#ifdef OLED_DISPLAY_VERBOSE
- oled_set_cursor(5, 2);
+ oled_set_cursor(1, 1);
#endif
oled_write_P(PSTR(OLED_RENDER_LAYOUT_NAME), false);
switch (get_highest_layer(default_layer_state)) {
@@ -155,111 +156,166 @@ void render_default_layer_state(void) {
*/
void render_layer_state(void) {
#ifdef OLED_DISPLAY_VERBOSE
- static const char PROGMEM tri_layer_image[4][3][18] = {
+ // clang-format off
+ static const char PROGMEM tri_layer_image[][3][24] = {
+ // base
{
{
- 0x80, 0x80, 0x40, 0x40, 0x20, 0x20,
- 0x10, 0x10, 0x08, 0x08, 0x10, 0x10,
- 0x20, 0x20, 0x40, 0x40, 0x80, 0x80
+ 0x00, 0x00, 0x00, 0x80, 0x80, 0x40,
+ 0x40, 0x20, 0x20, 0x10, 0x10, 0x08,
+ 0x08, 0x10, 0x10, 0x20, 0x20, 0x40,
+ 0x40, 0x80, 0x80, 0x00, 0x00, 0x00
},
{
- 0x88, 0x88, 0x5D, 0x5D, 0x3E, 0x3E,
- 0x7C, 0x7C, 0xF8, 0xF8, 0x7C, 0x7C,
- 0x3E, 0x3E, 0x5D, 0x5D, 0x88, 0x88
+ 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, 0x01, 0x01, 0x02, 0x02,
- 0x04, 0x04, 0x08, 0x08, 0x04, 0x04,
- 0x02, 0x02, 0x01, 0x01, 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
{
{
- 0x80, 0x80, 0xC0, 0xC0, 0xE0, 0xE0,
- 0xF0, 0xF0, 0xF8, 0xF8, 0xF0, 0xF0,
- 0xE0, 0xE0, 0xC0, 0xC0, 0x80, 0x80
+ 0x00, 0x00, 0x00, 0x80, 0x80, 0xC0,
+ 0xC0, 0xE0, 0xE0, 0xF0, 0xF0, 0xF8,
+ 0xF8, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0,
+ 0xC0, 0x80, 0x80, 0x00, 0x00, 0x00
},
{
- 0x88, 0x88, 0x55, 0x55, 0x23, 0x23,
- 0x47, 0x47, 0x8F, 0x8F, 0x47, 0x47,
- 0x23, 0x23, 0x55, 0x55, 0x88, 0x88
+ 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, 0x01, 0x01, 0x02, 0x02,
- 0x04, 0x04, 0x08, 0x08, 0x04, 0x04,
- 0x02, 0x02, 0x01, 0x01, 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
{
{
- 0x80, 0x80, 0x40, 0x40, 0x20, 0x20,
- 0x10, 0x10, 0x08, 0x08, 0x10, 0x10,
- 0x20, 0x20, 0x40, 0x40, 0x80, 0x80
+ 0x00, 0x00, 0x00, 0x80, 0x80, 0x40,
+ 0x40, 0x20, 0x20, 0x10, 0x10, 0x08,
+ 0x08, 0x10, 0x10, 0x20, 0x20, 0x40,
+ 0x40, 0x80, 0x80, 0x00, 0x00, 0x00
},
{
- 0x88, 0x88, 0xD5, 0xD5, 0xE2, 0xE2,
- 0xC4, 0xC4, 0x88, 0x88, 0xC4, 0xC4,
- 0xE2, 0xE2, 0xD5, 0xD5, 0x88, 0x88
+ 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, 0x01, 0x01, 0x03, 0x03,
- 0x07, 0x07, 0x0F, 0x0F, 0x07, 0x07,
- 0x03, 0x03, 0x01, 0x01, 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
{
{
- 0x80, 0x80, 0x40, 0xC0, 0x60, 0xA0,
- 0x50, 0xB0, 0x58, 0xA8, 0x50, 0xB0,
- 0x60, 0xA0, 0x40, 0xC0, 0x80, 0x80
+ 0x00, 0x00, 0x00, 0x80, 0x80, 0x40,
+ 0xC0, 0x60, 0xA0, 0x50, 0xB0, 0x58,
+ 0xA8, 0x50, 0xB0, 0x60, 0xA0, 0x40,
+ 0xC0, 0x80, 0x80, 0x00, 0x00, 0x00
},
{
- 0x88, 0x88, 0x5D, 0xD5, 0x6B, 0xB6,
- 0x6D, 0xD6, 0xAD, 0xDA, 0x6D, 0xD6,
- 0x6B, 0xB6, 0x5D, 0xD5, 0x88, 0x88
+ 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, 0x01, 0x01, 0x03, 0x02,
- 0x05, 0x06, 0x0D, 0x0A, 0x05, 0x06,
- 0x03, 0x02, 0x01, 0x01, 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 }
}
};
- uint8_t layer_is = 0;
+
+ // clang-format on
+ uint8_t layer_is[4] = { 0, 4, 4, 4};
if (layer_state_is(_ADJUST)) {
- layer_is = 3;
+ layer_is[0] = 3;
} else if (layer_state_is(_RAISE)) {
- layer_is = 1;
+ layer_is[0] = 1;
} else if (layer_state_is(_LOWER)) {
- layer_is = 2;
+ layer_is[0] = 2;
}
+ if (layer_state_is(_MOUSE)) {
+ layer_is[1] = 6;
+ }
+ if (layer_state_is(_GAMEPAD)) {
+ layer_is[2] = 5;
+ }
+
+
oled_set_cursor(1, 2);
- oled_write_raw_P(tri_layer_image[layer_is][0], sizeof(tri_layer_image[0][0]));
- oled_set_cursor(5, 3);
+ oled_write_raw_P(tri_layer_image[layer_is[0]][0], sizeof(tri_layer_image[0][0]));
+ oled_set_cursor(5, 2);
+ oled_write_raw_P(tri_layer_image[layer_is[1]][0], sizeof(tri_layer_image[0][0]));
+ oled_set_cursor(9, 2);
+ oled_write_raw_P(tri_layer_image[layer_is[2]][0], sizeof(tri_layer_image[0][0]));
+ oled_set_cursor(14, 2);
oled_write_P(PSTR("Diablo2"), layer_state_is(_DIABLOII));
- oled_write_P(PSTR(" "), false);
- oled_write_P(PSTR("Diablo3"), layer_state_is(_DIABLO));
oled_advance_page(true);
oled_set_cursor(1, 3);
- oled_write_raw_P(tri_layer_image[layer_is][1], sizeof(tri_layer_image[0][0]));
- oled_set_cursor(5, 4);
- oled_write_P(PSTR("GamePad"), layer_state_is(_GAMEPAD));
- oled_write_P(PSTR(" "), false);
- oled_write_P(PSTR("Mouse"), layer_state_is(_MOUSE));
+ oled_write_raw_P(tri_layer_image[layer_is[0]][1], sizeof(tri_layer_image[0][0]));
+ oled_set_cursor(5, 3);
+ oled_write_raw_P(tri_layer_image[layer_is[1]][1], sizeof(tri_layer_image[0][0]));
+ oled_set_cursor(9, 3);
+ oled_write_raw_P(tri_layer_image[layer_is[2]][1], sizeof(tri_layer_image[0][0]));
+ oled_set_cursor(14, 3);
+ oled_write_P(PSTR("Diablo3"), layer_state_is(_DIABLO));
oled_advance_page(true);
oled_set_cursor(1, 4);
- oled_write_raw_P(tri_layer_image[layer_is][2], sizeof(tri_layer_image[0][0]));
-
+ oled_write_raw_P(tri_layer_image[layer_is[0]][2], sizeof(tri_layer_image[0][0]));
+ oled_set_cursor(5, 4);
+ oled_write_raw_P(tri_layer_image[layer_is[1]][2], sizeof(tri_layer_image[0][0]));
+ oled_set_cursor(9, 4);
+ oled_write_raw_P(tri_layer_image[layer_is[2]][2], sizeof(tri_layer_image[0][0]));
+ oled_set_cursor(14, 4);
+ oled_write_P(PSTR("Media"), layer_state_is(_MEDIA));
#else
oled_write_P(PSTR(OLED_RENDER_LAYER_NAME), false);
oled_write_P(PSTR(OLED_RENDER_LAYER_LOWER), layer_state_is(_LOWER));
oled_write_P(PSTR(OLED_RENDER_LAYER_RAISE), layer_state_is(_RAISE));
- oled_advance_page(true);
#endif
+ oled_advance_page(true);
}
/**
@@ -288,9 +344,14 @@ void render_keylock_status(uint8_t led_usb_state) {
* @brief Renders the matrix scan rate to the host system
*
*/
-void render_matrix_scan_rate(void) {
+void render_matrix_scan_rate(uint8_t padding) {
#ifdef DEBUG_MATRIX_SCAN_RATE
oled_write_P(PSTR("MS:"), false);
+ if (padding) {
+ for (uint8_t n = padding; n > 0; n--) {
+ oled_write_P(PSTR(" "), false);
+ }
+ }
oled_write(get_u16_str(get_matrix_scan_rate(), ' '), false);
#endif
}
@@ -337,7 +398,7 @@ void render_bootmagic_status(void) {
bool is_bootmagic_on;
#ifdef OLED_DISPLAY_VERBOSE
- oled_set_cursor(7, 4);
+ oled_set_cursor(7, 3);
is_bootmagic_on = !keymap_config.swap_lctl_lgui;
#else
is_bootmagic_on = keymap_config.swap_lctl_lgui;
@@ -366,11 +427,12 @@ void render_bootmagic_status(void) {
oled_write_P(PSTR(" "), false);
#ifdef AUTOCORRECTION_ENABLE
oled_write_P(PSTR("CRCT"), userspace_config.autocorrection);
+ oled_write_P(PSTR(" "), false);
#else
oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NOGUI), keymap_config.no_gui);
#endif
#ifdef OLED_DISPLAY_VERBOSE
- oled_set_cursor(7, 5);
+ oled_set_cursor(7, 4);
if (keymap_config.swap_lctl_lgui) {
oled_write_P(logo[1][1], is_bootmagic_on);
} else {
@@ -382,6 +444,7 @@ void render_bootmagic_status(void) {
#ifdef SWAP_HANDS_ENABLE
oled_write_P(PSTR(" "), false);
oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_SWAP), swap_hands);
+ oled_write_P(PSTR(" "), false);
#endif
}
@@ -402,7 +465,7 @@ void render_user_status(void) {
# endif
#endif
#if defined(OLED_DISPLAY_VERBOSE)
- oled_set_cursor(1, 6);
+ oled_set_cursor(1, 5);
#endif
oled_write_P(PSTR(OLED_RENDER_USER_NAME), false);
#if !defined(OLED_DISPLAY_VERBOSE)
@@ -434,9 +497,9 @@ void render_user_status(void) {
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);
-#if defined(CUSTOM_UNICODE_ENABLE)
- static const char PROGMEM uc_mod_status[5][3] = {{0xEA, 0xEB, 0}, {0xEC, 0xED, 0}};
- oled_write_P(uc_mod_status[get_unicode_input_mode() == UC_MAC], false);
+#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);
#endif
if (userspace_config.nuke_switch) {
#if !defined(OLED_DISPLAY_VERBOSE)
@@ -466,6 +529,67 @@ void render_wpm(uint8_t padding) {
#endif
}
+//============= USER CONFIG PARAMS ===============
+// wpm graph originally designed by john-ezra
+
+// for 128x128:
+// max_lines_graph = 54;
+// vertical_offset = 64;
+// for 128x64:
+// max_lines_graph = 64;
+// vertical_offset = 0;
+
+void render_wpm_graph(uint8_t max_lines_graph, uint8_t vertical_offset) {
+ static uint16_t timer = 0;
+ static uint8_t x = OLED_DISPLAY_HEIGHT - 1;
+ uint8_t currwpm = get_current_wpm();
+ float max_wpm = OLED_WPM_GRAPH_MAX_WPM;
+
+ if (timer_elapsed(timer) > OLED_WPM_GRAPH_REFRESH_INTERVAL) { // check if it's been long enough before refreshing graph
+ x = (max_lines_graph - 1) - ((currwpm / max_wpm) * (max_lines_graph - 1)); // main calculation to plot graph line
+ for (uint8_t i = 0; i <= OLED_WPM_GRAPH_GRAPH_LINE_THICKNESS - 1; i++) { // first draw actual value line
+ oled_write_pixel(3, x + i + vertical_offset, true);
+ }
+# ifdef OLED_WPM_GRAPH_VERTICAL_LINE
+ static uint8_t vert_count = 0;
+ if (vert_count == OLED_WPM_GRAPH_VERTCAL_LINE_INTERVAL) {
+ vert_count = 0;
+ while (x <= (max_lines_graph - 1)) {
+ oled_write_pixel(3, x + vertical_offset, true);
+ x++;
+ }
+ } else {
+ for (uint8_t i = (max_lines_graph - 1); i > x; i--) {
+ if (i % OLED_WPM_GRAPH_AREA_FILL_INTERVAL == 0) {
+ oled_write_pixel(3, i + vertical_offset, true);
+ }
+ }
+ vert_count++;
+ }
+# else
+ for (int i = (max_lines_graph - 1); i > x; i--) {
+ if (i % OLED_WPM_GRAPH_AREA_FILL_INTERVAL == 0) {
+ oled_write_pixel(3, i + vertical_offset, true);
+ }
+ }
+# endif
+ oled_pan(false); // then move the entire graph one pixel to the right
+ static const char PROGMEM display_border[3] = {0x0, 0xFF, 0x0};
+ for (uint8_t i = 0; i < 7; i++) {
+ oled_set_cursor(0, i + 8);
+ oled_write_raw_P(display_border, sizeof(display_border));
+ oled_set_cursor(21, i + 8);
+ 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, 15);
+
+ oled_write_raw_P(footer_image, sizeof(footer_image));
+
+ timer = timer_read(); // refresh the timer for the next iteration
+ }
+}
+
#if defined(POINTING_DEVICE_ENABLE)
void render_pointing_dpi_status(uint16_t cpi, uint8_t padding) {
oled_write_P(PSTR("CPI:"), false);
@@ -481,11 +605,9 @@ void render_pointing_dpi_status(uint16_t cpi, uint8_t padding) {
__attribute__((weak)) void oled_driver_render_logo_right(void) {
#if defined(OLED_DISPLAY_VERBOSE)
- oled_set_cursor(0, 2);
- render_default_layer_state();
-#else
- render_default_layer_state();
+ oled_set_cursor(0, 1);
#endif
+ render_default_layer_state();
}
// WPM-responsive animation stuff here
@@ -510,8 +632,8 @@ __attribute__((weak)) void oled_driver_render_logo_right(void) {
# error frame size too large
#endif
-static uint8_t animation_frame = 0;
-static uint8_t animation_type = 0;
+static uint8_t animation_frame = 0;
+static uint8_t animation_type = 0;
void render_kitty(void) {
// Images credit j-inc(/James Incandenza) and pixelbenny.
@@ -770,28 +892,28 @@ void render_kitty(void) {
// clang-format on
for (uint8_t i = 0; i < 4; i++) {
- oled_set_cursor(1, i + 2);
+ oled_set_cursor(1, i + 1);
oled_write_raw_P(animation[animation_type][animation_frame][i], OLED_ANIM_SIZE);
}
}
uint32_t kitty_animation_phases(uint32_t triger_time, void *cb_arg) {
- uint32_t anim_frame_duration = 500;
- // can't change animation frame duration here, otherwise, it gets stuck.
- // weirdly, it seems to work fine if it's in keymap.c but not here.
- // Should move this block to the deferred execution?
+ static uint32_t anim_frame_duration = 500;
#ifdef POINTING_DEVICE_ENABLE
if (tap_toggling) {
- animation_frame = (animation_frame + 1) % OLED_RTOGI_FRAMES;
- animation_type = 3;
+ animation_frame = (animation_frame + 1) % OLED_RTOGI_FRAMES;
+ animation_type = 3;
anim_frame_duration = 300;
} else
#endif
{
+#ifdef WPM_ENABLE
if (get_current_wpm() <= OLED_SLEEP_SPEED) {
+#endif
animation_frame = (animation_frame + 1) % OLED_SLEEP_FRAMES;
animation_type = 0;
anim_frame_duration = 500;
+#ifdef WPM_ENABLE
} else if (get_current_wpm() > OLED_WAKE_SPEED) {
animation_frame = (animation_frame + 1) % OLED_WAKE_FRAMES;
animation_type = 1;
@@ -801,13 +923,14 @@ uint32_t kitty_animation_phases(uint32_t triger_time, void *cb_arg) {
animation_type = 2;
anim_frame_duration = 500;
}
+#endif
}
return anim_frame_duration;
}
void oled_driver_render_logo_left(void) {
#if defined(OLED_DISPLAY_VERBOSE)
- oled_set_cursor(0, 2);
+ oled_set_cursor(0, 1);
render_kitty();
# if defined(KEYBOARD_handwired_tractyl_manuform)
@@ -816,39 +939,82 @@ void oled_driver_render_logo_left(void) {
# elif defined(KEYBOARD_bastardkb_charybdis)
oled_set_cursor(6, 0);
oled_write_P(PSTR("Charybdis"), true);
+# elif defined(KEYBOARD_splitkb_kyria)
+ oled_set_cursor(7, 0);
+ oled_write_P(PSTR("SplitKB"), true);
# else
oled_set_cursor(8, 0);
oled_write_P(PSTR("Left"), true);
# endif
- oled_set_cursor(7, 2);
-# if defined(DEBUG_MATRIX_SCAN_RATE)
- render_matrix_scan_rate();
-# elif defined(WPM_ENABLE)
+ oled_set_cursor(7, 1);
+# if defined(WPM_ENABLE)
render_wpm(1);
+# elif defined(DEBUG_MATRIX_SCAN_RATE)
+ render_matrix_scan_rate(2);
# endif
- oled_write_P(PSTR(" "), false);
-# if defined(KEYBOARD_handwired_tractyl_manuform)
- render_pointing_dpi_status(kb_config_data.device_cpi, 1);
-# elif defined(KEYBOARD_bastardkb_charybdis)
- render_pointing_dpi_status(, 1);
+ oled_set_cursor(7, 2);
+# if defined(KEYBOARD_bastardkb_charybdis)
+ render_pointing_dpi_status(charybdis_get_pointer_sniping_enabled() ? charybdis_get_pointer_sniping_dpi() : charybdis_get_pointer_default_dpi(), 1);
+
+// 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;
+# else
+ if (charybdis_get_pointer_sniping_enabled()) {
+ image_index = 1;
+ } else if (charybdis_get_pointer_dragscroll_enabled()) {
+ image_index = 2;
+ }
+# endif
+
+ oled_set_cursor(17, 1);
+ oled_write_raw_P(mouse_logo[image_index][0], 16);
+ oled_set_cursor(17, 2);
+ oled_write_raw_P(mouse_logo[image_index][1], 16);
+# elif defined(WPM_ENABLE) && defined(DEBUG_MATRIX_SCAN_RATE)
+ render_matrix_scan_rate(2);
# endif
- oled_set_cursor(0, 6);
+
+ oled_set_cursor(0, 5);
#else
render_default_layer_state();
#endif
}
-void render_status_secondary(void) {
-# if defined(KEYBOARD_handwired_tractyl_manuform)
+void render_status_right(void) {
+#if defined(KEYBOARD_handwired_tractyl_manuform)
oled_set_cursor(7, 0);
oled_write_P(PSTR("Manuform"), true);
-# elif defined(KEYBOARD_bastardkb_charybdis)
+#elif defined(KEYBOARD_bastardkb_charybdis)
oled_set_cursor(6, 0);
oled_write_P(PSTR("Charybdis"), true);
-# else
+#elif defined(KEYBOARD_splitkb_kyria)
+ oled_set_cursor(8, 0);
+ oled_write_P(PSTR("Kyria"), true);
+#else
oled_set_cursor(8, 0);
oled_write_P(PSTR("Right"), true);
-# endif
+#endif
oled_driver_render_logo_right();
/* Show Keyboard Layout */
render_layer_state();
@@ -859,16 +1025,18 @@ void render_status_secondary(void) {
render_keylock_status(host_keyboard_leds());
}
-void render_status_main(void) {
+void render_status_left(void) {
oled_driver_render_logo_left();
/* Show Keyboard Layout */
render_bootmagic_status();
render_user_status();
- // render_keylogger_status();
+ render_keylogger_status();
}
+__attribute__((weak)) void oled_render_large_display(void) {}
+
__attribute__((weak)) oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return rotation; }
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
@@ -883,12 +1051,14 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return oled_init_keymap(rotation);
}
+__attribute__((weak)) bool oled_task_keymap(void) { return true; }
+
bool oled_task_user(void) {
update_log();
if (is_keyboard_master()) {
#ifndef OLED_DISPLAY_TEST
- if (timer_elapsed32(oled_timer) > 30000) {
+ if (timer_elapsed32(oled_timer) > 60000) {
oled_off();
return false;
} else
@@ -897,14 +1067,23 @@ bool oled_task_user(void) {
oled_on();
}
}
+
+ if (!oled_task_keymap()) {
+ return false;
+ }
+
+#if defined(OLED_DISPLAY_128X128)
+ oled_set_cursor(0, 7);
+ oled_render_large_display();
+#endif
+
#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
- };
- 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
- };
+ 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
+ };
+ 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, 0);
oled_write_raw_P(header_image, sizeof(header_image));
oled_set_cursor(0, 1);
#endif
@@ -912,16 +1091,10 @@ bool oled_task_user(void) {
#ifndef OLED_DISPLAY_TEST
if (is_keyboard_left()) {
#endif
- render_status_main(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
+ render_status_left();
#ifndef OLED_DISPLAY_TEST
} else {
- render_status_secondary();
- }
-#endif
-
-#if defined(OLED_DISPLAY_128X128)
- if (is_keyboard_left()) {
- render_keylogger_status();
+ render_status_right();
}
#endif
@@ -932,7 +1105,7 @@ bool oled_task_user(void) {
# else
num_of_rows = 7;
# endif
- for (uint8_t i= 1; i < num_of_rows; i++) {
+ for (uint8_t i = 1; i < num_of_rows; i++) {
oled_set_cursor(0, i);
oled_write_raw_P(display_border, sizeof(display_border));
oled_set_cursor(21, i);