Revert "Add BMS reconnect backoff"

This reverts commit fa96a327a6.

 Changes to be committed:
	modified:   firmware/esp32/overland-controller/bms.cpp
This commit is contained in:
2026-06-04 17:16:45 -06:00
parent 9e4bb56dfb
commit cb926a4233
+21 -56
View File
@@ -14,14 +14,6 @@ static NimBLEClient* client = nullptr;
static NimBLERemoteCharacteristic* notifyChar = nullptr;
static NimBLERemoteCharacteristic* writeChar = nullptr;
static unsigned long lastBmsAttemptMs = 0;
static unsigned long bmsRetryIntervalMs = 30000;
static const unsigned long BMS_RETRY_INTERVAL_CONNECTED_MS = 5000;
static const unsigned long BMS_RETRY_INTERVAL_FAILED_MS = 30000;
static const unsigned long BMS_RETRY_INTERVAL_LONG_FAIL_MS = 60000;
static int consecutiveBmsFailures = 0;
static uint8_t responseBuffer[128];
static size_t responseLength = 0;
static bool responseReady = false;
@@ -511,58 +503,31 @@ void initBms() {
}
void updateBms() {
if (!appConfig.bms.enabled || appConfig.bms.address.length() == 0) {
bmsData.connected = false;
if (bmsSetupMode) {
return;
}
unsigned long now = millis();
if (!client || !client->isConnected()) {
bmsData.connected = false;
if (now - lastBmsAttemptMs < bmsRetryIntervalMs) {
return;
}
lastBmsAttemptMs = now;
if (!connectBms()) {
consecutiveBmsFailures++;
if (consecutiveBmsFailures >= 3) {
bmsRetryIntervalMs = BMS_RETRY_INTERVAL_LONG_FAIL_MS;
} else {
bmsRetryIntervalMs = BMS_RETRY_INTERVAL_FAILED_MS;
}
return;
}
consecutiveBmsFailures = 0;
bmsRetryIntervalMs = BMS_RETRY_INTERVAL_CONNECTED_MS;
}
if (!requestBmsData()) {
bmsData.connected = false;
consecutiveBmsFailures++;
if (client) {
client->disconnect();
}
if (consecutiveBmsFailures >= 3) {
bmsRetryIntervalMs = BMS_RETRY_INTERVAL_LONG_FAIL_MS;
} else {
bmsRetryIntervalMs = BMS_RETRY_INTERVAL_FAILED_MS;
}
lastBmsAttemptMs = now;
if ((long)(bmsReconnectPausedUntil - millis()) > 0) {
return;
}
consecutiveBmsFailures = 0;
bmsRetryIntervalMs = BMS_RETRY_INTERVAL_CONNECTED_MS;
bmsData.connected = true;
if (millis() - lastReadAttempt < READ_INTERVAL_MS) {
return;
}
lastReadAttempt = millis();
if (!connectBms()) {
return;
}
if (requestPacket(JBD_STATUS_REQUEST, sizeof(JBD_STATUS_REQUEST))) {
parseBasicInfo();
}
delay(100);
if (requestPacket(JBD_CELL_REQUEST, sizeof(JBD_CELL_REQUEST))) {
parseCellVoltages();
}
}