I have been looking at the Neopixel plugin for inspiration and I have a rough idea how it is working. I thought I would ask this question here though, in case I am heading in the wrong direction.
I can see the event struct has 3 integers Par1, Par2, Par3 which as far as I can see allow values to be passed into plugins.
Code: Select all
struct EventStruct
{
byte Source;
byte TaskIndex; // index position in TaskSettings array, 0-11
byte ControllerIndex; // index position in Settings.Controller, 0-3
byte ProtocolIndex; // index position in protocol array, depending on which controller plugins are loaded.
byte NotificationIndex; // index position in Settings.Notification, 0-3
byte NotificationProtocolIndex; // index position in notification array, depending on which controller plugins are loaded.
byte BaseVarIndex;
int idx;
byte sensorType;
int Par1;
int Par2;
int Par3;
int Par4;
byte OriginTaskIndex;
String String1;
String String2;
byte *Data;
};
I sat and wrote (untested so far) some code and I modified to the struct to add an extra integer Par4. I then changed the misc.ino file to add the Par4 to the parseCommandString function.
Code: Select all
void parseCommandString(struct EventStruct *event, String& string)
{
char command[80];
command[0] = 0;
char TmpStr1[80];
TmpStr1[0] = 0;
string.toCharArray(command, 80);
event->Par1 = 0;
event->Par2 = 0;
event->Par3 = 0;
event->Par4 = 0;
if (GetArgv(command, TmpStr1, 2)) event->Par1 = str2int(TmpStr1);
if (GetArgv(command, TmpStr1, 3)) event->Par2 = str2int(TmpStr1);
if (GetArgv(command, TmpStr1, 4)) event->Par3 = str2int(TmpStr1);
if (GetArgv(command, TmpStr1, 5)) event->Par4 = str2int(TmpStr1);
}
Here is my code: https://github.com/Justblair/ESPEasy
This is the library I am using for the MY9291 https://github.com/xoseperez/my9291