From ed5e4783be2e5ae589f37e2ab986b7e964dc1693 Mon Sep 17 00:00:00 2001 From: debsahu Date: Thu, 12 Apr 2018 18:46:10 -0400 Subject: [PATCH] updates to previous fix * updates to previous fix, solves https://github.com/toblum/McLighting/issues/128 --- Arduino/McLighting/McLighting.ino | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Arduino/McLighting/McLighting.ino b/Arduino/McLighting/McLighting.ino index 57348a4..517f1b6 100644 --- a/Arduino/McLighting/McLighting.ino +++ b/Arduino/McLighting/McLighting.ino @@ -587,7 +587,8 @@ void setup() { }); server.on("/get_color", []() { - String rgbcolor = String(main_color.red, HEX) + String(main_color.green, HEX) + String(main_color.blue, HEX); + char rgbcolor[7]; + snprintf(rgbcolor, sizeof(rgbcolor), "%02X%02X%02X", main_color.red, main_color.green, main_color.blue); server.send(200, "text/plain", rgbcolor ); DBG_OUTPUT_PORT.print("/get_color: "); DBG_OUTPUT_PORT.println(rgbcolor); @@ -861,7 +862,7 @@ void loop() { // Simple statemachine that handles the different modes if (mode == SET_MODE) { DBG_OUTPUT_PORT.printf("SET_MODE: %d %d\n", ws2812fx_mode, mode); - strip.setColor(main_color.red, main_color.green, main_color.blue); + strip.setColor(main_color.red, main_color.green, main_color.blue); strip.setMode(ws2812fx_mode); mode = SETSPEED; } @@ -882,7 +883,7 @@ void loop() { } if (mode == SETSPEED) { strip.setSpeed(convertSpeed(ws2812fx_speed)); - mode = HOLD; + mode = BRIGHTNESS; } if (mode == BRIGHTNESS) { strip.setBrightness(brightness);