Skip to content

Moving average with more samples for battery ADC - #298

Open
iHD992 wants to merge 3 commits into
ducalex:devfrom
iHD992:feature/moving-average-adc
Open

Moving average with more samples for battery ADC#298
iHD992 wants to merge 3 commits into
ducalex:devfrom
iHD992:feature/moving-average-adc

Conversation

@iHD992

@iHD992 iHD992 commented Mar 7, 2026

Copy link
Copy Markdown

The battery ADC is pretty jumpy, so more measurements are necessary to have a stable value (oversampling). As ADC measurements take some time, a lot of them slow the system. I reduced the measurements from 4 to 1 (speed increase), but included a history of 16 samples. This history has to be filled at startup, thus rg_system.c had also to be updated.

Changes in voltage now take longer to get recognized, but battery voltage changes are usually quite slow.

@iHD992

iHD992 commented Mar 21, 2026

Copy link
Copy Markdown
Author

No history buffer filling at start, as it was quite slow. The buffer now growths over time, but is used right from the start.

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.

1 participant