From 39347f6e8cae8cf7a826a44038093e16d27e2c0c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20K=C3=A4ppler?= <michael_kaeppler@web.de>
Date: Mon, 7 Jun 2021 11:18:20 +0200
Subject: [PATCH] Do not check flash button during calibration

It does not make sense to toggle night mode
or start another round of countdown during
calibration.

Closes #4.
---
 ampel-firmware/ampel-firmware.ino | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ampel-firmware/ampel-firmware.ino b/ampel-firmware/ampel-firmware.ino
index 3fdc1d1..bf67370 100644
--- a/ampel-firmware/ampel-firmware.ino
+++ b/ampel-firmware/ampel-firmware.ino
@@ -141,7 +141,12 @@ void loop() {
   keepServicesAlive();
 
   // Short press for night mode, Long press for calibration.
-  checkFlashButton();
+  // Inactive during calibration.
+  if (!(sensor::current_state == sensor::PREPARE_CALIBRATION_STABLE ||
+        sensor::current_state == sensor::PREPARE_CALIBRATION_UNSTABLE))
+  {
+    checkFlashButton();
+  }
 
   checkSerialInput();
 
-- 
GitLab