From b42a340b40143fbadaecb1cf4c65b36c81b5e7f4 Mon Sep 17 00:00:00 2001 From: JonnyTech <3584732+JonnyTech@users.noreply.github.com> Date: Mon, 29 Apr 2024 11:47:21 +0400 Subject: [PATCH] WIP: enhance Serial API JSON The Serial API for JSON currently does not support writing to cfg.json - this is an attempt to add it with code taken from wled_server.cpp - feedback and guidance is needed please because as I non-developer there is something wrong with my implementation that I cannot figure out --- wled00/wled_serial.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wled00/wled_serial.cpp b/wled00/wled_serial.cpp index 9cca09db0c..aa63cd0d8b 100644 --- a/wled00/wled_serial.cpp +++ b/wled00/wled_serial.cpp @@ -123,7 +123,10 @@ void handleSerial() releaseJSONBufferLock(); return; } - verboseResponse = deserializeState(pDoc->as()); + JsonObject root = pDoc->as(); + verboseResponse = deserializeState(root); + //if JSON contains networking key then initiate saving of config + if (root.containsKey("nw")) doSerializeConfig = true; //only send response if TX pin is unused for other purposes if (verboseResponse && (!pinManager.isPinAllocated(hardwareTX) || pinManager.getPinOwner(hardwareTX) == PinOwner::DebugOut)) { pDoc->clear();