Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions examples/companion_radio/ui-orig/UITask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,7 @@ void UITask::userLedHandler() {
static bool ext_powered = false, ext_charging = false;
if (cur_time > next_pwr_check) {
ext_powered = _board->isExternalPowered();
bool chrg = digitalRead(EXT_CHRG_DETECT) == LOW;
#ifdef EXT_CHRG_DONE
if (digitalRead(EXT_CHRG_DONE) == LOW) chrg = false; // charge-done wins
#endif
ext_charging = ext_powered && chrg;
ext_charging = ext_powered && digitalRead(EXT_CHRG_DETECT) == LOW;
next_pwr_check = cur_time + 1000;
}
if (ext_powered && _msgcount == 0) {
Expand Down
1 change: 0 additions & 1 deletion variants/meshtracker_x1/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ void initVariant()
{
pinMode(BATTERY_PIN, INPUT);
pinMode(EXT_CHRG_DETECT, INPUT_PULLUP);
pinMode(EXT_CHRG_DONE, INPUT_PULLUP);
pinMode(EXT_PWR_DETECT, INPUT);
pinMode(PIN_BUTTON1, INPUT_PULLDOWN);

Expand Down
3 changes: 2 additions & 1 deletion variants/meshtracker_x1/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
#define ADC_MULTIPLIER (2.0F)

#define EXT_CHRG_DETECT (35) // P1.3, LOW while charging
#define EXT_CHRG_DONE (36) // P1.4, LOW when charge complete
// P1.4 is the charger's second status line, but it reads LOW regardless of
// charge state on this board, so it is not used (Meshtastic leaves it out too)
#define EXT_PWR_DETECT (5) // P0.5

#define ADC_RESOLUTION (14)
Expand Down
Loading