Bugfixes
This commit is contained in:
bpohvoodoo
2019-02-02 18:45:24 +01:00
parent 056dd6c96a
commit 832aa123d3
2 changed files with 6 additions and 3 deletions
+3 -3
View File
@@ -1082,18 +1082,18 @@ void loop() {
if (mode == SETCOLOR) { if (mode == SETCOLOR) {
strip.setColor(main_color.red, main_color.green, main_color.blue, main_color.white); strip.setColor(main_color.red, main_color.green, main_color.blue, main_color.white);
strip.trigger(); strip.trigger();
mode = (prevmode == SET_MODE) ? SETSPEED : HOLD; mode = (prevmode == SET_MODE) ? SETSPEED : prevmode;
} }
if (mode == SETSPEED) { if (mode == SETSPEED) {
strip.setSpeed(convertSpeed(ws2812fx_speed)); strip.setSpeed(convertSpeed(ws2812fx_speed));
strip.trigger(); strip.trigger();
mode = (prevmode == SET_MODE) ? BRIGHTNESS : HOLD; mode = (prevmode == SET_MODE) ? BRIGHTNESS : prevmode;
} }
if (mode == BRIGHTNESS) { if (mode == BRIGHTNESS) {
strip.setBrightness(brightness); strip.setBrightness(brightness);
strip.trigger(); strip.trigger();
if (prevmode == SET_MODE) prevmode = HOLD; if (prevmode == SET_MODE) prevmode = HOLD;
mode = HOLD; mode = prevmode;
} }
#ifdef ENABLE_LEGACY_ANIMATIONS #ifdef ENABLE_LEGACY_ANIMATIONS
if (mode == WIPE) { if (mode == WIPE) {
+3
View File
@@ -129,6 +129,7 @@ void handleSetMainColor(uint8_t * mypayload) {
main_color.green = ((rgb >> 8) & 0xFF); main_color.green = ((rgb >> 8) & 0xFF);
main_color.blue = ((rgb >> 0) & 0xFF); main_color.blue = ((rgb >> 0) & 0xFF);
// strip.setColor(main_color.red, main_color.green, main_color.blue); // strip.setColor(main_color.red, main_color.green, main_color.blue);
prevmode = mode;
mode = SETCOLOR; mode = SETCOLOR;
} }
@@ -510,6 +511,7 @@ void checkpayload(uint8_t * payload, bool mqtt = false, uint8_t num = 0) {
if (payload[0] == '?') { if (payload[0] == '?') {
uint8_t d = (uint8_t) strtol((const char *) &payload[1], NULL, 10); uint8_t d = (uint8_t) strtol((const char *) &payload[1], NULL, 10);
ws2812fx_speed = constrain(d, 0, 255); ws2812fx_speed = constrain(d, 0, 255);
prevmode = mode;
mode = SETSPEED; mode = SETSPEED;
Dbg_Prefix(mqtt, num); Dbg_Prefix(mqtt, num);
DBG_OUTPUT_PORT.printf("Set speed to: [%u]\n", ws2812fx_speed); DBG_OUTPUT_PORT.printf("Set speed to: [%u]\n", ws2812fx_speed);
@@ -529,6 +531,7 @@ void checkpayload(uint8_t * payload, bool mqtt = false, uint8_t num = 0) {
if (payload[0] == '%') { if (payload[0] == '%') {
uint8_t b = (uint8_t) strtol((const char *) &payload[1], NULL, 10); uint8_t b = (uint8_t) strtol((const char *) &payload[1], NULL, 10);
brightness = constrain(b, 0, 255); brightness = constrain(b, 0, 255);
prevmode = mode;
mode = BRIGHTNESS; mode = BRIGHTNESS;
Dbg_Prefix(mqtt, num); Dbg_Prefix(mqtt, num);
DBG_OUTPUT_PORT.printf("Set brightness to: [%u]\n", brightness); DBG_OUTPUT_PORT.printf("Set brightness to: [%u]\n", brightness);