Skip to content

feat(cli): add battery command - #3072

Open
chinderdelis wants to merge 1 commit into
BruceDevices:devfrom
chinderdelis:cli-battery-command
Open

chinderdelis wants to merge 1 commit into
BruceDevices:devfrom
chinderdelis:cli-battery-command

Conversation

@chinderdelis

Copy link
Copy Markdown

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:

[BAT] 96% charging=1 adc=2063mV batt~4126mV

Also add the command to the help output.

Types of Changes

New Feature

Verification

  • Freenove FNK0104AB (analog divider on GPIO9): battery reports percentage, charging state, raw ADC and scaled voltage.
  • esp32-s3-devkitc-1 (no ANALOG_BAT_PIN): builds and reports percentage/charging only.

Testing

Hardware tested on Freenove FNK0104AB; compile-tested on esp32-s3-devkitc-1 for the no-analog path.

Linked Issues

N/A

User-Facing Change

Add a `battery` serial command showing battery percentage and charging state.

Further Comments

The ADC block mirrors the fallback defaults already used by hal/power/gauge.cpp.

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

No deployments
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