-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fwxv 171 power fsm implementation (#170)
* Inital commit * Updated a few sequence states * Power FSM implemented with very janky status checks * Test OFF to MAIN * Updated power fsm test * Updated yamls * Updated tests * Fixed segfault * Format * Format again * Can data header file and update power_fsm_sequence * yay it is segfaulting again * Test is passing * Format * Integrate watchdog changes * fix fsm context * Updated test and can data * Format * Address comments * Add can recv checking * Updated something * Added notify. Test failing * Updated fsm shared mem * Band-aid solution for context * Clean up * Reverted unwanted change * Remove prv from header files * Update Power FSM shared memory * Add small brake threshold * Format * Fix build error --------- Co-authored-by: ShiCheng Lu <[email protected]>
- Loading branch information
1 parent
aa11ebb
commit 04df68d
Showing
14 changed files
with
584 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#pragma once | ||
|
||
// Aux battery status bits | ||
// https://uwmidsun.atlassian.net/wiki/spaces/ELEC/pages/3149398021/FWXV+Power+Select+Design | ||
#define AUX_STATUS_BITS 0x04 | ||
#define AUX_FAULT_BITS 0xE0 | ||
|
||
// PD messages (Todo) | ||
#define PD_FRONT_FAULT 0x00 | ||
#define PD_REAR_FAULT 0x00 | ||
|
||
// BMS send power notification (Todo) | ||
#define SET_BMS_POWER_NOTIFY 0x01 | ||
|
||
// BPS hearbeat success message (Todo) | ||
#define BPS_HEARTBEAT 0x00 | ||
|
||
// Relay setters (Todo) | ||
#define SET_CLOSE_RELAY_STATE_MASK 0x01 | ||
#define SET_CLOSE_RELAY_STATE_STATE 0x01 | ||
|
||
// Relay closed status (Todo) | ||
#define CLOSE_HV_STATUS 0x01 | ||
#define CLOSE_GND_STATUS 0x01 | ||
|
||
// DCDC status bits | ||
// https://uwmidsun.atlassian.net/wiki/spaces/ELEC/pages/3149398021/FWXV+Power+Select+Design | ||
#define DCDC_STATUS_BITS 0x02 | ||
#define DCDC_FAULT_BITS 0x1C | ||
|
||
// PD send turn on everything notification (Todo) | ||
#define SET_TURN_ON_EVERYTHING_NOTIFICATION 0x00 | ||
|
||
// MCI send ready to drive (Todo) | ||
#define SET_READY_TO_DRIVE 0x01 | ||
|
||
// MCI set discharge precharge (Todo) | ||
#define SET_DISCHARGE_PRECHARGE 0x01 | ||
|
||
// MCI precharge completed | ||
#define PRECHARGE_COMPLETED_NOTIFCIATION 0x01 | ||
|
||
// Relay setters (Todo) | ||
#define SET_OPEN_RELAY_STATE_MASK 0x00 | ||
#define SET_OPEN_RELAY_STATE_STATE 0x00 | ||
|
||
// Relay open status (Todo) | ||
#define OPEN_HV_STATUS 0x01 | ||
#define OPEN_GND_STATUS 0x01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,43 @@ | ||
#ifndef PROJECTS_CENTRE_CONSOLE_INC_POWER_FSM_SEQUENCE_H_ | ||
#define PROJECTS_CENTRE_CONSOLE_INC_POWER_FSM_SEQUENCE_H_ | ||
#pragma once | ||
|
||
#include "fsm.h" | ||
|
||
// Tell power select to check any aux faults before enabling power | ||
void prv_power_fsm_confirm_aux_status_input(Fsm *fsm, void *context); | ||
void prv_power_fsm_confirm_aux_status_output(void *context); | ||
void power_fsm_confirm_aux_status_output(void *context); | ||
void power_fsm_confirm_aux_status_input(Fsm *fsm, void *context); | ||
|
||
// Tell Power distribution to power on BMS board | ||
void prv_power_fsm_send_pd_bms_input(Fsm *fsm, void *context); | ||
void prv_power_fsm_send_pd_bms_output(void *context); | ||
void power_fsm_send_pd_bms_output(void *context); | ||
void power_fsm_send_pd_bms_input(Fsm *fsm, void *context); | ||
|
||
// Confirms battery checks, waits for ack | ||
void prv_power_fsm_confirm_battery_status_input(Fsm *fsm, void *context); | ||
void prv_power_fsm_confirm_battery_status_output(void *context); | ||
void power_fsm_confirm_battery_status_output(void *context); | ||
void power_fsm_confirm_battery_status_input(Fsm *fsm, void *context); | ||
|
||
// Transmits to BMS to close relays | ||
void prv_power_fsm_close_battery_relays_input(Fsm *fsm, void *context); | ||
void prv_power_fsm_close_battery_relays_output(void *context); | ||
void power_fsm_close_battery_relays_output(void *context); | ||
void power_fsm_close_battery_relays_input(Fsm *fsm, void *context); | ||
|
||
// Power Select confirms DCDC | ||
void prv_power_fsm_confirm_dc_dc_input(Fsm *fsm, void *context); | ||
void prv_power_fsm_confirm_dc_dc_output(void *context); | ||
void power_fsm_confirm_dc_dc_output(void *context); | ||
void power_fsm_confirm_dc_dc_input(Fsm *fsm, void *context); | ||
|
||
// Power Distribution enables all boards | ||
void prv_power_fsm_turn_on_everything_input(Fsm *fsm, void *context); | ||
void prv_power_fsm_turn_on_everything_output(void *context); | ||
void power_fsm_turn_on_everything_output(void *context); | ||
void power_fsm_turn_on_everything_input(Fsm *fsm, void *context); | ||
|
||
// Sends “ready to drive” to MCI | ||
void prv_power_fsm_power_main_complete_input(Fsm *fsm, void *context); | ||
void prv_power_fsm_power_main_complete_output(void *context); | ||
void power_fsm_power_main_complete_output(void *context); | ||
void power_fsm_power_main_complete_input(Fsm *fsm, void *context); | ||
|
||
// Send message to MCI to discharge precharge | ||
void prv_power_fsm_discharge_precharge_input(Fsm *fsm, void *context); | ||
void prv_power_fsm_discharge_precharge_output(void *context); | ||
void power_fsm_discharge_precharge_output(void *context); | ||
void power_fsm_discharge_precharge_input(Fsm *fsm, void *context); | ||
|
||
// Tell Power distribution to turn off the relevant boards | ||
void prv_power_fsm_turn_off_everything_input(Fsm *fsm, void *context); | ||
void prv_power_fsm_turn_off_everything_output(void *context); | ||
void power_fsm_turn_off_everything_output(void *context); | ||
void power_fsm_turn_off_everything_input(Fsm *fsm, void *context); | ||
|
||
// Tell BMS to open the relays | ||
void prv_power_fsm_open_relays_input(Fsm *fsm, void *context); | ||
void prv_power_fsm_open_relays_output(void *context); | ||
|
||
#endif // PROJECTS_CENTRE_CONSOLE_INC_POWER_FSM_SEQUENCE_H_ | ||
void power_fsm_open_relays_output(void *context); | ||
void power_fsm_open_relays_input(Fsm *fsm, void *context); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.