Repository navigation
feat(cli): add battery command - #3072
Open
chinderdelis wants to merge 1 commit into
Open
chinderdelis wants to merge 1 commit into
chinderdelis wants to merge 1 commit into
Conversation
Print battery percentage, charging state and, on boards with an analog battery divider, the raw ADC and scaled battery voltage.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Add a
battery(bat) serial command that reports the battery percentage and charging state. On boards with an analog battery divider (ANALOG_BAT_PIN) it also prints the raw ADC voltage and the scaled battery voltage, which is useful when bringing up a new board.Example:
Also add the command to the
helpoutput.Types of Changes
New Feature
Verification
batteryreports percentage, charging state, raw ADC and scaled voltage.esp32-s3-devkitc-1(noANALOG_BAT_PIN): builds and reports percentage/charging only.Testing
Hardware tested on Freenove FNK0104AB; compile-tested on
esp32-s3-devkitc-1for the no-analog path.Linked Issues
N/A
User-Facing Change
Further Comments
The ADC block mirrors the fallback defaults already used by
hal/power/gauge.cpp.