I am trying to get encwrite working for mutilpe encoders. My setup exists of a Sonoff with two rotary encoders, configured at task 3 and 6. The command "encwrite value" works for the fist one.
Looking at the code it uses the TaskIndex to write par1 to correct sensor.
How do i set the TaskIndex to change the value of task 6?
Thanks
Code: Select all
case PLUGIN_WRITE:
{
if (P_059_sensordefs.count(event->TaskIndex) != 0)
{
String log = "";
String command = parseString(string, 1);
if (command == F("encwrite"))
{
if (event->Par1 >= 0)
{
log = String(F("QEI : ")) + string;
addLog(LOG_LEVEL_INFO, log);
P_059_sensordefs[event->TaskIndex]->write(event->Par1);
}
success = true; // Command is handled.
}
}
break;
}