Skip to content

Conversation

@harryjph
Copy link
Contributor

@harryjph harryjph commented Mar 24, 2021

Fixes #6730. Alternative to #6731.

This fixes an oversight in my implementation of Prearm: Once prearm is held, you can toggle the arm switch on and off all day. So if a non-momentary prearm is used and the quad is disarmed without resetting the prearm, it can be armed again with the single arm switch, which defeats the prearm.

This PR adds a simple flag to track whether the prearm has been reset (not engaged / RC mode not active) since the last disarm.

This also adds an optional setting called prearm_timeout that invalidates the prearm activation after a set duration. This means that you have to arm within a certain time window after pressing prearm, or the craft won't arm. This is a configurable value between 0 and 10 seconds. Setting it to 0 disables the timeout.

@harryjph harryjph changed the title Add "prearm was reset" flag to prevent rearming without resetting prearm Add "prearm was reset" flag to prevent rearming without resetting prearm & add prearm timeout Mar 24, 2021
uint8_t fixed_wing_auto_arm; // Auto-arm fixed wing aircraft on throttle up and never disarm
uint8_t disarm_kill_switch; // allow disarm via AUX switch regardless of throttle value
uint16_t switchDisarmDelayMs; // additional delay between ARM box going off and actual disarm
uint16_t prearmTimeoutMs; // duration for which Prearm being activated is valid. after this, Prearm needs to be reset. 0 means Prearm does not timeout.
Copy link
Member

Choose a reason for hiding this comment

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

You have to increase the parameter group version when you add a new field.
See fine rc_controls.c line 72

Copy link
Member

Choose a reason for hiding this comment

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

Also, you should set the default value of the new parameter group field

@DzikuVx DzikuVx added this to the 3.0 milestone Apr 5, 2021
@DzikuVx DzikuVx merged commit 4937fa3 into iNavFlight:master Apr 5, 2021
@DzikuVx DzikuVx mentioned this pull request Apr 5, 2021
@harryjph harryjph deleted the require-prearm-reset branch April 5, 2021 10:05
@sdellava
Copy link
Contributor

I guess this issue is still not resolved. pleas check this: #9752

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.

Prearm issue with non momentary switches

3 participants