Skip to content

Add position to encoder msg payload #2

@fifi-reframe

Description

@fifi-reframe

Hey there, I'm integrating a Phidget encoder (https://www.phidgets.com/?prodid=1199) into a Node-Red flow, and I'd love to be able to get the position from the payload. It appears that this is exposed in the Phidget API: https://www.phidgets.com/?view=api&product_id=1047_2. It would be really useful to have this to avoid integrating the positional changes myself :)

I was hoping to test this locally and open a PR, but not entirely sure how to do local testing. Ideally, a change would look something like

    encoder.onPositionChange = (positionChange, timeChange, indexTriggered) => {
      const msg = {
        topic: 'PositionChange',
        payload: {
          positionChange,
          timeChange,
          indexTriggered,
          position: encoder.position,
        },
      };
      node.send(msg);
    };

in phidget22-encoder.ts

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions