From 99a039c3c85bc40ce1ebc5e511a01cf4e7893b48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Tue, 18 Jun 2019 17:45:53 +0200 Subject: [PATCH] application (minor): improve main loop interactiveness --- application.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application.c b/application.c index 284e4f7..bdc7e65 100644 --- a/application.c +++ b/application.c @@ -363,13 +363,13 @@ void main(void) button_flag = false; // reset button flag while (true) { // infinite loop iwdg_reset(); // kick the dog - while (user_input_available) { // user input is available + if (user_input_available) { // user input is available action = true; // action has been performed led_toggle(); // toggle LED char c = user_input_get(); // store receive character terminal_send(c); // send received character to terminal } - while (button_flag) { // user pressed button + if (button_flag) { // user pressed button action = true; // action has been performed printf("button pressed\n"); led_toggle(); // toggle LED @@ -378,7 +378,7 @@ void main(void) } button_flag = false; // reset flag } - while (rtc_internal_tick_flag) { // the internal RTC ticked + if (rtc_internal_tick_flag) { // the internal RTC ticked rtc_internal_tick_flag = false; // reset flag action = true; // action has been performed led_toggle(); // toggle LED (good to indicate if main function is stuck)