Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/src/CustomBuild/define_plugin_sets.h
Original file line number Diff line number Diff line change
Expand Up @@ -4556,4 +4556,9 @@ To create/register a plugin, you have to :
#endif
#endif // if !FEATURE_SPI && !FEATURE_I2C && !FEATURE_MODBUS && !FEATURE_CAN && !FEATURE_WRMBUS && !FEATURE_WIMBUS


#if defined(FEATURE_P043_CLK_TIMES_JSON) && !defined(USES_P043)
#undef FEATURE_P043_CLK_TIMES_JSON
Comment thread
chromoxdor marked this conversation as resolved.
#endif

#endif // CUSTOMBUILD_DEFINE_PLUGIN_SETS_H
25 changes: 25 additions & 0 deletions src/src/WebServer/JSON.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,31 @@ void handle_json()
}
}

#if FEATURE_P043_CLK_TIMES_JSON
if (Settings.getPluginID_for_task(TaskIndex).value == 43) {
Comment thread
chromoxdor marked this conversation as resolved.
Outdated
taskWriter->write({ (F("OnOff")), Settings.TaskDevicePluginConfig[TaskIndex][(6)] });
auto timesWriter = taskWriter->createChildArray(F("Times"));

if (timesWriter)
{
const int count = Settings.TaskDevicePluginConfig[TaskIndex][7];
const int offset = (validGpio(Settings.TaskDevicePin[1][TaskIndex]) ||
(count == 1)) ? 1 : 0;

for (int x = 0; x < count; x++) {
auto timeWriter = timesWriter->createChild();
long value = Cache.getTaskDevicePluginConfigLong(TaskIndex, x);
int val = ExtraTaskSettings.TaskDevicePluginConfig[x] - offset;
Comment thread
chromoxdor marked this conversation as resolved.
Outdated

if (timeWriter) {
timeWriter->write({ F("Time"), timeLong2String(value) });
timeWriter->write({ F("Value"), val });
}
}
}
}
#endif // FEATURE_P043_CLK_TIMES_JSON

#if FEATURE_PLUGIN_STATS && FEATURE_CHART_JS

if (showPluginStats && Device[DeviceIndex].PluginStats) {
Expand Down