Skip to content

Commit

Permalink
Merge pull request #4840 from tonhuisman/feature/UI-show-controller-s…
Browse files Browse the repository at this point in the history
…tate-on-device-page

[UI] Show Controller-state on Device page
  • Loading branch information
TD-er authored Oct 12, 2023
2 parents 73bc76d + 3e63a58 commit b4f9d48
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
5 changes: 1 addition & 4 deletions src/src/Globals/CPlugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,7 @@ String getCPluginNameFromCPluginID(cpluginID_t cpluginID) {
protocolIndex_t protocolIndex = getProtocolIndex_from_CPluginID_(cpluginID);

if (!validProtocolIndex(protocolIndex)) {
String name = F("CPlugin ");
name += String(static_cast<int>(cpluginID));
name += F(" not included in build");
return name;
return strformat(F("CPlugin %d not included in build"), cpluginID);
}
return getCPluginNameFromProtocolIndex(protocolIndex);
}
17 changes: 5 additions & 12 deletions src/src/Globals/Plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ String getPluginNameFromPluginID(pluginID_t pluginID) {
deviceIndex_t deviceIndex = getDeviceIndex(pluginID);

if (!validDeviceIndex(deviceIndex)) {
String name = F("Plugin ");
name += String(pluginID.value);
name += F(" not included in build");
return name;
return strformat(F("Plugin %d not included in build"), pluginID.value);
}
return getPluginNameFromDeviceIndex(deviceIndex);
}
Expand Down Expand Up @@ -654,14 +651,10 @@ bool PluginCall(uint8_t Function, struct EventStruct *event, String& str)
clearPluginTaskData(taskIndex); // Make sure any task data is actually cleared.
if (PluginCallForTask(taskIndex, PLUGIN_INIT, &TempEvent, str, event) &&
loglevelActiveFor(LOG_LEVEL_INFO)) {
String log;
log.reserve(80);
log += concat(F("INIT : Started Priority task "), static_cast<int>(taskIndex + 1));
log += F(", [");
log += getTaskDeviceName(taskIndex);
log += F("] ");
log += getPluginNameFromDeviceIndex(getDeviceIndex_from_TaskIndex(taskIndex));
addLogMove(LOG_LEVEL_INFO, log);
addLogMove(LOG_LEVEL_INFO, strformat(F("INIT : Started Priority task %d, [%s] %s"),
taskIndex + 1,
getTaskDeviceName(taskIndex).c_str(),
getPluginNameFromDeviceIndex(getDeviceIndex_from_TaskIndex(taskIndex)).c_str()));
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/src/WebServer/DevicesPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,8 @@ void devicePage_show_controller_config(taskIndex_t taskIndex, deviceIndex_t Devi
html_TR_TD();
addHtml(F("Send to Controller "));
addHtml(getControllerSymbol(controllerNr));
addHtmlDiv(F("note"), wrap_braces(getCPluginNameFromCPluginID(Settings.Protocol[controllerNr])));
addHtmlDiv(F("note"), wrap_braces(getCPluginNameFromCPluginID(Settings.Protocol[controllerNr]) + F(", ") + // Most compact code...
(Settings.ControllerEnabled[controllerNr] ? F("enabled") : F("disabled"))));
html_TD();

addHtml(F("<table style='padding-left:0;'>")); // remove left padding 2x to align vertically with other inputs
Expand Down

0 comments on commit b4f9d48

Please sign in to comment.