diff --git a/Arduino/McLighting/McLighting.ino b/Arduino/McLighting/McLighting.ino index b6c9676..02b6600 100644 --- a/Arduino/McLighting/McLighting.ino +++ b/Arduino/McLighting/McLighting.ino @@ -54,8 +54,8 @@ #endif #if defined(ARDUINOJSON_VERSION) - #if !(ARDUINOJSON_VERSION_MAJOR == 6 and ARDUINOJSON_VERSION_MINOR == 10) - #error "Install ArduinoJson v6.10.x" + #if !(ARDUINOJSON_VERSION_MAJOR == 6 and ARDUINOJSON_VERSION_MINOR >= 8) + #error "Install ArduinoJson v6.8.x or higher" #endif #endif diff --git a/Arduino/McLighting/request_handlers.h b/Arduino/McLighting/request_handlers.h index aa17bdc..8373f32 100644 --- a/Arduino/McLighting/request_handlers.h +++ b/Arduino/McLighting/request_handlers.h @@ -1708,17 +1708,17 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght strcpy(HOSTNAME, root["hostname"]); #if defined(ENABLE_MQTT) strcpy(mqtt_host, root["mqtt_host"]); - mqtt_port = (uint16_t) root["mqtt_port"]; + mqtt_port = root["mqtt_port"].as(); strcpy(mqtt_user, root["mqtt_user"]); strcpy(mqtt_pass, root["mqtt_pass"]); #endif - WS2812FXStripSettings.stripSize = constrain ((uint16_t) root["ws_cnt"], 1, MAXLEDS); + WS2812FXStripSettings.stripSize = constrain(root["ws_cnt"].as(), 1, MAXLEDS); char tmp_rgbOrder[5]; strcpy(tmp_rgbOrder, root["ws_rgbo"]); checkRGBOrder(tmp_rgbOrder); uint8_t temp_pin; - checkPin((uint8_t) root["ws_pin"]); - WS2812FXStripSettings.fxoptions = ((constrain((uint8_t) root["ws_fxopt"], 0, 255)>>1)<<1); + checkPin((uint8_t) root["ws_pin"]); + WS2812FXStripSettings.fxoptions = ((constrain(root["ws_fxopt"].as(), 0, 255) >> 1) << 1); jsonBuffer.clear(); return true; } else { @@ -1785,22 +1785,22 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght JsonObject root = jsonBuffer.as(); serializeJson(root, DBG_OUTPUT_PORT); DBG_OUTPUT_PORT.println(""); - mode = static_cast((int) root["mode"]); - ws2812fx_mode = root["ws2812fx_mode"]; - ws2812fx_speed = root["speed"]; - brightness = root["brightness"]; - main_color.white = (uint8_t) root["color"][0]; - main_color.red = (uint8_t) root["color"][1]; - main_color.green = (uint8_t) root["color"][2]; - main_color.blue = (uint8_t) root["color"][3]; - back_color.white = (uint8_t) root["color"][4]; - back_color.red = (uint8_t) root["color"][5]; - back_color.green = (uint8_t) root["color"][6]; - back_color.blue = (uint8_t) root["color"][7]; - xtra_color.white = (uint8_t) root["color"][8]; - xtra_color.red = (uint8_t) root["color"][9]; - xtra_color.green = (uint8_t) root["color"][10]; - xtra_color.blue = (uint8_t) root["color"][11]; + mode = static_cast(root["mode"].as()); + ws2812fx_mode = root["ws2812fx_mode"].as(); + ws2812fx_speed = root["speed"].as(); + brightness = root["brightness"]; + main_color.white = root["color"][0].as(); + main_color.red = root["color"][1].as(); + main_color.green = root["color"][2].as(); + main_color.blue = root["color"][3].as(); + back_color.white = root["color"][4].as(); + back_color.red = root["color"][5].as(); + back_color.green = root["color"][6].as(); + back_color.blue = root["color"][7].as(); + xtra_color.white = root["color"][8].as(); + xtra_color.red = root["color"][9].as(); + xtra_color.green = root["color"][10].as(); + xtra_color.blue = root["color"][11].as(); convertColors(); jsonBuffer.clear(); return true; diff --git a/Arduino/McLighting/version.h b/Arduino/McLighting/version.h index 07c2588..bd7e594 100644 --- a/Arduino/McLighting/version.h +++ b/Arduino/McLighting/version.h @@ -1 +1 @@ -#define SKETCH_VERSION "2.2.3.rgbw.3c" +#define SKETCH_VERSION "2.2.4.rgbw.3c" diff --git a/README.md b/README.md index b56180f..4fd2dcf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # McLighting v2 - The ESP8266 based multi-client lighting gadget -[![Gitter](https://badges.gitter.im/mclighting/Lobby.svg)](https://gitter.im/mclighting/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build Status](https://travis-ci.com/toblum/McLighting.svg?branch=master)](https://travis-ci.com/toblum/McLighting) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![version](https://img.shields.io/badge/version-v2.2.0-blue.svg)](https://github.com/toblum/McLighting/blob/master/Arduino/McLighting/version.h) +[![Gitter](https://badges.gitter.im/mclighting/Lobby.svg)](https://gitter.im/mclighting/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build Status](https://travis-ci.com/toblum/McLighting.svg?branch=master)](https://travis-ci.com/toblum/McLighting) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![version](https://img.shields.io/badge/version-v2.2.4-blue.svg)](https://github.com/toblum/McLighting/blob/master/Arduino/McLighting/version.h) McLighting (the multi-client lighting gadget) is a very cheap internet-controllable lighting solution based on the famous ESP8266 microcontroller and WS2811/2812 led strips. It features among other things a web-interface, a REST-API and a websocket connector. diff --git a/platformio.ini b/platformio.ini index 58cc289..61482b7 100644 --- a/platformio.ini +++ b/platformio.ini @@ -66,7 +66,7 @@ platform = ${common.platform} board_build.f_cpu = 160000000L build_flags = ${common.build_flags} -D D1=2 - -Wl,-Teagle.flash.1m64.ld ; Required for core > v2.5.0 or staging version + -Wl,-Teagle.flash.1m128.ld ; Required for core > v2.5.0 or staging version monitor_speed = ${common.monitor_speed} upload_speed = ${common.upload_speed} upload_resetmethod = ${common.upload_resetmethod}