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,18 +664,9 @@ void decodeIRJson(uint32_t code)
} }
} else { } else {
// HTTP API command // HTTP API command
if (cmdStr.indexOf("~") || fdo["rpt"]) String apireq = "win"; apireq += '&'; // reduce flash string usage
{ if (cmdStr.indexOf("~") || fdo["rpt"]) lastValidCode = code; // repeatable action
// repeatable action if (!cmdStr.startsWith(apireq)) cmdStr = apireq + cmdStr; // if no "win&" prefix
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) fdo.clear(); // clear JSON buffer (it is no longer needed)
handleSet(nullptr, cmdStr, false); // no colorUpdated() call here handleSet(nullptr, cmdStr, false); // no colorUpdated() call here
} }

View File

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

View File

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

View File

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

View File

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

View File

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