Skip to content

Commit

Permalink
Unaccessible wsec.json and preset loading fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aircoookie committed Nov 9, 2020
1 parent 1f42070 commit 7f973ad
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ lib_deps =
[email protected]
ESPAsyncUDP
[email protected]
https://github.com/Aircoookie/ESPAsyncWebServer
[email protected]
https://github.com/lorol/LITTLEFS.git
https://github.com/Aircoookie/ESPAsyncWebServer.git@~2.0.0
#For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line
#TFT_eSPI
#For use SSD1306 OLED display uncomment following
Expand Down
16 changes: 15 additions & 1 deletion wled00/cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,21 @@ void deserializeConfig() {
getStringFromJson(otaPass, pwd, 33); //normally not present due to security
}


#ifdef WLED_ENABLE_DMX
JsonObject dmx = doc["dmx"];
CJSON(DMXChannels, dmx[F("chan")]);
CJSON(DMXGap,dmx[F("gap")]);
CJSON(DMXStart, dmx[F("start")]);
CJSON(DMXStartLED,dmx[F("start-led")]);

JsonArray dmx_fixmap = dmx.createNestedArray("fixmap");
it = 0;
for (int i : dmx_fixmap) {
if (it > 14) break;
DMXFixtureMap[i] = i;
it++;
}
#endif
}

void serializeConfig() {
Expand Down
3 changes: 2 additions & 1 deletion wled00/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,12 @@ bool appendObjectToFile(const char* key, JsonDocument* content, uint32_t s, uint
{
pos = f.position();
}
if (pos > 0) pos--;
}
DEBUGFS_PRINT("pos "); DEBUGFS_PRINTLN(pos);
if (pos > 2)
{
f.seek(pos -1, SeekSet);
f.seek(pos, SeekSet);
f.write(',');
} else { //file content is not valid JSON object
f.seek(0, SeekSet);
Expand Down
2 changes: 1 addition & 1 deletion wled00/presets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ bool applyPreset(byte index)
DEBUGFS_PRINTLN(F("Make read buf"));
DynamicJsonDocument fDoc(JSON_BUFFER_SIZE);
errorFlag = readObjectFromFileUsingId("/presets.json", index, &fDoc) ? ERR_NONE : ERR_FS_PLOAD;
JsonObject fdo = fileDoc->as<JsonObject>();
JsonObject fdo = fDoc.as<JsonObject>();
if (fdo["ps"] == index) fdo.remove("ps");
#ifdef WLED_DEBUG_FS
serializeJson(fDoc, Serial);
Expand Down
6 changes: 3 additions & 3 deletions wled00/wled.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

// version code in format yymmddb (b = daily build)
#define VERSION 2011090
#define VERSION 2011091

// ESP8266-01 (blue) got too little storage space to work with WLED. 0.10.2 is the last release supporting this unit.

Expand Down Expand Up @@ -115,11 +115,11 @@
#define CLIENT_PASS ""
#endif

/*#ifndef SPIFFS_EDITOR_AIRCOOOKIE
#ifndef SPIFFS_EDITOR_AIRCOOOKIE
#error You are not using the Aircoookie fork of the ESPAsyncWebserver library.\
Using upstream puts your WiFi password at risk of being served by the filesystem.\
Comment out this error message to build regardless.
#endif*/
#endif

#if IR_PIN < 0
#ifndef WLED_DISABLE_INFRARED
Expand Down

0 comments on commit 7f973ad

Please sign in to comment.