Compare commits
No commits in common. "a88f663afc3fbecc807a7452f4ebc5b7352e278d" and "b9c34c9f4974480252c343b66ec62a71af021f78" have entirely different histories.
a88f663afc
...
b9c34c9f49
@ -31,9 +31,7 @@ HAL_StatusTypeDef amsReset() {
|
||||
amsWakeUp();
|
||||
readCMD(SRST, CMD_EMPTY_BUFFER, 0);
|
||||
|
||||
amsWakeUp();
|
||||
|
||||
uint8_t sidbuffer[CMD_BUFFER_SIZE(SID_GROUP_SIZE)] = {};
|
||||
/* uint8_t sidbuffer[CMD_BUFFER_SIZE(SID_GROUP_SIZE)] = {};
|
||||
if (readCMD(RDSID, sidbuffer, SID_GROUP_SIZE) != HAL_OK) {
|
||||
bool nonzero = false;
|
||||
for (size_t i = 0; i < N_BMS; i++) {
|
||||
@ -63,7 +61,7 @@ HAL_StatusTypeDef amsReset() {
|
||||
}
|
||||
debug_log_cont(LOG_LEVEL_INFO, "0x%lx%lx ", (uint32_t)(id >> 32), (uint32_t)(id & 0xFFFFFFFF)); //newlib does not support %llu
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
mcuDelay(10);
|
||||
amsWakeUp();
|
||||
|
@ -114,22 +114,14 @@ 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);
|
||||
error_count++;
|
||||
HAL_Delay(2000);
|
||||
AMS_Init(&hspi1);
|
||||
continue;
|
||||
}
|
||||
if (count % 4 == 0) {
|
||||
for (size_t i = 0; i < N_BMS; i++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user