Merge pull request #3202 from F4FPR/m6-power-observability

ThinkNode M6: expose external-power and charger state
This commit is contained in:
fdlamotte
2026-09-26 13:51:11 -04:00
committed by GitHub
5 changed files with 61 additions and 0 deletions
+13
View File
@@ -284,6 +284,19 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, char* command, char* re
sprintf(reply, "%s (Build: %s)", _callbacks->getFirmwareVer(), _callbacks->getBuildDate());
} else if (memcmp(command, "board", 5) == 0) {
sprintf(reply, "%s", _board->getManufacturerName());
} else if (strcmp(command, "power") == 0) {
const char* usb_state = _board->hasUsbPowerDetect()
? (_board->isUsbPowered() ? "yes" : "no")
: "n/a";
const char* solar_state = _board->hasSolarChargerDetect()
? (_board->isSolarChargerActive() ? "yes" : "no")
: "n/a";
snprintf(reply, 160, "batt:%u mV usb:%s solar_chg:%s ext:%s charger:%s",
(unsigned)_board->getBattMilliVolts(),
usb_state,
solar_state,
_board->isExternalPowered() ? "yes" : "no",
_board->isChargerActive() ? "yes" : "no");
} else if (memcmp(command, "sensor get ", 11) == 0) {
const char* key = command + 11;
const char* val = _sensors->getSettingByKey(key);