From 749b80ba030e8a3debc2612a26b7378c33b642c3 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 18 Oct 2017 17:18:58 +0200 Subject: [PATCH] bootloader: fix touch detection at start --- embed/bootloader/main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/embed/bootloader/main.c b/embed/bootloader/main.c index cb3b5063f..237e55a46 100644 --- a/embed/bootloader/main.c +++ b/embed/bootloader/main.c @@ -260,11 +260,10 @@ int main(void) ensure(0 == touch_init(), NULL); // delay to detect touch - hal_delay(100); - bool touched = false; - // flush touch events - while (touch_read()) { - touched = true; + uint32_t touched = 0; + for (int i = 0; i < 100; i++) { + touched |= touch_read(); + hal_delay(1); } // start the bootloader if user touched the screen or no firmware installed