From 88ba127910a53d485d0731e6d3f8d1e88c0aa88b Mon Sep 17 00:00:00 2001 From: Ewoud Date: Fri, 24 Feb 2023 18:15:02 +0100 Subject: [PATCH] Initial steps allow NetDebug while WLED_DEBUG is off + on/off persistent Both WIP! --- wled00/cfg.cpp | 2 ++ wled00/json.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 18621290..9807f92f 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -479,6 +479,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { for (byte i = 0; i < 4; i++) CJSON(netDebugPrintIP[i], if_ndb_ip[i]); CJSON(netDebugPrintPort, if_ndb["port"]); + CJSON(netDebugEnabled, if_ndb["enabled"]); #endif JsonObject if_ntp = interfaces[F("ntp")]; @@ -947,6 +948,7 @@ void serializeConfig() { if_ndb_ip.add(netDebugPrintIP[i]); } if_ndb["port"] = netDebugPrintPort; + if_ndb["enabled"] = netDebugEnabled; #endif JsonObject if_ntp = interfaces.createNestedObject("ntp"); diff --git a/wled00/json.cpp b/wled00/json.cpp index 72ad007a..cef6480b 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -342,7 +342,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId) bool stateResponse = root[F("v")] | false; - #if defined(WLED_DEBUG) && defined(WLED_DEBUG_HOST) + #if defined(WLED_DEBUG_HOST) netDebugEnabled = root[F("debug")] | netDebugEnabled; #endif @@ -916,10 +916,10 @@ void serializeInfo(JsonObject root) uint16_t os = 0; #ifdef WLED_DEBUG os = 0x80; - #ifdef WLED_DEBUG_HOST - os |= 0x0100; - if (!netDebugEnabled) os &= ~0x0080; - #endif + #endif + #ifdef WLED_DEBUG_HOST + os |= 0x0100; + if (!netDebugEnabled) os &= ~0x0080; #endif #ifndef WLED_DISABLE_ALEXA os += 0x40;