Send the screen in standby after 30s idle

pull/63/head
Alessio Caiazza 2021-11-20 22:03:44 +01:00 zatwierdzone przez Silvano Seva
rodzic 3776b30121
commit f9751c9867
1 zmienionych plików z 16 dodań i 0 usunięć

Wyświetl plik

@ -224,6 +224,8 @@ ui_state_t ui_state;
bool macro_menu = false;
bool layout_ready = false;
bool redraw_needed = true;
bool standby = false;
long long last_event_tick = 0;
layout_t _ui_calculateLayout()
{
@ -863,9 +865,23 @@ void ui_updateFSM(event_t event, bool *sync_rtx)
return;
}
long long now = getTick();
if (!standby && (now - last_event_tick >= 30000)) // 30 sec
{
standby = true;
platform_setBacklightLevel(0);
}
// Process pressed keys
if(event.type == EVENT_KBD)
{
last_event_tick = now;
if (standby)
{
standby = false;
platform_setBacklightLevel(state.settings.brightness);
}
kbd_msg_t msg;
msg.value = event.payload;
// If MONI is pressed, activate MACRO functions