Skip to content

Commit

Permalink
(Restore mode/off) on button press
Browse files Browse the repository at this point in the history
  • Loading branch information
jellewie committed Oct 27, 2020
1 parent 494abfc commit 783f0c9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Arduino/Arduino.ino
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ byte LastMode = -1; //Just to keep track if we are
const byte TotalLEDs = 60; //The total amounts of LEDs in the strip
int AnimationCounter; //Time in seconds that a AnimationCounter Animation needs to be played
TimeS TimeCurrent; //Where we save the time to
byte ModeBeforeOff = ON;
extern byte TotalAnimations; //^ Required for Clock.h
extern void StartAnimation(byte ID, int Time); //^ Required for Clock.h

Expand Down Expand Up @@ -172,10 +173,12 @@ void loop() {
if (Value.StartRelease) Serial.println("StartRelease");
#endif //SerialEnabled
if (Value.StartPress) {
if (Mode == OFF)
Mode = ON;
else
if (Mode == OFF) {
Mode = ModeBeforeOff == OFF ? ON : ModeBeforeOff; //If (ModeBeforeOff is OFF) then {set mode to be ON} else {set to ModeBeforeOff}
} else {
ModeBeforeOff = Mode;
Mode = OFF;
}
}
if (Value.StartDoublePress)
Mode = DoublePressMode; //Cool RGB color palet mode
Expand Down

0 comments on commit 783f0c9

Please sign in to comment.