feat(Power): support EXT_PWR_DETECT_MODE & EXT_PWR_DETECT_VAL, simplify EXT_PWR_DETECT#10140
Merged
jp-bennett merged 1 commit intomeshtastic:developfrom Apr 23, 2026
Merged
Conversation
Contributor
Author
|
That being said, EXT_CHRG_DETECT is out of scope of this PR but I think needs a cleanup too, as it currently stores its defines in a runtime uint8_t variable unnecessarily - because it never changes in runtime, it should just be handled by preprocessor directives. |
37c121a to
4df6172
Compare
9 tasks
Stary2001
approved these changes
Apr 16, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds configurable external power detection behavior to the Power subsystem so board variants can use internal GPIO pull-ups/pull-downs (and configurable active level) instead of hardcoded per-board hacks.
Changes:
- Introduces
EXT_PWR_DETECT_MODE(and inferred/defaultedEXT_PWR_DETECT_VAL) handling insrc/Power.cpp. - Simplifies
isVbusIn()to comparedigitalRead(EXT_PWR_DETECT)directly againstEXT_PWR_DETECT_VAL. - Updates Heltec ESP32-S3 variants to use
EXT_PWR_DETECT_MODE INPUT_PULLUPinstead of special-case#ifdeflogic.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Power.cpp |
Adds EXT_PWR_DETECT_MODE/EXT_PWR_DETECT_VAL handling, removes Heltec-specific conditionals, simplifies external power detection and pin setup. |
variants/esp32s3/heltec_capsule_sensor_v3/variant.h |
Sets EXT_PWR_DETECT_MODE to INPUT_PULLUP for this variant. |
variants/esp32s3/heltec_sensor_hub/variant.h |
Sets EXT_PWR_DETECT_MODE to INPUT_PULLUP for this variant. |
8 tasks
…lify EXT_PWR_DETECT Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Andrew Yong <me@ndoo.sg>
Contributor
Author
|
Renamed EXT_PWR_DETECT_VAL → EXT_PWR_DETECT_VALUE for consistency with ext-chrg-detect. Rebased on develop HEAD (as of now) to keep fresh. |
jp-bennett
approved these changes
Apr 23, 2026
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.
Motivation: Simplify future variants by allowing to use internal pull-up/pull-down resistors, thus eliminating a physical resistor on the PCB.
Clean up the comments for isVbusIn() while I am here.
Build tested on:
Functionality tested on:
🤝 Attestations