Update ThinkNodeM6Board.h

This commit is contained in:
F4FPR
2026-08-18 19:40:42 +02:00
committed by GitHub
parent 6b696a4ef6
commit 2940ead504
+20 -6
View File
@@ -36,19 +36,33 @@ public:
return "Elecrow ThinkNode M6";
}
bool hasUsbPowerDetect() const override { return true; }
bool isUsbPowered() override {
// P0.13 is the dedicated USB / external power-detect line on the M6 PCB
// (same pin the Meshtastic M6 variant uses for USB detection).
return digitalRead(EXT_PWR_DETECT) == EXT_PWR_DETECT_VALUE;
}
bool hasSolarChargerDetect() const override { return true; }
bool isSolarChargerActive() override {
// P0.15 is the active-low solar-charger status line. It reports the
// charger's state, not photovoltaic voltage or current.
return digitalRead(EXT_CHRG_DETECT) == EXT_CHRG_DETECT_VALUE;
}
bool isExternalPowered() override {
if (digitalRead(EXT_PWR_DETECT) == EXT_PWR_DETECT_VALUE ||
digitalRead(EXT_CHRG_DETECT) == EXT_CHRG_DETECT_VALUE) {
if (isUsbPowered() || isSolarChargerActive()) {
return true;
}
return NRF52Board::isExternalPowered();
}
bool isChargerActive() override {
// The charge-status line covers solar input; external USB input is also a
// charging source, although the board cannot report charge completion.
return digitalRead(EXT_CHRG_DETECT) == EXT_CHRG_DETECT_VALUE ||
digitalRead(EXT_PWR_DETECT) == EXT_PWR_DETECT_VALUE;
// Preserve a generic charging indication while also exposing both
// source-specific states (USB / solar) separately through the CLI.
return isSolarChargerActive() || isUsbPowered();
}
void powerOff() override {