FwUpdate: battery gate skipped on USB power (VBUS)
This commit is contained in:
1 parent
daaf0c2267
commit
3cb3a458ce
1 file changed
+6
-2
@@ -656,7 +656,11 @@ void FwUpdate::cmdApply(uint32_t sender_timestamp, const char *arg, char *reply)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint16_t mv = battMinMv();
|
uint16_t mv = battMinMv();
|
||||||
if (!force) {
|
// USB VBUS present: the copy cannot run out of power, and a board without
|
||||||
|
// a cell reads only ~3.7 V on VBAT (x4 on the bench), so the gate would
|
||||||
|
// refuse a perfectly safe apply.
|
||||||
|
bool ext = _board.isExternalPowered();
|
||||||
|
if (!force && !ext) {
|
||||||
if (mv < 2000) {
|
if (mv < 2000) {
|
||||||
sprintf(reply, "ERR: battery unknown (%umV), fw apply force (local)", mv);
|
sprintf(reply, "ERR: battery unknown (%umV), fw apply force (local)", mv);
|
||||||
return;
|
return;
|
||||||
@@ -667,7 +671,7 @@ void FwUpdate::cmdApply(uint32_t sender_timestamp, const char *arg, char *reply)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_apply_at = millis() + 2000; // let the reply go out first
|
_apply_at = millis() + 2000; // let the reply go out first
|
||||||
sprintf(reply, "OK applying %s in 2 s (batt %umV), back in ~20 s", _version, mv);
|
sprintf(reply, "OK applying %s in 2 s (batt %umV%s), back in ~20 s", _version, mv, ext ? ", USB" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void FwUpdate::loop() {
|
void FwUpdate::loop() {
|
||||||
|
|||||||
Reference in new issue
Block a user