From 8b5a6da08b202ef361e2e8a243125b6cbb51ce54 Mon Sep 17 00:00:00 2001 From: Akashem06 Date: Wed, 24 Apr 2024 00:24:02 +0000 Subject: [PATCH] formatting --- projects/bms_carrier/inc/current_sense.h | 12 +++++------- projects/bms_carrier/src/cell_sense.c | 2 +- projects/bms_carrier/src/main.c | 8 ++++---- projects/centre_console/src/update_dashboard.c | 3 ++- projects/power_distribution/src/power_seq_fsm.c | 9 ++++++--- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/projects/bms_carrier/inc/current_sense.h b/projects/bms_carrier/inc/current_sense.h index decd3d171..10cb45fd6 100644 --- a/projects/bms_carrier/inc/current_sense.h +++ b/projects/bms_carrier/inc/current_sense.h @@ -21,22 +21,20 @@ #define PACK_CAPACITY_MAH 3000 // Capacity in units of 5.0uVh/Rsense -#define MAIN_PACK_DESIGN_CAPACITY \ - (PACK_CAPACITY_MAH * CURRENT_SENSE_R_SENSE_MOHMS / 5) +#define MAIN_PACK_DESIGN_CAPACITY (PACK_CAPACITY_MAH * CURRENT_SENSE_R_SENSE_MOHMS / 5) // LSB = 78.125 (micro Volts) #define MAIN_PACK_EMPTY_VOLTAGE_MV 2500 -#define MAIN_PACK_EMPTY_VOLTAGE (MAIN_PACK_EMPTY_VOLTAGE_MV / 78.125) - +#define MAIN_PACK_EMPTY_VOLTAGE (MAIN_PACK_EMPTY_VOLTAGE_MV / 78.125) #define CHARGE_TERMINATION_CURRENT 0 // // TODO (Adel C): Change these values to their actual values // #define CURRENT_SENSE_R_SENSE_MILLI_OHMS (0.5) -// #define MAIN_PACK_DESIGN_CAPACITY +// #define MAIN_PACK_DESIGN_CAPACITY // (1.0f / CURRENT_SENSE_R_SENSE_MILLI_OHMS) // LSB = 5.0 (micro Volt Hours / R Sense) -// #define MAIN_PACK_EMPTY_VOLTAGE (1.0f / 78.125) // Only a 9-bit field, LSB = 78.125 (micro Volts) -// #define CHARGE_TERMINATION_CURRENT (1.0f / (1.5625f / CURRENT_SENSE_R_SENSE_MILLI_OHMS)) +// #define MAIN_PACK_EMPTY_VOLTAGE (1.0f / 78.125) // Only a 9-bit field, LSB = 78.125 (micro +// Volts) #define CHARGE_TERMINATION_CURRENT (1.0f / (1.5625f / CURRENT_SENSE_R_SENSE_MILLI_OHMS)) // Thresholds for ALRT Pin #define CURRENT_SENSE_MAX_CURRENT_A (58.2f) // 58.2 Amps diff --git a/projects/bms_carrier/src/cell_sense.c b/projects/bms_carrier/src/cell_sense.c index 206afe77f..c568b6eb8 100644 --- a/projects/bms_carrier/src/cell_sense.c +++ b/projects/bms_carrier/src/cell_sense.c @@ -145,7 +145,7 @@ StatusCode cell_sense_run() { for (size_t cell = 0; cell < (s_afe_settings.num_devices * s_afe_settings.num_cells); cell++) { LOG_DEBUG("CELL %d: %d\n\r", cell, - ltc_afe_storage->cell_voltages[ltc_afe_storage->cell_result_lookup[cell]]); + ltc_afe_storage->cell_voltages[ltc_afe_storage->cell_result_lookup[cell]]); delay_ms(3); max_voltage = ltc_afe_storage->cell_voltages[ltc_afe_storage->cell_result_lookup[cell]] > max_voltage diff --git a/projects/bms_carrier/src/main.c b/projects/bms_carrier/src/main.c index 198ae5f1d..d8abc84ae 100644 --- a/projects/bms_carrier/src/main.c +++ b/projects/bms_carrier/src/main.c @@ -39,7 +39,7 @@ void pre_loop_init() { LOG_DEBUG("Welcome to BMS \n"); fault_bps_init(&bms_storage.bps_storage); current_sense_init(&bms_storage, &i2c_settings, FUEL_GAUGE_CYCLE_TIME_MS); - cell_sense_init(&bms_storage.ltc_afe_storage); + // cell_sense_init(&bms_storage.ltc_afe_storage); aux_sense_init(&bms_storage.aux_storage); init_bms_relays(); bms_fan_init(&bms_storage); @@ -51,12 +51,12 @@ void run_medium_cycle() { run_can_rx_cycle(); wait_tasks(1); - cell_conversions(); - wait_tasks(1); + // cell_conversions(); + // wait_tasks(1); current_sense_run(); wait_tasks(1); - cell_sense_run(); + // cell_sense_run(); aux_sense_run(); bms_run_fan(); diff --git a/projects/centre_console/src/update_dashboard.c b/projects/centre_console/src/update_dashboard.c index a15cb11a1..6dcc821c8 100644 --- a/projects/centre_console/src/update_dashboard.c +++ b/projects/centre_console/src/update_dashboard.c @@ -102,7 +102,8 @@ void update_indicators(uint32_t notif) { pca9555_gpio_set_state(&s_output_leds[AUX_WARNING_LED], PCA9555_GPIO_STATE_LOW); } - if (get_battery_status_fault() || get_pd_status_power_state() == EE_POWER_FAULT_STATE || get_pd_status_bps_persist()) { + if (get_battery_status_fault() || get_pd_status_power_state() == EE_POWER_FAULT_STATE || + get_pd_status_bps_persist()) { gpio_set_state(&bps_led, GPIO_STATE_LOW); } else { gpio_set_state(&bps_led, GPIO_STATE_HIGH); diff --git a/projects/power_distribution/src/power_seq_fsm.c b/projects/power_distribution/src/power_seq_fsm.c index 0fc0c1642..ebc3abb2a 100644 --- a/projects/power_distribution/src/power_seq_fsm.c +++ b/projects/power_distribution/src/power_seq_fsm.c @@ -51,7 +51,8 @@ static void prv_precharge_output(void *context) { } static void prv_precharge_input(Fsm *fsm, void *context) { - LOG_DEBUG("GET_MOTOR_VELOCITY %d\n", (get_motor_velocity_velocity_l() + get_motor_velocity_velocity_r())); + LOG_DEBUG("GET_MOTOR_VELOCITY %d\n", + (get_motor_velocity_velocity_l() + get_motor_velocity_velocity_r())); if (get_motor_velocity_velocity_l() && get_motor_velocity_velocity_r()) { fsm_transition(fsm, POWER_STATE_OFF); } @@ -68,7 +69,8 @@ static void prv_drive_state_output(void *context) { pd_set_active_output_group(OUTPUT_GROUP_POWER_DRIVE); power_context.latest_state = POWER_STATE_DRIVE; s_bps_storage.fault_bitset = 0; - s_bps_storage.vehicle_speed = (get_motor_velocity_velocity_l() + get_motor_velocity_velocity_r()) / 2; + s_bps_storage.vehicle_speed = + (get_motor_velocity_velocity_l() + get_motor_velocity_velocity_r()) / 2; persist_commit(&s_persist); set_pd_status_bps_persist(false); set_pd_status_power_state(EE_POWER_DRIVE_STATE); @@ -89,7 +91,8 @@ static void prv_drive_state_input(Fsm *fsm, void *context) { static void prv_fault_state_output(void *context) { LOG_DEBUG("Transitioned to FAULT STATE\n"); s_bps_storage.fault_bitset = get_battery_status_fault(); - s_bps_storage.vehicle_speed = (get_motor_velocity_velocity_l() + get_motor_velocity_velocity_r()) / 2; + s_bps_storage.vehicle_speed = + (get_motor_velocity_velocity_l() + get_motor_velocity_velocity_r()) / 2; persist_commit(&s_persist); pd_set_active_output_group(OUTPUT_GROUP_POWER_FAULT); set_pd_status_bps_persist(true);