Shows logo on startup for 5 seconds

This commit is contained in:
Ryan Neff 2023-11-29 13:10:13 -08:00
parent 86e8ae126d
commit 67753d72e9

View File

@ -197,10 +197,17 @@
}; };
#endif #endif
// Default timeout for displaying logo on boot.
#ifndef OLED_LOGO_TIMEOUT
#define OLED_LOGO_TIMEOUT 5000
#endif
#ifdef OLED_ENABLE #ifdef OLED_ENABLE
uint16_t startup_timer;
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {
startup_timer = timer_read();
if (is_keyboard_master()) { if (is_keyboard_master()) {
if(is_keyboard_left()){ if(is_keyboard_left()){
@ -214,6 +221,7 @@
} }
} }
static void render_logo(void) { static void render_logo(void) {
// @todo - should we split this into a seperate file? kb16 has a good example.
static const char PROGMEM sofle_pico_logo[] = { static const char PROGMEM sofle_pico_logo[] = {
// 'sofle-pico-vector-logo-v3bw', 64x128px // 'sofle-pico-vector-logo-v3bw', 64x128px
0x00, 0x00, 0xf8, 0xfc, 0xdc, 0x8e, 0x0e, 0x0e, 0x1c, 0x1c, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfc, 0xdc, 0x8e, 0x0e, 0x0e, 0x1c, 0x1c, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -315,6 +323,11 @@
} }
bool oled_task_user(void) { bool oled_task_user(void) {
static bool finished_logo = false;
if ((timer_elapsed(startup_timer) < OLED_LOGO_TIMEOUT) && !finished_logo) {
render_logo();
} else {
finished_logo = true;
if (is_keyboard_master()) { if (is_keyboard_master()) {
render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc) render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
} else { } else {
@ -322,5 +335,8 @@
} }
return false; return false;
} }
return true;
}
#endif #endif