give bms time to settle before erroring immediately
This commit is contained in:
parent
2ca3f72de8
commit
a88f663afc
@ -114,14 +114,22 @@ int main(void)
|
||||
/* Infinite loop */
|
||||
/* USER CODE BEGIN WHILE */
|
||||
int count = 0;
|
||||
int error_count = 0;
|
||||
while (1)
|
||||
{
|
||||
if (error_count > 10) {
|
||||
debug_log(LOG_LEVEL_ERROR, "Too many errors, restarting BMS...");
|
||||
status = AMS_Init(&hspi1);
|
||||
if (status.status != ADBMS_NO_ERROR) {
|
||||
debug_log(LOG_LEVEL_ERROR, "Failed to initialize BMS, AMS_Init returned %u (%s) on BMS %d", status.status, ADBMS_Status_ToString(status.status), status.bms_id);
|
||||
HAL_Delay(2000);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
status = AMS_Idle_Loop();
|
||||
if (status.status != ADBMS_NO_ERROR) {
|
||||
debug_log(LOG_LEVEL_ERROR, "AMS_Idle_Loop returned %u (%s) on BMS %d", status.status, ADBMS_Status_ToString(status.status), status.bms_id);
|
||||
HAL_Delay(2000);
|
||||
AMS_Init(&hspi1);
|
||||
continue;
|
||||
error_count++;
|
||||
}
|
||||
if (count % 4 == 0) {
|
||||
for (size_t i = 0; i < N_BMS; i++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user