-
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
Bms relay fsm (4/4 fault checks done) #261
Conversation
@@ -251,6 +258,10 @@ StatusCode ltc_afe_impl_init(LtcAfeStorage *afe, const LtcAfeSettings *settings) | |||
return prv_write_config(afe, gpio_bits); | |||
} | |||
|
|||
StatusCode ltc_afe_impl_fault_check() { | |||
return STATUS_CODE_OK | fault_bitset; |
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.
Review this
void close_relays(); | ||
void open_relays(); | ||
|
||
DECLARE_FSM(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.
nit: bms_relays
StatusCode fault_bitset = STATUS_CODE_OK; | ||
|
||
StatusCode current_sense_fault_check() { | ||
return STATUS_CODE_OK | fault_bitset; |
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.
Maybe use the global variable or juts return the variable
.scl = BMS_PERIPH_I2C_SCL_PIN, | ||
}; | ||
|
||
GpioAddress const POS_RELAY_EN = { .port = GPIO_PORT_B, .pin = 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.
nit: I think we usually have const first before the type, and usually use all caps for macros or definitions
status |= current_sense_fault_check(); | ||
|
||
status |= ltc_afe_impl_trigger_cell_conv(&s_ltc_store); | ||
// delay_ms(10); |
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 still be there
LOG_DEBUG("Bms fault check \n"); | ||
StatusCode status = STATUS_CODE_OK; | ||
|
||
status |= current_sense_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.
Fault immideatyle ehre
|
||
status |= ltc_afe_impl_read_cells(&s_ltc_store); | ||
for (int cell = 0; cell < 12; cell++) { | ||
LOG_DEBUG("CELL %d: %d\n\r", cell, |
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.
Add a todo because this only logs we dont do anything with the readings here
…use master task to fall out of sync + return spi status timeout
…dd in fault handling
Done Needs testing