Skip to content

All vehicles: Fix non fatal rc failsafe bug #29846

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Hwurzburg
Copy link
Collaborator

@Hwurzburg Hwurzburg commented Apr 21, 2025

I discovered this while working on adding RC to Sub...easy to reproduce

Sim vehicle with defaults...happens disarmed or in the air

  • SIM_RC_FAIL =0 you get an RC failsafe, prearm or action
  • Disable the failsafe ie FS_THR_ENABLE or THR_FAILSAFE = 0
  • SIM_RC_FAIL =1 you enabled RC, but failsafe state is still not cleared...no GCS message...prearms if disarmed on ground
    wont clear until reboot or resetting failsafe enable

non fatal but really annoying if you run into it...
hope its doesn't make CI uhappy

@@ -402,7 +402,7 @@ bool Plane::rc_throttle_value_ok(void) const
*/
bool Plane::rc_failsafe_active(void) const
{
if (!rc_throttle_value_ok()) {
if (!rc_throttle_value_ok() || (ThrFailsafe(g.throttle_fs_enabled.get()) == ThrFailsafe::Disabled)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a bit unintuitive for someone reading the code because I think it means that the RC failsafe is active when it's actually been disabled.

Copy link
Contributor

Choose a reason for hiding this comment

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

i think this is already covered in Plane::rc_throttle_value_ok() implementation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it is not....rc_throttle_value_ok() early returns, yes, but ALWAYS when throttle failsafe is disabled, even when failsafe flag is still set ....rc_failsafe_active will return true and never return false after RC sis restored

Copy link
Collaborator Author

@Hwurzburg Hwurzburg Apr 22, 2025

Choose a reason for hiding this comment

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

@rmackay9 I think I understand...I will early return on the disable instead of letting of letting it test rc_throttle value first and oring...and removing from rc_throttle_value_ok

Copy link
Contributor

@tridge tridge left a comment

Choose a reason for hiding this comment

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

the change in plane radio.cpp doesn't look right to me

@Hwurzburg Hwurzburg force-pushed the fix_rc_failsafe_bug branch from 8a4a28a to dbc5250 Compare April 22, 2025 12:19
@Hwurzburg Hwurzburg force-pushed the fix_rc_failsafe_bug branch from dbc5250 to 299d031 Compare April 23, 2025 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants