Unaccessible wsec.json and preset loading fix

This commit is contained in:
cschwinne 2020-11-09 11:09:47 +01:00
parent 1f42070104
commit 7f973ad131
5 changed files with 22 additions and 7 deletions

View File

@ -171,9 +171,9 @@ lib_deps =
ESPAsyncTCP@1.2.0
ESPAsyncUDP
AsyncTCP@1.0.3
https://github.com/Aircoookie/ESPAsyncWebServer
IRremoteESP8266@2.7.3
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

View File

@ -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() {

View File

@ -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);

View File

@ -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);

View File

@ -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.
@ -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