From 2f7be43ccb32361d3ea8605b36720716248d963c Mon Sep 17 00:00:00 2001 From: CTCaer Date: Thu, 30 Apr 2020 14:08:06 +0300 Subject: [PATCH] nyx: Allow screenshots only every 2s --- nyx/nyx_gui/frontend/gui.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/nyx/nyx_gui/frontend/gui.c b/nyx/nyx_gui/frontend/gui.c index 1c729d2..56601ae 100644 --- a/nyx/nyx_gui/frontend/gui.c +++ b/nyx/nyx_gui/frontend/gui.c @@ -205,8 +205,17 @@ static bool _fts_touch_read(lv_indev_data_t *data) // Take a screenshot if 3 fingers. if (touchpad.fingers > 2) { - _save_fb_to_bmp(); - msleep(200); + // Disallow screenshots if less than 2s passed. + static u32 timer = 0; + if (get_tmr_ms() > timer) + { + _save_fb_to_bmp(); + timer = get_tmr_ms() + 2000; + } + + data->state = LV_INDEV_STATE_REL; + + return false; } if (console_enabled)