Fix X1 charge status LED always showing charged

This commit is contained in:
Hacuchino-hash
2026-08-07 08:08:08 -05:00
parent 47154f02cb
commit 2af4b3c14a
3 changed files with 3 additions and 7 deletions
+1 -5
View File
@@ -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) {
-1
View File
@@ -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);
+2 -1
View File
@@ -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)