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

[WIP] UAP_HAL_Linux: Basic safety switch infrastructure #26709

Closed
wants to merge 1 commit into from
Closed

[WIP] UAP_HAL_Linux: Basic safety switch infrastructure #26709

wants to merge 1 commit into from

Conversation

landswellsong
Copy link
Contributor

Allows Linux boards to define a GPIO pin to be treated as a safety switch. Current implementation assumes an active low disarm with the pin being pulled up (via non-ardupilot means, such as device trees or physically on the PCB etc).

The code isn't directly used anywhere as I test it on a WIP internal branch for now, but it is indeed operational, e.g. shorting the pin to the ground correctly sets a disarmed (1) status:
image

NOTE: The virtual destructor added deep in the GPIO classes hierarchy not to be locked into a particular flavor of Linux board GPIO. I'm honestly unsure why it wasn't there in first place since GPIO::channel does instantiate an object which needs to be eventually freed using a base class pointer. I checked another instances of this method's usage and it seems that the pointer is never freed. So it's either a virtual destructor is indeed needed or Linux sysfs GPIO class needs to be changed in order to track the pointers that are generated by the channel() method.

@landswellsong landswellsong changed the title AP_HAL_Linux: Basic safety switch infrastructure [WIP] UAP_HAL_Linux: Basic safety switch infrastructure May 2, 2024
@landswellsong
Copy link
Contributor Author

Actually I learned about force_safety_XX methods so I'll be adding those here too and then remove the WIP tag.

@landswellsong landswellsong closed this by deleting the head repository Jul 27, 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.

1 participant