-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PD power seq implementation #249
Conversation
signals: | ||
notification: | ||
length: 8 | ||
relay_status: | ||
length: 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use mc_status: - precharge_status for the precharge status, and add power_distribution to the mc_states target
@@ -44,3 +44,31 @@ StatusCode pd_set_output_group(OutputGroup group, OutputState state) { | |||
} | |||
return STATUS_CODE_OK; | |||
} | |||
|
|||
StatusCode pd_set_active_output_group(OutputGroup group) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize the current method we have won't work, since if we're turning everything off that we don't need, that includes the lights and whatnot that we don't want to touch. I think we will need to split this into two output configs, one for the main boards and then one for all the other non-functional outputs (lights etc). We can still use the same methods, we'll just have to specify which output group we're talking about.
} | ||
} | ||
if (!found) { | ||
status_ok_or_return(bts_output_enable_output(&g_output_config[output])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be disable output right?
static void prv_init_state_output(void *context) { | ||
LOG_DEBUG("Transitioned to INIT_STATE\n"); | ||
static PowerFsmContext power_context = { 0 }; | ||
static const GpioAddress dcdc_valid_pin = DCDC_VALID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can remove this pin definition, and use elbert's methods
static PowerFsmContext power_context = { 0 }; | ||
static const GpioAddress dcdc_valid_pin = DCDC_VALID; | ||
|
||
static GlobalErrorCode prv_fault_check() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the #define fault check to the c file. It should check for a watchdog timeout, or a fault received from BMS, if either has occurred transition to Fault
power_context.latest_state == TURN_ON_DRIVE_OUTPUTS) { | ||
pd_set_output_group(OUTPUT_GROUP_DRIVE, OUTPUT_STATE_OFF); | ||
} | ||
pd_set_output_group(OUTPUT_GROUP_POWER_ON, OUTPUT_STATE_ON); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to set fault state enabled (Relays off)
OUTPUT_GROUP_HAZARD, | ||
// Power States |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split the outputs into two Enums.
// Outputs for the power FSM are such that if a group is on, all others must be off
// Use pd_set_active_output_group to set power fsm outputs
// PowerFsmOutputs and LightOutputs should not be combined in output groups
OutputPowerFsm {
... = 0,
...
NUM_POWER_FSM_OUTPUTS,
}
// Light outputs are independently controlled, separate to the power states
// Use pd_set_active_output_group to set light outputs
OutputLights {
BPS_STROBE = NUM_POWER_FSM_OUTPUTS,
RIGHT_TURN,
LEFT_TURN,
BRAKE,
};
@@ -89,6 +89,11 @@ typedef enum { | |||
OUTPUT_GROUP_LEFT_TURN, | |||
OUTPUT_GROUP_RIGHT_TURN, | |||
OUTPUT_GROUP_HAZARD, | |||
// Power States | |||
OUTPUT_GROUP_BMS_RELAYS, | |||
OUTPUT_GROUP_POWER_OFF, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OUTPUT_GROUP_POWER_... -> Power fsm output group
OUTPUT_GROUP_LIGHTS_... -> lights output group
@@ -89,6 +89,11 @@ typedef enum { | |||
OUTPUT_GROUP_LEFT_TURN, | |||
OUTPUT_GROUP_RIGHT_TURN, | |||
OUTPUT_GROUP_HAZARD, | |||
// Power States | |||
OUTPUT_GROUP_BMS_RELAYS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, just noticing this but I think we might have more output groups than we need here. Pretty sure they only change for the major states, (OFF | ON | DRIVE | FAULT) so we should only need 4 POWER_FSM_OUTPUTS. Lmk if I missed something
ac88b47
to
1a3d773
Compare
No description provided.