diff --git a/AMS_Master_Code/Core/Src/main.c b/AMS_Master_Code/Core/Src/main.c index 467ae95..28c8af4 100644 --- a/AMS_Master_Code/Core/Src/main.c +++ b/AMS_Master_Code/Core/Src/main.c @@ -117,7 +117,7 @@ int main(void) int error_count = 0; while (1) { - if (error_count > 10) { + if (error_count > 25) { debug_log(LOG_LEVEL_ERROR, "Too many errors, restarting BMS..."); status = AMS_Init(&hspi1); if (status.status != ADBMS_NO_ERROR) { @@ -125,6 +125,7 @@ int main(void) HAL_Delay(2000); continue; } + error_count = 0; } status = AMS_Idle_Loop(); if (status.status != ADBMS_NO_ERROR) {