Return to previous state after disco

This commit is contained in:
starcalc 2018-01-18 21:59:18 +01:00
parent c8f84d1aa6
commit 351dafbe44
1 changed files with 11 additions and 0 deletions

View File

@ -19,6 +19,7 @@ int w0;
int w1;
int w2;
int w3;
int w0b, w1b, w2b, w3b;
int step = 0;
int strobo = 1;
bool disco = false;
@ -99,9 +100,19 @@ bool discoHandler(const HomieRange& range, const String& value) {
if (value.toInt() == 0)
{
disco = false;
// Return to previous state
w0 = w0b;
w1 = w1b;
w2 = w2b;
w3 = w3b;
output();
} else
{
step = 0;
w0b = w0;
w1b = w1;
w2b = w2;
w3b = w3;
disco = true;
}
return true;