inav
inav copied to clipboard
PINIO: Fix inverted pin handling
PINIO pins that are inverted are initially set to High and the internal state is false, which is correct. But in pinioSet
the newState was XOR-ed with the inverted flag before comparing with the stored state. So when calling pinioSet
with on = True
, the pin was not set to Low as it should. To put the pin in the correct state, one therefore had to call pinioSet
with on = False
first.
Due to this bug, it was e.g. necessary to toggle the RC transmitter switch assigned to the VTX pit switch after boot to turn off the VTX, as the VTX was on even though the RC transmitter switch was in the "VTX off position" (pit switch active).
This PR fixes this bug by XOR-ing the new state with the inverted flag when calling IOWrite
, such that the output of the pin is inverted.
@stronnag I think this should be included in 7.1.0 as well.
@stronnag I think this should be included in 7.1.0 as well.
Can you rebase the pr to release_7.1.0 branch?