diff --git a/wled00/fcn_declare.h b/wled00/fcn_declare.h index 1855a8b63..272228bfe 100644 --- a/wled00/fcn_declare.h +++ b/wled00/fcn_declare.h @@ -235,7 +235,7 @@ void handleRemote(uint8_t *data, size_t len); //set.cpp bool isAsterisksOnly(const char* str, byte maxLen); void handleSettingsSet(AsyncWebServerRequest *request, byte subPage); -bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply=true); +bool handleHttpApi(AsyncWebServerRequest *request, const String& req, bool apply=true); //udp.cpp void notify(byte callMode, bool followUp=false); diff --git a/wled00/ir.cpp b/wled00/ir.cpp index e4541cd90..e7f19228d 100644 --- a/wled00/ir.cpp +++ b/wled00/ir.cpp @@ -608,7 +608,7 @@ static void decodeIRJson(uint32_t code) cmdStr += tmp; } fdo.clear(); // clear JSON buffer (it is no longer needed) - handleSet(nullptr, cmdStr, false); // no stateUpdated() call here + handleHttpApi(nullptr, cmdStr, false); // no stateUpdated() call here } } else { // command is JSON object (TODO: currently will not handle irApplyToAllSelected correctly) diff --git a/wled00/json.cpp b/wled00/json.cpp index 288059653..d2f436a21 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -451,7 +451,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId) if (httpwin) { String apireq = "win"; apireq += '&'; // reduce flash string usage apireq += httpwin; - handleSet(nullptr, apireq, false); // may set stateChanged + handleHttpApi(nullptr, apireq, false); // may set stateChanged } // Applying preset from JSON API has 2 cases: a) "pd" AKA "preset direct" and b) "ps" AKA "preset select" @@ -462,7 +462,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId) if (!root[F("pd")].isNull() && stateChanged) { // a) already applied preset content (requires "seg" or "win" but will ignore the rest) currentPreset = root[F("pd")] | currentPreset; - if (root["win"].isNull()) presetCycCurr = currentPreset; // otherwise presetCycCurr was set in handleSet() [set.cpp] + if (root["win"].isNull()) presetCycCurr = currentPreset; // otherwise presetCycCurr was set in handleHttpApi() [set.cpp] presetToRestore = currentPreset; // stateUpdated() will clear the preset, so we need to restore it after DEBUG_PRINTF_P(PSTR("Preset direct: %d\n"), currentPreset); } else if (!root["ps"].isNull()) { diff --git a/wled00/mqtt.cpp b/wled00/mqtt.cpp index a476db87a..7a46c950a 100644 --- a/wled00/mqtt.cpp +++ b/wled00/mqtt.cpp @@ -109,7 +109,7 @@ static void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProp } else { //HTTP API String apireq = "win"; apireq += '&'; // reduce flash string usage apireq += payloadStr; - handleSet(nullptr, apireq); + handleHttpApi(nullptr, apireq); } releaseJSONBufferLock(); } diff --git a/wled00/presets.cpp b/wled00/presets.cpp index 04474113d..95f1b311f 100644 --- a/wled00/presets.cpp +++ b/wled00/presets.cpp @@ -183,7 +183,7 @@ void handlePresets() String apireq = "win"; // reduce flash string usage apireq += F("&IN&"); // internal call apireq += httpwin; - handleSet(nullptr, apireq, false); // may call applyPreset() via PL= + handleHttpApi(nullptr, apireq, false); // may call applyPreset() via PL= setValuesFromFirstSelectedSeg(); // fills legacy values changePreset = true; } else { @@ -208,7 +208,7 @@ void handlePresets() updateInterfaces(tmpMode); } -//called from handleSet(PS=) [network callback (sObj is empty), IR (irrational), deserializeState, UDP] and deserializeState() [network callback (filedoc!=nullptr)] +//called from handleHttpApi(PS=) [network callback (sObj is empty), IR (irrational), deserializeState, UDP] and deserializeState() [network callback (filedoc!=nullptr)] void savePreset(byte index, const char* pname, JsonObject sObj) { if (!saveName) saveName = new char[33]; diff --git a/wled00/remote.cpp b/wled00/remote.cpp index 9bc5430c0..d1fe5d799 100644 --- a/wled00/remote.cpp +++ b/wled00/remote.cpp @@ -162,7 +162,7 @@ static bool remoteJson(int button) cmdStr += tmp; } fdo.clear(); // clear JSON buffer (it is no longer needed) - handleSet(nullptr, cmdStr, false); // no stateUpdated() call here + handleHttpApi(nullptr, cmdStr, false); // no stateUpdated() call here stateUpdated(CALL_MODE_BUTTON); parsed = true; } diff --git a/wled00/set.cpp b/wled00/set.cpp index 712e5f254..aaf3fac2e 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -803,7 +803,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) //HTTP API request parser -bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply) +bool handleHttpApi(AsyncWebServerRequest *request, const String& req, bool apply) { if (!(req.indexOf("win") >= 0)) return false; diff --git a/wled00/udp.cpp b/wled00/udp.cpp index 60774d701..82bfb4607 100644 --- a/wled00/udp.cpp +++ b/wled00/udp.cpp @@ -683,7 +683,7 @@ void handleNotifications() if (udpIn[0] >= 'A' && udpIn[0] <= 'Z') { //HTTP API String apireq = "win"; apireq += '&'; // reduce flash string usage apireq += (char*)udpIn; - handleSet(nullptr, apireq); + handleHttpApi(nullptr, apireq); } else if (udpIn[0] == '{') { //JSON API DeserializationError error = deserializeJson(*pDoc, udpIn); JsonObject root = pDoc->as(); diff --git a/wled00/wled_server.cpp b/wled00/wled_server.cpp index e8cbb41ae..4cbad416a 100644 --- a/wled00/wled_server.cpp +++ b/wled00/wled_server.cpp @@ -482,7 +482,7 @@ void initServer() return; } - if(handleSet(request, request->url())) return; + if(handleHttpApi(request, request->url())) return; #ifndef WLED_DISABLE_ALEXA if(espalexa.handleAlexaApiCall(request)) return; #endif