mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-08-14 09:29:49 +00:00
Fix X1 charge status LED always showing charged
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user