From ae371e08448ffee981a27f899f8083261c27ced4 Mon Sep 17 00:00:00 2001 From: Tobias Blum Date: Sat, 19 Aug 2017 23:36:23 +0200 Subject: [PATCH] Bugfix issue: Just a flicker on WS set single pixel command #31 See: https://github.com/toblum/McLighting/issues/31 --- Arduino/McLighting/McLighting.ino | 5 +++-- Arduino/McLighting/definitions.h | 2 +- Arduino/McLighting/request_handlers.h | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Arduino/McLighting/McLighting.ino b/Arduino/McLighting/McLighting.ino index 1a9dd38..57b3f33 100644 --- a/Arduino/McLighting/McLighting.ino +++ b/Arduino/McLighting/McLighting.ino @@ -585,7 +585,7 @@ void loop() { strip.setMode(FX_MODE_THEATER_CHASE_RAINBOW); mode = HOLD; } - if (mode == HOLD) { + if (mode == HOLD || mode == CUSTOM) { if (exit_func) { exit_func = false; } @@ -594,7 +594,8 @@ void loop() { tv(); } - if (mode != TV) { + // Only for modes with WS2812FX functionality + if (mode != TV && mode != CUSTOM) { strip.service(); } } diff --git a/Arduino/McLighting/definitions.h b/Arduino/McLighting/definitions.h index 41bd8b6..1f69202 100644 --- a/Arduino/McLighting/definitions.h +++ b/Arduino/McLighting/definitions.h @@ -31,7 +31,7 @@ const char HOSTNAME[] = "ESP8266_01"; // Friedly hostname #define DBG_OUTPUT_PORT Serial // Set debug output port // List of all color modes -enum MODE { SET_MODE, HOLD, OFF, ALL, WIPE, RAINBOW, RAINBOWCYCLE, THEATERCHASE, THEATERCHASERAINBOW, TV }; +enum MODE { SET_MODE, HOLD, OFF, ALL, WIPE, RAINBOW, RAINBOWCYCLE, THEATERCHASE, THEATERCHASERAINBOW, TV, CUSTOM }; MODE mode = RAINBOW; // Standard mode that is active when software starts diff --git a/Arduino/McLighting/request_handlers.h b/Arduino/McLighting/request_handlers.h index 3da2dca..9261e26 100644 --- a/Arduino/McLighting/request_handlers.h +++ b/Arduino/McLighting/request_handlers.h @@ -71,7 +71,7 @@ void handleSetSingleLED(uint8_t * mypayload) { // decode led index uint64_t rgb = (uint64_t) strtol((const char *) &mypayload[1], NULL, 16); - uint8_t led = ((rgb >> 24) & 0xFF); + uint8_t led = ((rgb >> 24) & 0xFF); if (led < strip.numPixels()) { ledstates[led].red = ((rgb >> 16) & 0xFF); ledstates[led].green = ((rgb >> 8) & 0xFF); @@ -85,7 +85,7 @@ void handleSetSingleLED(uint8_t * mypayload) { strip.show(); } exit_func = true; - mode = ALL; + mode = CUSTOM; } void handleSetNamedMode(String str_mode) {