diff --git a/Core/Inc/bmsConfig.h b/Core/Inc/bmsConfig.h index 71071cf..431c1b3 100644 --- a/Core/Inc/bmsConfig.h +++ b/Core/Inc/bmsConfig.h @@ -49,7 +49,7 @@ #define LOW_CELL_TIME 15000 #define HIGH_TEMP_TIME 60000 #define INT_CELL_COMM_TIME 1000 -#define HIGH_INT_TEMP_TIME 0 // TODO SET THIS +#define HIGH_INT_TEMP_TIME 10000 #define CURR_ERR_MARG 50 // in A * 10 #define DCDC_CURRENT_DRAW 2 // in A, this is generous diff --git a/Core/Src/stateMachine.c b/Core/Src/stateMachine.c index 3b1e2cc..b9b84ac 100644 --- a/Core/Src/stateMachine.c +++ b/Core/Src/stateMachine.c @@ -231,10 +231,10 @@ uint32_t sm_fault_return(acc_data_t* accData) fault_table[3] = (fault_eval_t) {.id = "High Cell Voltage", .timer = ovr_chgvolt_timer, .data_1 = fault_data->max_voltage.val, .optype_1 = GT, .lim_1 = MAX_CHARGE_VOLT * 10000, .timeout = OVER_VOLT_TIME, .code = CELL_VOLTAGE_TOO_HIGH, .optype_2 = NOP/* ---------------------------UNUSED-------------------*/ }; fault_table[4] = (fault_eval_t) {.id = "High Cell Voltage", .timer = ovr_volt_timer, .data_1 = fault_data->max_voltage.val, .optype_1 = GT, .lim_1 = MAX_VOLT * 10000, .timeout = OVER_VOLT_TIME, .code = CELL_VOLTAGE_TOO_HIGH, .optype_2 = EQ, .data_2 = fault_data->is_charger_connected,.lim_2 = false }; fault_table[5] = (fault_eval_t) {.id = "High Temp", .timer = high_temp_timer, .data_1 = fault_data->max_temp.val, .optype_1 = GT, .lim_1 = MAX_CELL_TEMP, .timeout = LOW_CELL_TIME, .code = PACK_TOO_HOT, .optype_2 = NOP/* ----------------------------------------------------*/ }; - fault_table[6] = (fault_eval_t) {.id = "Internal Cell Comm Fault",.timer = int_cell_comm_tmr, .data_1 = cell_comm_fault_status, .optype_1 = NEQ,.lim_1 = FAULTS_CLEAR, .timeout = INT_CELL_COMM_TIME, .code = INTERNAL_CELL_COMM_FAULT, .optype_2 = NOP/* --------------------------UNUSED--------------------*/ }; - fault_table[7] = (fault_eval_t) {.id = "Extremely Low Voltage", .timer = low_cell_timer, .data_1 = fault_data->min_voltage.val, .optype_1 = LT, .lim_1 = 900, .timeout = HIGH_TEMP_TIME, .code = LOW_CELL_VOLTAGE, .optype_2 = NOP/* --------------------------UNUSED--------------------*/ }; - fault_table[8] = (fault_eval_t) {.id = "High Internal Temp", .timer = int_temp_tmr, .data_1 =fault_data->sht30_data->temp, .optype_1 = GT, .lim_1 = MAX_INTERNAL_TEMP, .timeout = HIGH_INT_TEMP_TIME, .code = INTERNAL_THERMAL_ERROR, .optype_2 = NOP /* -----------------------------------UNUSED-----------*/ }; - fault_table[8] = (fault_eval_t) {.id = NULL}; + //fault_table[6] = (fault_eval_t) {.id = "Internal Cell Comm Fault",.timer = int_cell_comm_tmr, .data_1 = cell_comm_fault_status, .optype_1 = NEQ,.lim_1 = FAULTS_CLEAR, .timeout = INT_CELL_COMM_TIME, .code = INTERNAL_CELL_COMM_FAULT, .optype_2 = NOP/* --------------------------UNUSED--------------------*/ }; + fault_table[6] = (fault_eval_t) {.id = "Extremely Low Voltage", .timer = low_cell_timer, .data_1 = fault_data->min_voltage.val, .optype_1 = LT, .lim_1 = 900, .timeout = HIGH_TEMP_TIME, .code = LOW_CELL_VOLTAGE, .optype_2 = NOP/* --------------------------UNUSED--------------------*/ }; + //fault_table[8] = (fault_eval_t) {.id = "High Internal Temp", .timer = int_temp_tmr, .data_1 =fault_data->sht30_data->temp, .optype_1 = GT, .lim_1 = MAX_INTERNAL_TEMP, .timeout = HIGH_INT_TEMP_TIME, .code = INTERNAL_THERMAL_ERROR, .optype_2 = NOP /* -----------------------------------UNUSED-----------*/ }; + fault_table[7] = (fault_eval_t) {.id = NULL}; // clang-format on } static uint32_t fault_status = 0;