From d1b7415563c4bdbedcaad1dc7e159ea54ebadc34 Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Mon, 13 Apr 2020 03:51:07 +0200 Subject: [PATCH] Reimplement the initial wait --- main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 122b650..0452b18 100644 --- a/main.c +++ b/main.c @@ -19,8 +19,8 @@ #define DELAY 4000000 // This is bad -- it's a value that was found to be OK #define STM32F1 1 // Needed for libopencm3 -enum {FORWARD, BACKWARD} direction; -bool running = false; +volatile enum {FORWARD, BACKWARD} direction; +volatile bool running = false; void setup (void) { // All the blackbox code @@ -79,6 +79,9 @@ int main (void) { char state = 0; int i; + // Initial wait + while (!running) ; + while (true) { for (i=0 ; i