diff options
author | Linnnus <[email protected]> | 2024-04-19 11:22:11 +0200 |
---|---|---|
committer | Linnnus <[email protected]> | 2024-04-19 11:22:11 +0200 |
commit | a9353001743edc3fafd46771e70229af66d6a1e8 (patch) | |
tree | 226054574a0df31160f48652430864bff99687ab | |
parent | 45e0f39612122163d0be114610bc7d99ec6fea84 (diff) |
Be consistent about returning after setupX()
THis fixes a bug where you could unlock the device but then immediately
enter STATE_RINGING, by removing an item whilst the victory animation
plays.
-rw-r--r-- | det_hele/det_hele.ino | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/det_hele/det_hele.ino b/det_hele/det_hele.ino index 93ac90f..c4f5939 100644 --- a/det_hele/det_hele.ino +++ b/det_hele/det_hele.ino @@ -267,17 +267,20 @@ bool handlePasscode() { void armedLoop() { if (handlePasscode()) { unarmedSetup(); + return; } double deviation = weightDeviation(); if (deviation > MAX_DEVIATION) { awareSetup(); + return; } } void awareLoop() { if (handlePasscode()) { unarmedSetup(); + return; } double deviation = weightDeviation(); @@ -291,6 +294,7 @@ void awareLoop() { Serial.println(remainingTime); if (remainingTime <= 0) { ringingSetup(); + return; } } @@ -300,6 +304,7 @@ void ringingLoop() { if (handlePasscode()) { digitalWrite(NOISE_ENABLE_PIN, LOW); unarmedSetup(); + return; } // FIXME: SHouldn't be able to do this for non-testing purposes. @@ -308,6 +313,7 @@ void ringingLoop() { if (deviation < MAX_DEVIATION) { digitalWrite(NOISE_ENABLE_PIN, LOW); armedSetup(); + return; } } |