Restore known-good BMS connection behavior
This commit is contained in:
@@ -529,33 +529,10 @@ void updateBms() {
|
||||
|
||||
lastReadAttempt = millis();
|
||||
|
||||
if (!client || !client->isConnected()) {
|
||||
unsigned long now = millis();
|
||||
|
||||
if (now - lastBmsConnectAttempt < bmsConnectBackoffMs) {
|
||||
bmsData.connected = false;
|
||||
return;
|
||||
}
|
||||
|
||||
lastBmsConnectAttempt = now;
|
||||
|
||||
if (!connectBms()) {
|
||||
bmsData.connected = false;
|
||||
bmsConnectFailCount++;
|
||||
|
||||
if (bmsConnectFailCount >= 3) {
|
||||
bmsConnectBackoffMs = 120000;
|
||||
} else {
|
||||
bmsConnectBackoffMs = 60000;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bmsConnectFailCount = 0;
|
||||
bmsConnectBackoffMs = 60000;
|
||||
}
|
||||
|
||||
if (requestPacket(JBD_STATUS_REQUEST, sizeof(JBD_STATUS_REQUEST))) {
|
||||
parseBasicInfo();
|
||||
}
|
||||
@@ -566,3 +543,4 @@ void updateBms() {
|
||||
parseCellVoltages();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -471,10 +471,14 @@ void buildStatusDocument(JsonDocument& doc) {
|
||||
} else {
|
||||
if (appConfig.bms.enabled && appConfig.bms.address.length() > 0) {
|
||||
battery["source"] = "jbd_bms";
|
||||
} else {
|
||||
if (appConfig.bms.enabled && appConfig.bms.address.length() > 0) {
|
||||
battery["source"] = "jbd_bms";
|
||||
} else {
|
||||
battery["source"] = "unconfigured";
|
||||
}
|
||||
}
|
||||
}
|
||||
battery["connected"] = false;
|
||||
battery["soc"] = 0;
|
||||
battery["voltage"] = 0;
|
||||
|
||||
Reference in New Issue
Block a user