main: don't wait more than 3s button press

This commit is contained in:
King Kévin 2021-08-09 11:21:43 +02:00
parent a710db6915
commit 55b9e429fa
1 changed files with 3 additions and 0 deletions

3
main.c
View File

@ -228,6 +228,9 @@ void main(void)
wait_10us(10000); // wait for 100 ms
press_duration++;
IWDG_KR = IWDG_KR_KEY_REFRESH; // reset watchdog
if (press_duration >= 30) { // 3 seconds already passed
break; // stop waiting for button to be released
}
}
led_error = false; // reset error state
if (press_duration < 30) { // less than 3 sec