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

Reschedule stats saving on disarm, if quad still moving #13637

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

limonspb
Copy link
Member

@limonspb limonspb commented May 14, 2024

Situation when stats_min_armed_time_s is set to something else than -1.
This activates persistent stats saving upon disarm, like flights counter, total distance, total time in the air.

This can create a problem, when person disarms during crash, it can launch stats saving. And battery might unplug during stats saving, corrupting the configuration.

This change keeps rescheduling writeEEPROM if gyro is still moving.
new parameter introduced stats_saving_max_gyro_rate in degrees.

For proper testing need a quad with a beeper.
Steps:

  1. Props off.
  2. in CLI set stats_min_armed_time_s = 3, save
  3. Arm quad, wait for 3 seconds, wiggle quad while disarming.

Old behavior: second disarmed tones are heard.
New behavior: second disarming tones are heard only after you stop wiggling quad.

possible future improvements:

  1. Take into account gyro moves during the last delay, not just the current state
  2. Take into account accel

Copy link

Do you want to test this code? You can flash it directly from Betaflight Configurator:

  • Simply put #13637 (this pull request number) in the Select commit field of the Configurator firmware flasher tab (you need to Enable expert mode, Show release candidates and Development).

WARNING: It may be unstable. Use only for testing!

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.

None yet

1 participant