-
Notifications
You must be signed in to change notification settings - Fork 12
Add AdcSampler & BatteryMonitor #28
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
Conversation
…ds, and simplify ADC initialization logic
…hods and log output
…g enable, ADC pin, voltage divider and sampling interval settings
…onitor and current monitoring
- Set CONFIG_MONITORING_BATTERY_ENABLE to n by default - Update help text for ADC pin configuration in Kconfig - Remove unused config options
6d84336 to
97b910a
Compare
|
@lorow This Pr is ready for review. |
lorow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I like the changes!
Thanks for bringing in the battery monitoring and expanding what we already had with the current monitor! Though, I'm on the verge with checking for esp32s3 || esp32 since those are the only two platforms we support (and stuff from s2 should work under s3 iirc, if we even have a board like that) but it doesn't hurt or obscure the logic anyway so I didn't point it out in the review. Heck, I may be wrong here for all I know!
Thanks for giving it a go on both - the wrooms and esp32cams btw!
I'll go ahead and merge the changes
|
You're right — platform-specific logic like ADC calibration and pin mappings really should live in separate files rather than being tangled together with macros. It’s cleaner and makes future porting much simpler. |
Summary
Add AdcSampler for Monitoring component and added battery monitoring with SOC calculation.
Architecture:
Details
BSP Layer (
AdcSampler)Business Logic Layer
BatteryMonitor: Voltage divider compensation, Li-ion SOC lookup table with linear interpolationCurrentMonitor: Shunt-based current calculation with gain compensationAdcSamplerCoordinator Layer (
MonitoringManager)BatteryStatus(voltage + percentage + validity) directlyBatteryStatusCommand Layer
getBatteryStatusCommand()MenuConfig
Testing
CONFIG_MONITORING_LED_CURRENT=yCONFIG_MONITORING_BATTERY_ENABLE=y