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

Copter/Blimp: Do not set the same value #26843

Closed

Conversation

muramura
Copy link
Contributor

If 0, there is no need to set 0.
If it is less than 0, it would be set to 0.

Copy link
Member

@IamPete1 IamPete1 left a comment

Choose a reason for hiding this comment

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

This is also used to turn off the radio failsafe, so this now means it takes a extra loop to clear?

@muramura
Copy link
Contributor Author

muramura commented Apr 20, 2024

If the result of decrementing failsafe.radio_counter is 0, set failsafe.radio_counter to 0.
I think NG is to set 0 again even though it is 0.

failsafe.radio_counter--;
if( failsafe.radio_counter <= 0 ) {
 failsafe.radio_counter = 0;

If changed, set 0 to failsafe.radio_counter only when the result of decrementing failsafe.radio_counter is -1.

@peterbarker
Copy link
Contributor

No, @IamPete1 is correct. You are changing behaviour here, we will do things other than clamping the value of the counter one loop early.

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