Save a bit of RAM and flash.

This commit is contained in:
Blaz Kristan 2022-02-19 20:34:37 +01:00
parent 59ce88f044
commit d7dac57a07
6 changed files with 10 additions and 19 deletions

View File

@ -664,20 +664,11 @@ void decodeIRJson(uint32_t code)
}
} else {
// HTTP API command
if (cmdStr.indexOf("~") || fdo["rpt"])
{
// repeatable action
lastValidCode = code;
}
if (effectCurrent == 0 && cmdStr.indexOf("FP=") > -1) {
// setting palette but it wont show because effect is solid
effectCurrent = FX_MODE_GRADIENT;
}
if (!cmdStr.startsWith("win&")) {
cmdStr = "win&" + cmdStr;
}
fdo.clear(); //clear JSON buffer (it is no longer needed)
handleSet(nullptr, cmdStr, false); // no colorUpdated() call here
String apireq = "win"; apireq += '&'; // reduce flash string usage
if (cmdStr.indexOf("~") || fdo["rpt"]) lastValidCode = code; // repeatable action
if (!cmdStr.startsWith(apireq)) cmdStr = apireq + cmdStr; // if no "win&" prefix
fdo.clear(); // clear JSON buffer (it is no longer needed)
handleSet(nullptr, cmdStr, false); // no colorUpdated() call here
}
} else {
// command is JSON object

View File

@ -365,7 +365,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
//HTTP API commands
const char* httpwin = root["win"];
if (httpwin) {
String apireq = "win&";
String apireq = "win"; apireq += '&'; // reduce flash string usage
apireq += httpwin;
handleSet(nullptr, apireq, false);
}

View File

@ -96,7 +96,7 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties
deserializeJson(doc, payloadStr);
deserializeState(doc.as<JsonObject>());
} else { //HTTP API
String apireq = "win&";
String apireq = "win"; apireq += '&'; // reduce flash string usage
apireq += (char*)payloadStr;
handleSet(nullptr, apireq);
}

View File

@ -45,7 +45,7 @@ void handlePresets()
//HTTP API commands
const char* httpwin = fdo["win"];
if (httpwin) {
String apireq = "win&";
String apireq = "win"; apireq += '&'; // reduce flash string usage
apireq += httpwin;
handleSet(nullptr, apireq, false);
} else {

View File

@ -514,7 +514,7 @@ void handleNotifications()
if (requestJSONBufferLock(18)) {
if (udpIn[0] >= 'A' && udpIn[0] <= 'Z') { //HTTP API
String apireq = "win&";
String apireq = "win"; apireq += '&'; // reduce flash string usage
apireq += (char*)udpIn;
handleSet(nullptr, apireq);
} else if (udpIn[0] == '{') { //JSON API

View File

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