NetDebug: store enabled in cfg.json

This commit is contained in:
Ewoud
2023-02-24 22:32:04 +01:00
parent f00558c5f4
commit ebd1e61e78
5 changed files with 1102 additions and 1087 deletions

View File

@@ -17,6 +17,10 @@ void getStringFromJson(char* dest, const char* src, size_t len) {
}
bool deserializeConfig(JsonObject doc, bool fromFS) {
//WLEDMM add USER_PRINT
USER_PRINTF("deserializeConfig\n");
bool needsSave = false;
//int rev_major = doc["rev"][0]; // 1
//int rev_minor = doc["rev"][1]; // 0
@@ -1022,6 +1026,9 @@ void serializeConfig() {
JsonObject usermods_settings = doc.createNestedObject("um");
usermods.addToConfig(usermods_settings);
//WLEDMM add USER_PRINT
USER_PRINTF("serializeConfig\n");
File f = WLED_FS.open("/cfg.json", "w");
if (f) serializeJson(doc, f);
f.close();

View File

@@ -670,7 +670,7 @@ function populateInfo(i)
cn += `v${i.ver} &nbsp;<i>"${vcn}"</i><p>(WLEDMM_${i.ver} ${i.rel}.bin)</p><p><em>build ${i.vid}</em></p><table>
${urows}
${urows===""?'':'<tr><td colspan=2><hr style="height:1px;border-width:0;color:SeaGreen;background-color:Seagreen"></td></tr>'}
${i.opt&0x100?inforow("Net Debug","<button class=\"btn btn-xs\" onclick=\"requestJson({'debug':"+(i.opt&0x0080?"false":"true")+"});\"><i class=\"icons "+(i.opt&0x0080?"on":"off")+"\">&#xe08f;</i></button>"):''}
${i.opt&0x100?inforow("Net Debug","<button class=\"btn btn-xs\" onclick=\"requestJson({'netDebug':"+(i.opt&0x0080?"false":"true")+"});\"><i class=\"icons "+(i.opt&0x0080?"on":"off")+"\">&#xe08f;</i></button>"):''}
${inforow("Build",i.vid)}
${inforow("Signal strength",i.wifi.signal +"% ("+ i.wifi.rssi, " dBm)")}
${inforow("Uptime",getRuntimeStr(i.uptime))}

File diff suppressed because it is too large Load Diff

View File

@@ -342,8 +342,11 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
bool stateResponse = root[F("v")] | false;
//WLEDMM: store netDebug
#if defined(WLED_DEBUG_HOST)
netDebugEnabled = root[F("debug")] | netDebugEnabled;
bool oldValue = netDebugEnabled;
netDebugEnabled = root[F("netDebug")] | netDebugEnabled;
if (oldValue != netDebugEnabled) doSerializeConfig = true; //WLEDMM to make it will be stored in cfg.json! (tbd: check if this is the right approach)
#endif
bool onBefore = bri;
@@ -585,6 +588,11 @@ void serializeState(JsonObject root, bool forPreset, bool includeBri, bool segme
serializeJson(root, temp);
DEBUG_PRINTF("serializeState %s\n", temp.c_str());
//WLEDMM: store netDebug
#if defined(WLED_DEBUG_HOST)
root[F("netDebug")] = netDebugEnabled;
#endif
if (includeBri) {
root["on"] = (bri > 0);
root["bri"] = briLast;

View File

@@ -8,7 +8,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2302232
#define VERSION 2302401
//uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG