[Build] Reduce build size by reducing number possible concat functions

This commit is contained in:
TD-er committed 2026-09-13 23:26:21 +02:00
1 parent 9950d33e38
commit 45c456aaf6
7 files changed
+81 -29

No files matched your search

+1 -1
View File
@@ -472,7 +472,7 @@ void WiFiScan_log_to_serial()
setWifiMode(cur_wifimode);
}
const int8_t scanCompleteStatus = WiFi_AP_Candidates.scanComplete();
const int scanCompleteStatus = WiFi_AP_Candidates.scanComplete();
if (scanCompleteStatus <= 0) {
serialPrintln(concat(F("WIFI : No networks found. Status: "), scanCompleteStatus));
+1 -1
View File
@@ -51,7 +51,7 @@ boolean Plugin_029(uint8_t function, struct EventStruct *event, String& string)
case PLUGIN_WEBFORM_LOAD:
{
// We need the index of the controller we are: 0-CONTROLLER_MAX
uint8_t controllerNr = 0;
uint32_t controllerNr = 0;
for (controllerIndex_t i = 0; i < CONTROLLER_MAX; i++)
{
+1 -1
View File
@@ -178,7 +178,7 @@ boolean Plugin_059(uint8_t function, struct EventStruct *event, String& string)
{
if (P_059_sensordefs[event->TaskIndex]->hasChanged())
{
const long c = P_059_sensordefs[event->TaskIndex]->read();
const int c = P_059_sensordefs[event->TaskIndex]->read();
UserVar.setFloat(event->TaskIndex, 0, c);
#ifndef BUILD_NO_DEBUG
if (loglevelActiveFor(LOG_LEVEL_INFO)) {
+2 -2
View File
@@ -246,7 +246,7 @@ boolean Plugin_180(uint8_t function, struct EventStruct *event, String& string)
addFormCheckBox(F("Parsing & executing log (INFO)"), F("plog"), P180_LOG_DEBUG == 1);
for (uint8_t i = 0; i < P180_NR_OUTPUT_VALUES; ++i) {
for (uint32_t i = 0; i < P180_NR_OUTPUT_VALUES; ++i) {
addFormSubHeader(strformat(F("Value %d I2C Commands"), i + 1));
// type
@@ -289,7 +289,7 @@ boolean Plugin_180(uint8_t function, struct EventStruct *event, String& string)
{
String strings[P180_CUSTOM_BUFFER_SIZE];
for (uint8_t varNr = 0; varNr < VARS_PER_TASK; varNr++) {
for (uint32_t varNr = 0; varNr < VARS_PER_TASK; varNr++) {
strings[P180_BUFFER_START_CACHE + varNr] = webArg(getPluginCustomArgName(20 + varNr)); // Name
if (strings[P180_BUFFER_START_CACHE + varNr].isEmpty()) {
+58 -20
View File
@@ -46,12 +46,6 @@ String concat(const __FlashStringHelper * str, const String &val) {
reserve_special(res, strlen_P((PGM_P)str) + val.length());
res.concat(str);
res.concat(val);
/*
String res(str);
reserve_special(res, res.length() + val.length());
res.concat(val);
*/
return res;
}
@@ -66,37 +60,66 @@ String concat(const __FlashStringHelper * str, const char* val) {
return res;
}
String concat(const __FlashStringHelper * str, const int& val)
String concat(const __FlashStringHelper * str, int val)
{
return concat(str, String(val));
}
String concat(const __FlashStringHelper * str, const char& c)
{
return concat(String(str), c);
}
String concat(const __FlashStringHelper * str, const float& val)
{
return concat(str, toString(val));
}
String concat(const __FlashStringHelper * str, const double& val)
{
return concat(str, doubleToString(val));
}
#if defined(ESP32) && !defined(__riscv)
String concat(const __FlashStringHelper * str, const int32_t& val)
{
return concat(str, String(val));
}
#endif
String concat(const __FlashStringHelper * str, const uint32_t& val)
{
return concat(str, String(val));
}
#if defined(ESP32) && !defined(__riscv)
String concat(const __FlashStringHelper * str, const size_t& val)
{
return concat(str, String(val));
}
#endif
String concat(const char& c, const __FlashStringHelper *val)
{
return concat(String(c), val);
}
String concat(int i, const __FlashStringHelper *val)
{
String res;
res = i;
res += val;
return res;
return concat(String(i), val);
}
String concat(uint32_t i, const __FlashStringHelper *val)
{
String res;
res = i;
res += val;
return res;
return concat(String(i), val);
}
String concat(const String & str, const __FlashStringHelper *val)
{
String res;
res = str;
res += val;
reserve_special(res, str.length() + strlen_P((PGM_P)val));
res.concat(str);
res.concat(val);
return res;
}
@@ -113,15 +136,15 @@ String concat(const String & str, const String & val)
String concat(const String & str, const char* val)
{
String res;
res = str;
res += val;
reserve_special(res, str.length() + strlen_P((PGM_P)val));
res.concat(str);
res.concat(val);
return res;
}
String concat(const String &val, const char& c)
{
String res;
res.reserve(val.length() + 1);
res = val;
res += c;
return res;
@@ -134,6 +157,21 @@ String concat(String &&val, const char& c)
return res;
}
String concat(String &&str, const __FlashStringHelper * val)
{
String res(std::move(str));
res += val;
return res;
}
String concat(const __FlashStringHelper *str, String && val)
{
String res;
res += str;
res += std::move(val);
return res;
}
String concat(const char& str, const String &val)
{
String res(str);
+16 -2
View File
@@ -26,8 +26,19 @@ String concat(const __FlashStringHelper * str, const String &val);
String concat(const __FlashStringHelper * str, const __FlashStringHelper *val);
String concat(const __FlashStringHelper * str, const char* val);
String concat(const __FlashStringHelper * str, const int& val);
String concat(const __FlashStringHelper * str, int val);
String concat(const __FlashStringHelper * str, const char& c);
#if defined(ESP32) && !defined(__riscv)
String concat(const __FlashStringHelper * str, const int32_t& val);
#endif
String concat(const __FlashStringHelper * str, const float& val);
String concat(const __FlashStringHelper * str, const double& val);
String concat(const __FlashStringHelper * str, const uint32_t& val);
#if defined(ESP32) && !defined(__riscv)
String concat(const __FlashStringHelper * str, const size_t& val);
#endif
String concat(const char& c, const __FlashStringHelper *val);
String concat(int i, const __FlashStringHelper *val);
String concat(uint32_t i, const __FlashStringHelper *val);
String concat(const String & str, const __FlashStringHelper *val);
@@ -35,10 +46,12 @@ String concat(const String & str, const String & val);
String concat(const String & str, const char* val);
String concat(const String & val, const char& c);
String concat(String &&val, const char& c);
String concat(String &&str, const __FlashStringHelper * val);
String concat(const __FlashStringHelper *str, String && val);
String concat(const char& str, const String &val);
/*
template <typename T>
String concat(const __FlashStringHelper * str, const T &val) {
# ifdef USE_SECOND_HEAP
@@ -49,6 +62,7 @@ String concat(const __FlashStringHelper * str, const T &val) {
res.concat(val);
return res;
}
*/
/*
template <typename T>
String concat(const String& str, const T &val) {
+2 -2
View File
@@ -704,7 +704,7 @@ KeyValueStruct getKeyValue(LabelType::Enum label, bool extendedValue)
url.c_str(),
url.c_str()));
}
return make_kv(F("mDNS"), url);
return make_kv(F("mDNS"), std::move(url));
}
case LabelType::USE_MDNS:
{
@@ -897,7 +897,7 @@ KeyValueStruct getKeyValue(LabelType::Enum label, bool extendedValue)
}
case LabelType::BUILD_TIME:
{
return make_kv(F("Build Time"), concat(concat(get_build_date(), ' '), get_build_time()));
return make_kv(F("Build Time"), concat(get_build_date(), concat(' ', get_build_time())));
}
case LabelType::BINARY_FILENAME:
{