From 43eeb417e97bcee7d43fc80a8a6b2502cf2af5a9 Mon Sep 17 00:00:00 2001 From: jpunkt Date: Thu, 20 Jan 2022 16:49:26 +0100 Subject: [PATCH] improved abortion containment. --- src/main.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 4eb98d3..c02af06 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -456,7 +456,6 @@ void serial_do_it() { lights[i].show(); } serial_aborted = false; - serial_received(); return; } @@ -484,8 +483,9 @@ void serial_record() { blink_status = true; int led[] = { BTN_LED_RED }; - while (time < timeout) { + while (!serial_aborted && (time < timeout)) { btn_red.update(); + ssp.loop(); if (btn_red.isPressed()) break; @@ -496,6 +496,11 @@ void serial_record() { } } digitalWrite(BTN_LED_RED, LOW); + + if (serial_aborted) { + serial_aborted = false; + return; + } serial_received(); } @@ -569,6 +574,11 @@ void serial_userinteract() { digitalWrite(led, LOW); } blink_status = false; + + if (serial_aborted) { + serial_aborted = false; + return; + } serial_received(btn_pressed); }