mirror of
https://github.com/mikecarper/MeshCore.git
synced 2026-10-04 01:38:51 +00:00
Update ThinkNodeM6Board.h
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user