encwrite multipe encoders

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Kjors
Normal user
Posts: 1
Joined: 25 May 2019, 15:31

encwrite multipe encoders

#1 Post by Kjors » 26 May 2019, 14:32

Hi All,

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;
      }

Post Reply

Who is online

Users browsing this forum: No registered users and 33 guests