mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-09-15 02:54:26 +00:00
[Cleanup] Remove code duplication + concat function to reduce bin size
This commit is contained in:
+12
-8
@@ -18,9 +18,7 @@ PluginTaskData_base *Plugin_task_data[TASKS_MAX] = { nullptr, };
|
||||
|
||||
String PCONFIG_LABEL(int n) {
|
||||
if (n < PLUGIN_CONFIGVAR_MAX) {
|
||||
String result = F("pconf_");
|
||||
result += n;
|
||||
return result;
|
||||
return concat(F("pconf_"), n);
|
||||
}
|
||||
return F("error");
|
||||
}
|
||||
@@ -67,6 +65,11 @@ void initPluginTaskData(taskIndex_t taskIndex, PluginTaskData_base *data) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if FEATURE_PLUGIN_FILTER
|
||||
// TODO TD-er: Implement init
|
||||
|
||||
#endif
|
||||
|
||||
} else if (data != nullptr) {
|
||||
delete data;
|
||||
}
|
||||
@@ -88,10 +91,11 @@ bool pluginTaskData_initialized(taskIndex_t taskIndex) {
|
||||
}
|
||||
|
||||
String getPluginCustomArgName(int varNr) {
|
||||
String argName = F("pc_arg");
|
||||
return getPluginCustomArgName(F("pc_arg"), varNr);
|
||||
}
|
||||
|
||||
argName += varNr + 1;
|
||||
return argName;
|
||||
String getPluginCustomArgName(const __FlashStringHelper * label, int varNr) {
|
||||
return concat(label, varNr + 1);
|
||||
}
|
||||
|
||||
int getFormItemIntCustomArgName(int varNr) {
|
||||
@@ -117,8 +121,8 @@ void pluginWebformShowValue(taskIndex_t taskIndex,
|
||||
}
|
||||
|
||||
pluginWebformShowValue(
|
||||
label, String(F("valuename_")) + taskIndex + '_' + varNr,
|
||||
value, String(F("value_")) + taskIndex + '_' + varNr,
|
||||
label, concat(F("valuename_"), taskIndex) + '_' + varNr,
|
||||
value, concat(F("value_"), taskIndex) + '_' + varNr,
|
||||
addTrailingBreak);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user