Skip to content

Permit function to customize determination of current switch position for multi position switches

Latest
Compare
Choose a tag to compare
@jbliesener jbliesener released this 06 Jan 08:26

Before this release, each pin of a MultiPositionSwitch corresponded to exactly one switch position. However, there are switches that transmit their position in an already coded form. For these switches, the new function setFindSwitchPosition function now allows to specify a function that reads the switch inputs and, in a customised way, returns the current switch position.

The specified function can use the following methods:

  • bool isPinOn(pinIndex): read the nth input pin. Considers activeHigh and activeLow and directly returns if the pin is in an "on" state
  • uint8_t getNumberOfPositions(): returns the number of defined input pins