Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,6 @@ src/src/CustomBuild/CompiletimeDefines_generated.h
sdkconfig.*

src/Custom_.h
src/idf_component.yml

compile_commands.json
4 changes: 2 additions & 2 deletions src/_C002.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ bool CPlugin_002(CPlugin::Function function, struct EventStruct *event, String&
constexpr pluginID_t PLUGIN_ID_HEATPUMP_IR(88);
# endif // if defined(USES_P088)

if (Settings.TaskDeviceEnabled[x] &&
(Settings.TaskDeviceSendData[ControllerID][x]
if (Settings.TaskDeviceEnabled(x) &&
(Settings.TaskDeviceSendData(ControllerID, x)
|| (Settings.getPluginID_for_task(x) == PLUGIN_ID_DOMOTICZ_HELPER) // Domoticz helper doesn't have controller checkboxes...
# if defined(USES_P088)
|| (Settings.getPluginID_for_task(x) == PLUGIN_ID_HEATPUMP_IR) // Heatpump IR doesn't have controller checkboxes...
Expand Down
8 changes: 4 additions & 4 deletions src/_C013.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ void C013_Receive(struct EventStruct *event) {
if (currentPluginID == infoReply->deviceNumber) {
// Check to see if task already is set to receive from this host
if ((Settings.TaskDeviceDataFeed[infoReply->destTaskIndex] == infoReply->sourceUnit) &&
Settings.TaskDeviceEnabled[infoReply->destTaskIndex]) {
Settings.TaskDeviceEnabled(infoReply->destTaskIndex)) {
mustUpdateCurrentTask = true;
}
}
Expand All @@ -285,7 +285,7 @@ void C013_Receive(struct EventStruct *event) {
Settings.TaskDeviceDataFeed[infoReply->destTaskIndex] = infoReply->sourceUnit; // remote feed store unit nr sending the data

if (mustUpdateCurrentTask) {
Settings.TaskDeviceEnabled[infoReply->destTaskIndex] = true;
Settings.TaskDeviceEnabled(infoReply->destTaskIndex, true);
}

constexpr pluginID_t DUMMY_PLUGIN_ID{ 33 };
Expand All @@ -296,7 +296,7 @@ void C013_Receive(struct EventStruct *event) {
}

for (controllerIndex_t x = 0; x < CONTROLLER_MAX; x++) {
Settings.TaskDeviceSendData[x][infoReply->destTaskIndex] = false;
Settings.TaskDeviceSendData(x, infoReply->destTaskIndex, false);
}
safe_strncpy(ExtraTaskSettings.TaskDeviceName, infoReply->taskName, sizeof(infoReply->taskName));

Expand Down Expand Up @@ -332,7 +332,7 @@ void C013_Receive(struct EventStruct *event) {
SaveTaskSettings(taskIndex);
SaveSettings();

if (Settings.TaskDeviceEnabled[taskIndex]) {
if (Settings.TaskDeviceEnabled(taskIndex)) {
struct EventStruct TempEvent(taskIndex);
TempEvent.Source = EventValueSource::Enum::VALUE_SOURCE_UDP;

Expand Down
2 changes: 1 addition & 1 deletion src/_C014.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ bool CPlugin_014(CPlugin::Function function, struct EventStruct *event, String&

deviceName = getTaskDeviceName(x);

if (validDeviceIndex(DeviceIndex) && Settings.TaskDeviceEnabled[x]) { // Device is enabled so send information
if (validDeviceIndex(DeviceIndex) && Settings.TaskDeviceEnabled(x)) { // Device is enabled so send information
// device enabled
valuesList = EMPTY_STRING;

Expand Down
6 changes: 3 additions & 3 deletions src/_C015.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ bool CPlugin_015(CPlugin::Function function, struct EventStruct *event, String&
if (validProtocolIndex(ProtocolIndex)) {
const cpluginID_t number = getCPluginID_from_ProtocolIndex(ProtocolIndex);

if ((i != event->ControllerIndex) && (number == 15) && Settings.ControllerEnabled[i]) {
if ((i != event->ControllerIndex) && (number == 15) && Settings.ControllerEnabled(i)) {
success = false;

// FIXME: this will only show a warning message and not uncheck "enabled" in webform.
Expand Down Expand Up @@ -182,7 +182,7 @@ bool CPlugin_015(CPlugin::Function function, struct EventStruct *event, String&
break;
}

if (!Settings.ControllerEnabled[event->ControllerIndex]) {
if (!Settings.ControllerEnabled(event->ControllerIndex)) {
break;
}

Expand Down Expand Up @@ -270,7 +270,7 @@ bool do_process_c015_delay_queue(cpluginID_t cpluginID, const Queue_element_base
const C015_queue_element& element = static_cast<const C015_queue_element&>(element_base);

// *INDENT-ON*
if (!Settings.ControllerEnabled[element._controller_idx]) {
if (!Settings.ControllerEnabled(element._controller_idx)) {
// controller has been disabled. Answer true to flush queue.
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/_P001_Switch.ino
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ boolean Plugin_001(uint8_t function, struct EventStruct *event, String& string)
}
success = true;
} else {
success = getDiscoveryVType(event, Settings.TaskDevicePin1Inversed[event->TaskIndex]
success = getDiscoveryVType(event, Settings.TaskDevicePin1Inversed(event->TaskIndex)
? Plugin_QueryVType_BinarySensorInv
: Plugin_QueryVType_BinarySensor, 255, event->Par5);
# if FEATURE_MQTT_DEVICECLASS
Expand Down
2 changes: 1 addition & 1 deletion src/_P003_Pulse.ino
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ boolean Plugin_003(uint8_t function, struct EventStruct *event, String& string)
config.gpio = CONFIG_PIN1;
config.taskIndex = event->TaskIndex;
config.interruptPinMode = static_cast<Internal_GPIO_pulseHelper::GPIOtriggerMode>(PCONFIG(P003_IDX_MODETYPE));
config.pullupPinMode = Settings.TaskDevicePin1PullUp[event->TaskIndex] ? INPUT_PULLUP : INPUT;
config.pullupPinMode = Settings.TaskDevicePin1PullUp(event->TaskIndex) ? INPUT_PULLUP : INPUT;

// FIXME TD-er: Must set the state using globalMapPortStatus

Expand Down
2 changes: 1 addition & 1 deletion src/_P009_MCP.ino
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ boolean Plugin_009(uint8_t function, struct EventStruct *event, String& string)
# if FEATURE_MQTT_DISCOVER
case PLUGIN_GET_DISCOVERY_VTYPES:

success = getDiscoveryVType(event, Settings.TaskDevicePin1Inversed[event->TaskIndex]
success = getDiscoveryVType(event, Settings.TaskDevicePin1Inversed(event->TaskIndex)
? Plugin_QueryVType_BinarySensorInv
: Plugin_QueryVType_BinarySensor, 255, event->Par5);
# if FEATURE_MQTT_DEVICECLASS
Expand Down
2 changes: 1 addition & 1 deletion src/_P019_PCF8574.ino
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ boolean Plugin_019(uint8_t function, struct EventStruct *event, String& string)
# if FEATURE_MQTT_DISCOVER
case PLUGIN_GET_DISCOVERY_VTYPES:

success = getDiscoveryVType(event, Settings.TaskDevicePin1Inversed[event->TaskIndex]
success = getDiscoveryVType(event, Settings.TaskDevicePin1Inversed(event->TaskIndex)
? Plugin_QueryVType_BinarySensorInv
: Plugin_QueryVType_BinarySensor, 255, event->Par5);
# if FEATURE_MQTT_DEVICECLASS
Expand Down
2 changes: 1 addition & 1 deletion src/_P031_SHT1X.ino
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ boolean Plugin_031(uint8_t function, struct EventStruct *event, String& string)
# endif // ifndef BUILD_NO_DEBUG
P031_data->init(
CONFIG_PIN1, CONFIG_PIN2,
Settings.TaskDevicePin1PullUp[event->TaskIndex],
Settings.TaskDevicePin1PullUp(event->TaskIndex),
PCONFIG(0));
# ifndef BUILD_NO_DEBUG

Expand Down
2 changes: 1 addition & 1 deletion src/_P037_MQTTImport.ino
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ bool MQTT_unsubscribe_037(struct EventStruct *event)
if (task != event->TaskIndex) {
constexpr pluginID_t P037_PLUGIN_ID{ PLUGIN_ID_037 };

if (Settings.TaskDeviceEnabled[task] &&
if (Settings.TaskDeviceEnabled(task) &&
(Settings.getPluginID_for_task(task) == P037_PLUGIN_ID)) {
P037_data_struct *P037_data_other = static_cast<P037_data_struct *>(getPluginTaskData(task));

Expand Down
2 changes: 1 addition & 1 deletion src/_P055_Chiming.ino
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ boolean Plugin_055(uint8_t function, struct EventStruct *event, String& string)
}

if (Plugin_055_Data != nullptr) {
Plugin_055_Data->lowActive = Settings.TaskDevicePin1Inversed[event->TaskIndex];
Plugin_055_Data->lowActive = Settings.TaskDevicePin1Inversed(event->TaskIndex);
Plugin_055_Data->millisChimeTime = PCONFIG(0);
Plugin_055_Data->millisPauseTime = PCONFIG(1);
Plugin_055_Data->chimeClock = PCONFIG(2);
Expand Down
2 changes: 1 addition & 1 deletion src/_P059_Encoder.ino
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ boolean Plugin_059(uint8_t function, struct EventStruct *event, String& string)

if (validGpio(pin))
{
// pinMode(pin, (Settings.TaskDevicePin1PullUp[event->TaskIndex]) ? INPUT_PULLUP : INPUT);
// pinMode(pin, Settings.TaskDevicePin1PullUp(event->TaskIndex) ? INPUT_PULLUP : INPUT);
constexpr pluginID_t P059_PLUGIN_ID{ PLUGIN_ID_059 };

const uint32_t key = createKey(P059_PLUGIN_ID, pin);
Expand Down
2 changes: 1 addition & 1 deletion src/_P075_Nextion.ino
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ boolean Plugin_075(uint8_t function, struct EventStruct *event, String& string)

case PLUGIN_WEBFORM_LOAD: {
// ** DEVELOPER DEBUG MESSAGE AREA **
// int datax = static_cast<int>(Settings.TaskDeviceEnabled[event->TaskIndex]); // Debug value.
// int datax = static_cast<int>(Settings.TaskDeviceEnabled(event->TaskIndex)); // Debug value.
// String Data = "Debug. Plugin Enable State: ";
// Data += String(datax);
// addFormNote(Data);
Expand Down
2 changes: 1 addition & 1 deletion src/_P088_HeatpumpIR.ino
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ boolean Plugin_088(uint8_t function, struct EventStruct *event, String& string)
if (Settings.Protocol[i] == 2) { controllerNr = i; }
}

if (Settings.ControllerEnabled[controllerNr])
if (Settings.ControllerEnabled(controllerNr))
{
addRowLabel(F("IDX"));
String id = F("TDID"); // ="taskdeviceid"
Expand Down
4 changes: 2 additions & 2 deletions src/_P094_CULReader.ino
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ boolean Plugin_094(uint8_t function, struct EventStruct *event, String& string)
}

case PLUGIN_FIFTY_PER_SECOND: {
if (Settings.TaskDeviceEnabled[event->TaskIndex]) {
if (Settings.TaskDeviceEnabled(event->TaskIndex)) {
P094_data_struct *P094_data =
static_cast<P094_data_struct *>(getPluginTaskData(event->TaskIndex));

Expand Down Expand Up @@ -468,7 +468,7 @@ boolean Plugin_094(uint8_t function, struct EventStruct *event, String& string)
{
// event->String1 => topic;
// event->String2 => payload;
if (Settings.TaskDeviceEnabled[event->TaskIndex]) {
if (Settings.TaskDeviceEnabled(event->TaskIndex)) {
const bool fromCUL = false;

if (!Plugin_094_match_all(event->TaskIndex, event->String2, event->String1, fromCUL)) {
Expand Down
2 changes: 1 addition & 1 deletion src/_Plugin_Helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ bool initPluginTaskData(taskIndex_t taskIndex, PluginTaskData_base *data) {
clearPluginTaskData(taskIndex);

if (data != nullptr) {
if (Settings.TaskDeviceEnabled[taskIndex]) {
if (Settings.TaskDeviceEnabled(taskIndex)) {
Plugin_task_data[taskIndex] = data;
Plugin_task_data[taskIndex]->_taskdata_pluginID = Settings.getPluginID_for_task(taskIndex);

Expand Down
2 changes: 1 addition & 1 deletion src/src/Commands/Blynk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ controllerIndex_t firstEnabledBlynk_ControllerIndex() {
if (validProtocolIndex(ProtocolIndex)) {
const cpluginID_t number = getCPluginID_from_ProtocolIndex(ProtocolIndex);

if ((number == 12) && Settings.ControllerEnabled[i]) {
if ((number == 12) && Settings.ControllerEnabled(i)) {
return i;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/src/Commands/Notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const __FlashStringHelper * Command_Notifications_Notify(struct EventStruct *eve

if (event->Par1 > 0) {
int index = event->Par1 - 1;
if (Settings.NotificationEnabled[index] && Settings.Notification[index] != INVALID_N_PLUGIN_ID.value) {
if (Settings.NotificationEnabled(index) && Settings.Notification[index] != INVALID_N_PLUGIN_ID.value) {
nprotocolIndex_t NotificationProtocolIndex =
getNProtocolIndex(npluginID_t::toPluginID(Settings.Notification[index]));
if (validNProtocolIndex(NotificationProtocolIndex )) {
Expand Down
11 changes: 7 additions & 4 deletions src/src/Commands/Rules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ const __FlashStringHelper * Command_Rules_Execute(struct EventStruct *event, con

String Command_Rules_UseRules(struct EventStruct *event, const char *Line)
{
return Command_GetORSetBool(event, F("Rules:"),
Line,
(bool *)&Settings.UseRules,
1);
bool useRules = Settings.UseRules; // Workaround for converting Settings.UseRules to a bit-field
const String res = Command_GetORSetBool(event, F("Rules:"),
Line,
(bool *)&useRules,
1);
Settings.UseRules = useRules;
return res;
}

const __FlashStringHelper * Command_Rules_Async_Events(struct EventStruct *event, const char *Line)
Expand Down
8 changes: 4 additions & 4 deletions src/src/Commands/Tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const __FlashStringHelper * taskValueSet(struct EventStruct *event, const char *
success = false;
return F("NOT_A_DUMMY_TASK");
}
if (!Settings.TaskDeviceEnabled[taskIndex]) {
if (!Settings.TaskDeviceEnabled(taskIndex)) {
success = false;
return F("TASK_NOT_ENABLED");
}
Expand Down Expand Up @@ -374,7 +374,7 @@ const __FlashStringHelper * Command_Task_ValueToggle(struct EventStruct *event,
if (!validateAndParseTaskValueArguments(event, Line, taskIndex, varNr)) {
return F("INVALID_PARAMETERS");
}
if (!Settings.TaskDeviceEnabled[taskIndex]) {
if (!Settings.TaskDeviceEnabled(taskIndex)) {
return F("TASK_NOT_ENABLED");
}

Expand Down Expand Up @@ -410,7 +410,7 @@ const __FlashStringHelper * Command_ScheduleTask_Run(struct EventStruct *event,
if (!validateAndParseTaskIndexArguments(event, Line, taskIndex) || event->Par2 < 0) {
return F("INVALID_PARAMETERS");
}
if (!Settings.TaskDeviceEnabled[taskIndex]) {
if (!Settings.TaskDeviceEnabled(taskIndex)) {
return F("TASK_NOT_ENABLED");
}

Expand All @@ -432,7 +432,7 @@ const __FlashStringHelper * Command_Task_Run(struct EventStruct *event, const ch
if (!validateAndParseTaskIndexArguments(event, Line, taskIndex) || event->Par2 < 0) {
return F("INVALID_PARAMETERS");
}
if (!Settings.TaskDeviceEnabled[taskIndex]) {
if (!Settings.TaskDeviceEnabled(taskIndex)) {
return F("TASK_NOT_ENABLED");
}
uint32_t unixTime = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/src/DataStructs/Caches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void Caches::updateActiveTaskUseSerial0() {
{
const deviceIndex_t DeviceIndex = getDeviceIndex_from_TaskIndex(task);

if (Settings.TaskDeviceEnabled[task] && validDeviceIndex(DeviceIndex)) {
if (Settings.TaskDeviceEnabled(task) && validDeviceIndex(DeviceIndex)) {
if ((Device[DeviceIndex].Type == DEVICE_TYPE_SERIAL) ||
(Device[DeviceIndex].Type == DEVICE_TYPE_SERIAL_PLUS1)) {
const ESPEasySerialPort port = ESPeasySerialType::getSerialType(
Expand Down
Loading