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

Arm debounce #66

Merged
merged 6 commits into from
Jan 9, 2024
Merged

Arm debounce #66

merged 6 commits into from
Jan 9, 2024

Conversation

vwu1888
Copy link
Contributor

@vwu1888 vwu1888 commented Nov 14, 2023

Implemented arm switch debouncing to prevent false positivity when arming thrusters.

@vwu1888 vwu1888 linked an issue Nov 14, 2023 that may be closed by this pull request
src/comms/meb/mod.rs Outdated Show resolved Hide resolved
let arm_state = self.arm_state.clone();
let current_arm_state = *self.statuses.thruster_arm().read().await;

let t1 = thread::spawn(move || {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of handling this with a thread like so, it is probably more effective to do this in Statuses (comms/meb/response.rs:97).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved the arm debounce logic into its own function in Statuses. I also moved the unit tests into the same file. I'm not entirely sure the thruster_is_armed() and thruster_is__not_armed() unit tests are necessary. Should I remove them or no?

use anyhow::Result;
use itertools::Itertools;

Check warning

Code scanning / clippy

unused import: itertools::Itertools Warning

unused import: itertools::Itertools
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why cargo is saying this is unused. On line 168, the all_equal() is a part of this import, and the build breaks when I remove the import. Does anyone know why or should we dismiss it?

src/comms/meb/response.rs Fixed Show fixed Hide fixed
@Bennett-Petzold Bennett-Petzold merged commit be043c2 into main Jan 9, 2024
2 of 3 checks passed
@Bennett-Petzold Bennett-Petzold deleted the arm-debounce branch January 9, 2024 00:28
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.

Arm Debounce
2 participants