add bms id to module status
This commit is contained in:
parent
4926e9b2a4
commit
d5885ae849
@ -76,7 +76,7 @@ struct ADBMS6830_Internal_Status {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
int16_t cellVoltages[MAXIMUM_CELL_VOLTAGES];
|
int16_t cellVoltages[MAXIMUM_CELL_VOLTAGES];
|
||||||
int16_t auxVoltages[MAXIMUM_AUX_VOLTAGES];
|
int16_t auxVoltages[MAXIMUM_AUX_VOLTAGES];
|
||||||
uint32_t bmsID;
|
uint64_t bmsID;
|
||||||
|
|
||||||
struct ADBMS6830_Internal_Status status;
|
struct ADBMS6830_Internal_Status status;
|
||||||
int16_t internalDieTemp;
|
int16_t internalDieTemp;
|
||||||
|
@ -62,7 +62,7 @@ HAL_StatusTypeDef amsReset() {
|
|||||||
id |= sidbuffer[BUFFER_BMS_OFFSET(i, SID_GROUP_SIZE) + j] << (j * 8);
|
id |= sidbuffer[BUFFER_BMS_OFFSET(i, SID_GROUP_SIZE) + j] << (j * 8);
|
||||||
}
|
}
|
||||||
modules[i].bmsID = id;
|
modules[i].bmsID = id;
|
||||||
debug_log_cont(LOG_LEVEL_INFO, "0x%lx%lx ", (uint32_t)(id >> 32), (uint32_t)(id & 0xFFFFFFFF)); //newlib does not support %llu
|
debug_log_cont(LOG_LEVEL_INFO, "0x%08lx%08lx ", (uint32_t)(id >> 32), (uint32_t)(id & 0xFFFFFFFF)); //newlib does not support %llu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ int main(void)
|
|||||||
debug_log(LOG_LEVEL_INFO, "AMS_Master on %s (%s), compiled at %s", COMMIT_BRANCH, COMMIT_HASH, COMPILE_DATE);
|
debug_log(LOG_LEVEL_INFO, "AMS_Master on %s (%s), compiled at %s", COMMIT_BRANCH, COMMIT_HASH, COMPILE_DATE);
|
||||||
debug_log(LOG_LEVEL_INFO, "Starting BMS...");
|
debug_log(LOG_LEVEL_INFO, "Starting BMS...");
|
||||||
auto ret = battery_init(&hspi1);
|
auto ret = battery_init(&hspi1);
|
||||||
while (ret != HAL_OK) {
|
while (ret != HAL_OK) { //TODO: properly handle reapeated initialization failure
|
||||||
debug_log(LOG_LEVEL_ERROR, "Failed to initialize BMS!");
|
debug_log(LOG_LEVEL_ERROR, "Failed to initialize BMS!");
|
||||||
HAL_Delay(100);
|
HAL_Delay(100);
|
||||||
debug_log(LOG_LEVEL_INFO, "Retrying BMS initialization...");
|
debug_log(LOG_LEVEL_INFO, "Retrying BMS initialization...");
|
||||||
|
@ -14,6 +14,7 @@ void print_battery_info() {
|
|||||||
|
|
||||||
for (size_t i = 0; i < N_BMS; i++) {
|
for (size_t i = 0; i < N_BMS; i++) {
|
||||||
debug_log(LOG_LEVEL_INFO, "Module %d status:", i);
|
debug_log(LOG_LEVEL_INFO, "Module %d status:", i);
|
||||||
|
debug_log(LOG_LEVEL_INFO, " BMS ID: 0x%08lx%08lx", (uint32_t)(modules[i].bmsID >> 32), (uint32_t)(modules[i].bmsID & 0xFFFFFFFF));
|
||||||
|
|
||||||
// Print cell voltages in 4x4 format
|
// Print cell voltages in 4x4 format
|
||||||
debug_log(LOG_LEVEL_INFO, " Cell voltages (mV):");
|
debug_log(LOG_LEVEL_INFO, " Cell voltages (mV):");
|
||||||
@ -137,7 +138,6 @@ void print_battery_info() {
|
|||||||
" Module %d voltage issues - OV: 0x%08lX, UV: 0x%08lX", i,
|
" Module %d voltage issues - OV: 0x%08lX, UV: 0x%08lX", i,
|
||||||
modules[i].overVoltage, modules[i].underVoltage);
|
modules[i].overVoltage, modules[i].underVoltage);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
debug_log(LOG_LEVEL_INFO, "\n------ Updated at %lu ------", HAL_GetTick());
|
debug_log(LOG_LEVEL_INFO, "\n------ Updated at %lu ------", HAL_GetTick());
|
||||||
}
|
}
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user