Speed can now be changed on-the-fly by setting speedup
.
This commit is contained in:
parent
8fe03313ac
commit
7651e46ee0
@ -32,3 +32,4 @@ extern AnimationMode mode;
|
|||||||
extern AnimationMode temp_mode;
|
extern AnimationMode temp_mode;
|
||||||
extern unsigned long temp_mode_until;
|
extern unsigned long temp_mode_until;
|
||||||
extern int return_to_brightness;
|
extern int return_to_brightness;
|
||||||
|
extern uint8_t speedup;
|
||||||
|
@ -21,6 +21,7 @@ AnimationMode mode = AM_CORNERS;
|
|||||||
AnimationMode temp_mode;
|
AnimationMode temp_mode;
|
||||||
unsigned long temp_mode_until;
|
unsigned long temp_mode_until;
|
||||||
int return_to_brightness = -1;
|
int return_to_brightness = -1;
|
||||||
|
uint8_t speedup = SPEEDUP;
|
||||||
|
|
||||||
unsigned long last_loop = 0;
|
unsigned long last_loop = 0;
|
||||||
|
|
||||||
@ -156,7 +157,7 @@ void loop() {
|
|||||||
mqtt_loop();
|
mqtt_loop();
|
||||||
ArduinoOTA.handle();
|
ArduinoOTA.handle();
|
||||||
|
|
||||||
EVERY_N_MILLISECONDS(20 / SPEEDUP) {
|
if (speedup > 0 && (millis() - last_loop > (20 / speedup) || last_loop > millis())) {
|
||||||
looping = false;
|
looping = false;
|
||||||
|
|
||||||
AnimationMode active_mode = mode;
|
AnimationMode active_mode = mode;
|
||||||
|
@ -67,6 +67,8 @@ void callback(char* topic, byte* pl, unsigned int length) {
|
|||||||
else if (value.equals("yellow")) { color = CRGB::Yellow; }
|
else if (value.equals("yellow")) { color = CRGB::Yellow; }
|
||||||
else if (value.equals("orange")) { color = CRGB::Orange; }
|
else if (value.equals("orange")) { color = CRGB::Orange; }
|
||||||
else { LOGln("Unknown color name %s.", value.c_str());}
|
else { LOGln("Unknown color name %s.", value.c_str());}
|
||||||
|
} else if (key.equals("speedup")) {
|
||||||
|
speedup = value.toInt();
|
||||||
} else {
|
} else {
|
||||||
LOGln("Unknown key '%s'. (For reference: Value is '%s'.)", key.c_str(), value.c_str());
|
LOGln("Unknown key '%s'. (For reference: Value is '%s'.)", key.c_str(), value.c_str());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user