From da149c296fbe06302943f0a87eb144cbce833578 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Tue, 14 Apr 2020 17:52:22 +0300 Subject: [PATCH] touch: Reinitialize up to 3 times if failed --- nyx/nyx_gui/input/touch.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nyx/nyx_gui/input/touch.c b/nyx/nyx_gui/input/touch.c index 09bd0b5..df1860f 100644 --- a/nyx/nyx_gui/input/touch.c +++ b/nyx/nyx_gui/input/touch.c @@ -373,7 +373,16 @@ int touch_power_on() return touch_execute_autotune(); } - return touch_init(); + // Initialize touchscreen. + u32 retries = 3; + while (retries) + { + if (touch_init()) + return 1; + retries--; + } + + return 0; } void touch_power_off()