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

[4.5.1] battery - fix BATTERY_NOT_PRESENT detection, detection logic change #13623

Merged
merged 1 commit into from
May 10, 2024

Conversation

haslinghuis
Copy link
Member

  • battery - fix BATTERY_NOT_PRESENT detection, detection logic change

Detection logic is refactored - battery voltage delta is tested each 50ms, voltage is considered stable when difference of last 10 samples is smaller than 100mV
This makes stable threshold more forgiving than #13350 (time for comparison is 50 instead of 500ms).

  • battery - improve stable voltage detection
  • voltageStablePrevFiltered every time delta is exceeded
  • voltage within range is ANDed over 100ms periods
  • voltage is stable if it was within range for 10 out of 11 periods
    • slowly changing voltage will update threshold, but voltage will be considered stable
    • 1 update/s (100mV/s) is tolerated
  • battery - fuix typos, improve comments

…etaflight#13599)

* battery - fix BATTERY_NOT_PRESENT detection, detection logic change

Detection logic is refactored - battery voltage delta is tested each
50ms, voltage is considered stable when difference of last 10 samples
is smaller than 100mV
This makes stable threshold more forgiving than betaflight#13350 (time for
comparison is 50 instead of 500ms).

* battery - improve stable voltage detection

- voltageStablePrevFiltered every time delta is exceeded
- voltage within range is ANDed over 100ms periods
- voltage is stable if it was within range for 10 out of 11 periods
  - slowly changing voltage will update threshold, but voltage will be
    considered stable
  - 1 update/s (100mV/s) is tolerated

* battery - fuix typos, improve comments
@haslinghuis haslinghuis added this to the 4.5.1 milestone May 4, 2024
Copy link

github-actions bot commented May 4, 2024

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

  • Simply put #13623 (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!

@blckmn blckmn merged commit 0f001ad into betaflight:4.5-maintenance May 10, 2024
24 checks passed
@haslinghuis haslinghuis deleted the bug-battery-stable branch May 10, 2024 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants