Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PINIO: Fix inverted pin handling #9559

Merged
merged 1 commit into from
Mar 22, 2024

Conversation

mluessi
Copy link
Contributor

@mluessi mluessi commented Dec 11, 2023

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.

@mluessi
Copy link
Contributor Author

mluessi commented Dec 17, 2023

@stronnag I think this should be included in 7.1.0 as well.

@mmosca
Copy link
Collaborator

mmosca commented Jan 27, 2024

@stronnag I think this should be included in 7.1.0 as well.

Can you rebase the pr to release_7.1.0 branch?

@DzikuVx DzikuVx added this to the 8.0 milestone Mar 21, 2024
@DzikuVx DzikuVx merged commit 2b1df9e into iNavFlight:master Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants