reform

MNT Reform: Open Source Portable Computer
Log (Feed) | Files | Refs (Tags) | README

commit d9c49e8c7078e026d808a2593a2b6a50a127d313
parent abd26239c5bd4a61c5c87e661b60b8ddb6262340
Author: Valtteri Koskivuori <vkoskiv@gmail.com>
Date:   Mon, 16 Oct 2023 23:56:11 +0300

Add a ~30s timeout to the MNT Reform logo on the OLED

This should prevent any burn-in caused by the logo staying on the screen
for too long. That can happen e.g. during brownout in a low battery
	condition. When the keyboard receives 3.3v standby power again, it
	shows the logo, and never clears it until the user does so. This
	should fix that.

Diffstat:
Mreform2-keyboard-fw/menu.c | 7+++++++
Mreform2-keyboard-fw/menu.h | 1+
2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/reform2-keyboard-fw/menu.c b/reform2-keyboard-fw/menu.c @@ -16,6 +16,7 @@ int current_menu_y = 0; int current_scroll_y = 0; int current_menu_page = 0; +int8_t logo_timeout_ticks = 0; #ifdef KBD_MODE_STANDALONE #define MENU_NUM_ITEMS 5 @@ -71,6 +72,10 @@ void render_menu(int y) { void refresh_menu_page() { if (current_menu_page == MENU_PAGE_BATTERY_STATUS) { remote_get_voltages(); + } else if (current_menu_page == MENU_PAGE_MNT_LOGO && --logo_timeout_ticks <= 0) { + gfx_clear(); + gfx_flush(); + reset_menu(); } } @@ -171,6 +176,8 @@ int execute_meta_function(int keycode) { } void anim_hello(void) { + current_menu_page = MENU_PAGE_MNT_LOGO; + logo_timeout_ticks = 10; // ~30sec gfx_clear(); gfx_on(); for (int y=0; y<3; y++) { diff --git a/reform2-keyboard-fw/menu.h b/reform2-keyboard-fw/menu.h @@ -15,6 +15,7 @@ typedef struct MenuItem { #define MENU_PAGE_NONE 0 #define MENU_PAGE_OTHER 1 #define MENU_PAGE_BATTERY_STATUS 2 +#define MENU_PAGE_MNT_LOGO 3 void reset_and_render_menu(void); void reset_menu(void);