From 3cc7938b320721f1c439df16fcf942525ecdf3ee Mon Sep 17 00:00:00 2001 From: Jan Grewe <jan@faked.org> Date: Wed, 1 May 2019 13:16:52 +0200 Subject: [PATCH] Don't restart automatically after stopping with button. --- WINDER_ADV.ino | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/WINDER_ADV.ino b/WINDER_ADV.ino index 9102a09..06655fb 100644 --- a/WINDER_ADV.ino +++ b/WINDER_ADV.ino @@ -80,7 +80,6 @@ void loop() { WState = W_CYCLE; Restart = false; - Continue = false; } StartTime = millis(); winder.enableOutputs(); @@ -159,7 +158,10 @@ void loop() winder.disableOutputs(); StartTime = millis(); WState = W_PAUSE; - pwr_led.Breathe(5000).Forever(); + if (Continue) + { + pwr_led.Breathe(5000).Forever(); + } break; // case W_STOP case W_PAUSE: @@ -173,10 +175,9 @@ void loop() { WState = W_IDLE; } - else if (temp > (delta * long(PAUSE_MIN))) // ms per minute + else if (Continue && temp > (delta * long(PAUSE_MIN))) // ms per minute { WState = W_IDLE; - Continue = true; last_min = false; Serial.print("d_time : "); Serial.print(temp); @@ -186,7 +187,9 @@ void loop() else if ((!last_min) && (temp > (delta * long(PAUSE_MIN - 1)))) // ms per minute { Serial.println("Last Minute ..."); - pwr_led.Breathe(1000).Forever(); + if (Continue) { + pwr_led.Breathe(1000).Forever(); + } last_min = true; } else @@ -233,6 +236,8 @@ void handleSwEvent(AceButton *button, uint8_t eventType, case W_RIGHT: Serial.println(">>Stop Winding<<"); StopWind = true; + Continue = false; + pwr_led.On(); break; default: break; @@ -242,6 +247,7 @@ void handleSwEvent(AceButton *button, uint8_t eventType, case AceButton::kEventClicked: Serial.println("SW CLICK"); pwr_led.Reset(); + Continue = true; switch (WState) { case W_IDLE: -- GitLab