Skip to content

Commit 292fc78

Browse files
committed
Bump ArduinoJson dependency
Fixes (#23)
1 parent 6357db4 commit 292fc78

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ FastLEDHub allows you to manage all of your [FastLED]([FastLED](https://github.c
2727

2828
### Library dependencies
2929

30-
- ArduinoJson ≥ 6.0
30+
- ArduinoJson ≥ 7.0
3131
- ESPEssentials ≥ 2.1
3232
- FastLED
3333
- LinkedList

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
"url": "https://github.com/srwi"
1919
},
2020
"license": "LGPL-2.1-or-later",
21-
"version": "2.1.3"
21+
"version": "2.2"
2222
}

library.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name=FastLEDHub
2-
version=2.1.3
2+
version=2.2
33
author=Stephan Rumswinkel
44
maintainer=Stephan Rumswinkel
55
sentence=Control multiple FastLED lightstrip animations on the ESP8266 and ESP32 without reuploading.
66
paragraph=FastLEDHub allows you to manage all of your FastLED sketches on the ESP8266 and ESP32 with minimal changes to your existing code. It requires little knowledge about the ESP8266/ESP32 platform making in an ideal playground for beginners getting started with FastLED animations.
77
url=https://github.com/srwi/FastLEDHub.git
88
category=Display
99
architectures=esp8266,esp32
10-
depends=WiFiManager,ESPEssentials,ArduinoJson,LinkedList,FastLED,WebSockets
10+
depends=WiFiManager (>= 2.0.0),ESPEssentials (>= 2.1.0),ArduinoJson (>= 7.0.0),LinkedList,FastLED,WebSockets

src/Config.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ bool ConfigClass::initialize()
5050

5151
bool ConfigClass::parseJson(const char *input)
5252
{
53-
StaticJsonDocument<1024> doc;
53+
JsonDocument doc;
5454
DeserializationError error = deserializeJson(doc, input);
5555

5656
if (doc.containsKey("timeZone"))
@@ -128,12 +128,12 @@ void ConfigClass::getUserConfigJson(JsonDocument &doc)
128128
doc["sunsetOffset"] = sunsetOffset;
129129
doc["sunsetAnimation"] = sunsetAnimation;
130130
doc["startupAnimation"] = startupAnimation;
131-
JsonArray sliderValueArray = doc.createNestedArray("sliderValues");
131+
JsonArray sliderValueArray = doc["sliderValues"].to<JsonArray>();
132132
for (uint16_t i = 0; i < sliderValues.size(); i++)
133133
{
134134
sliderValueArray.add(sliderValues.get(i));
135135
}
136-
JsonArray colorPickerValueArray = doc.createNestedArray("colorPickerValues");
136+
JsonArray colorPickerValueArray = doc["colorPickerValues"].to<JsonArray>();
137137
for (uint16_t i = 0; i < colorPickerValues.size(); i++)
138138
{
139139
colorPickerValueArray.add(rgb2hex(colorPickerValues.get(i)));
@@ -144,26 +144,26 @@ void ConfigClass::getApplicationStateJson(JsonDocument &doc)
144144
{
145145
doc["status"] = FastLEDHub.getStatus();
146146
doc["currentAnimation"] = FastLEDHub.getCurrentAnimationName();
147-
JsonArray animations = doc.createNestedArray("animations");
147+
JsonArray animations = doc["animations"].to<JsonArray>();
148148
for (uint8_t i = 0; i < FastLEDHub.animations.size(); i++)
149149
{
150150
animations.add(FastLEDHub.animations.get(i)->getName());
151151
}
152-
JsonArray sliders = doc.createNestedArray("sliders");
152+
JsonArray sliders = doc["sliders"].to<JsonArray>();
153153
for (uint8_t i = 0; i < FastLEDHub.sliders.size(); i++)
154154
{
155-
JsonObject slider = sliders.createNestedObject();
155+
JsonObject slider = sliders.add<JsonObject>();
156156
slider["name"] = FastLEDHub.sliders.get(i)->name;
157157
slider["min"] = FastLEDHub.sliders.get(i)->min;
158158
slider["max"] = FastLEDHub.sliders.get(i)->max;
159159
slider["step"] = FastLEDHub.sliders.get(i)->step;
160160
slider["value"] = FastLEDHub.sliders.get(i)->value;
161161
slider["icon"] = FastLEDHub.sliders.get(i)->icon;
162162
}
163-
JsonArray colorPickers = doc.createNestedArray("colorPickers");
163+
JsonArray colorPickers = doc["colorPickers"].to<JsonArray>();
164164
for (uint8_t i = 0; i < FastLEDHub.colorPickers.size(); i++)
165165
{
166-
JsonObject colorPicker = colorPickers.createNestedObject();
166+
JsonObject colorPicker = colorPickers.add<JsonObject>();
167167
colorPicker["name"] = FastLEDHub.colorPickers.get(i)->name;
168168
colorPicker["value"] = rgb2hex(FastLEDHub.colorPickers.get(i)->value);
169169
colorPicker["icon"] = FastLEDHub.colorPickers.get(i)->icon;
@@ -172,7 +172,7 @@ void ConfigClass::getApplicationStateJson(JsonDocument &doc)
172172

173173
String ConfigClass::asString(bool includeApplicationState)
174174
{
175-
DynamicJsonDocument doc(3072);
175+
JsonDocument doc;
176176

177177
getUserConfigJson(doc);
178178

0 commit comments

Comments
 (0)