preliminary support for the two RGB status leds
Note: pin assignments not final
This commit is contained in:
@ -25,17 +25,21 @@ void shunt_init() {
|
||||
|
||||
void shunt_check() {
|
||||
int is_error = 0;
|
||||
TSErrorKind error_type = TS_ERRORKIND_NONE;
|
||||
if (HAL_GetTick() - shunt_data.last_message > SHUNT_TIMEOUT) {
|
||||
is_error = 1;
|
||||
error_type = TS_ERRORKIND_SHUNT_TIMEOUT;
|
||||
can_send_error(TS_ERRORKIND_SHUNT_TIMEOUT, 0);
|
||||
} else if (shunt_data.current >= SHUNT_THRESH_OVERCURRENT) {
|
||||
is_error = 1;
|
||||
can_send_error(TS_ERRORKIND_SHUNT_OVERTEMP, 0);
|
||||
error_type = TS_ERRORKIND_SHUNT_OVERCURRENT;
|
||||
can_send_error(TS_ERRORKIND_SHUNT_OVERCURRENT, 0);
|
||||
} else if (shunt_data.busbartemp >= SHUNT_THRESH_OVERTEMP) {
|
||||
is_error = 1;
|
||||
error_type = TS_ERRORKIND_SHUNT_OVERTEMP;
|
||||
can_send_error(TS_ERRORKIND_SHUNT_OVERTEMP, 0);
|
||||
}
|
||||
ts_sm_set_error_source(TS_ERROR_SOURCE_SHUNT, is_error);
|
||||
ts_sm_set_error_source(TS_ERROR_SOURCE_SHUNT, error_type, is_error);
|
||||
}
|
||||
|
||||
void shunt_handle_can_msg(uint16_t id, const uint8_t *data) {
|
||||
|
||||
Reference in New Issue
Block a user