mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-01 10:21:59 +00:00
Update ThinkNodeM6Board.h
This commit is contained in:
@@ -36,19 +36,33 @@ public:
|
|||||||
return "Elecrow ThinkNode M6";
|
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 {
|
bool isExternalPowered() override {
|
||||||
if (digitalRead(EXT_PWR_DETECT) == EXT_PWR_DETECT_VALUE ||
|
if (isUsbPowered() || isSolarChargerActive()) {
|
||||||
digitalRead(EXT_CHRG_DETECT) == EXT_CHRG_DETECT_VALUE) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return NRF52Board::isExternalPowered();
|
return NRF52Board::isExternalPowered();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isChargerActive() override {
|
bool isChargerActive() override {
|
||||||
// The charge-status line covers solar input; external USB input is also a
|
// Preserve a generic charging indication while also exposing both
|
||||||
// charging source, although the board cannot report charge completion.
|
// source-specific states (USB / solar) separately through the CLI.
|
||||||
return digitalRead(EXT_CHRG_DETECT) == EXT_CHRG_DETECT_VALUE ||
|
return isSolarChargerActive() || isUsbPowered();
|
||||||
digitalRead(EXT_PWR_DETECT) == EXT_PWR_DETECT_VALUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void powerOff() override {
|
void powerOff() override {
|
||||||
|
|||||||
Reference in New Issue
Block a user