Compare commits
No commits in common. "6d6c1c1f154b35a1ee55a3360b16d00ad41bea5f" and "bf11004c643b1469d81c66daac9e8fc43d10057e" have entirely different histories.
6d6c1c1f15
...
bf11004c64
@ -5,9 +5,8 @@
|
||||
|
||||
#include "stm32f3xx_hal.h"
|
||||
|
||||
#define SHUNT_TIMEOUT 300 // ms
|
||||
#define SHUNT_THRESH_OVERCURRENT 300000 // mA
|
||||
#define SHUNT_THRESH_OVERTEMP 1000 // 1/10 °C
|
||||
#define THRESH_OVERCURRENT 300000 // mA
|
||||
#define THRESH_OVERTEMP 1000 // 1/10 °C
|
||||
|
||||
typedef struct {
|
||||
int32_t current;
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define N_SLAVES 6
|
||||
#define N_SLAVES 5
|
||||
#define N_CELLS_SERIES 17
|
||||
#define N_CELLS_PARALLEL 5
|
||||
#define N_TEMP_SENSORS 32
|
||||
|
@ -24,13 +24,10 @@ void shunt_init() {
|
||||
|
||||
void shunt_check() {
|
||||
int is_error = 0;
|
||||
if (HAL_GetTick() - shunt_data.last_message > SHUNT_TIMEOUT) {
|
||||
is_error = 1;
|
||||
can_send_error(TS_ERRORKIND_SHUNT_TIMEOUT, 0);
|
||||
} else if (shunt_data.current >= SHUNT_THRESH_OVERCURRENT) {
|
||||
if (shunt_data.current >= THRESH_OVERCURRENT) {
|
||||
is_error = 1;
|
||||
can_send_error(TS_ERRORKIND_SHUNT_OVERTEMP, 0);
|
||||
} else if (shunt_data.busbartemp >= SHUNT_THRESH_OVERTEMP) {
|
||||
} else if (shunt_data.busbartemp >= THRESH_OVERTEMP) {
|
||||
is_error = 1;
|
||||
can_send_error(TS_ERRORKIND_SHUNT_OVERTEMP, 0);
|
||||
}
|
||||
@ -38,8 +35,6 @@ void shunt_check() {
|
||||
}
|
||||
|
||||
void shunt_handle_can_msg(uint16_t id, const uint8_t *data) {
|
||||
shunt_data.last_message = HAL_GetTick();
|
||||
|
||||
// All result messages contain a big-endian 6-byte integer
|
||||
uint64_t result = ftcan_unmarshal_unsigned(&data, 6);
|
||||
|
||||
|
@ -51,10 +51,10 @@ void ts_sm_update() {
|
||||
}
|
||||
|
||||
TSState ts_sm_update_inactive() {
|
||||
if (ts_state.target_state == TS_ACTIVE && sdc_closed) {
|
||||
if (ts_state.target_state == TS_ACTIVE) {
|
||||
precharge_95_reached_timestamp = 0;
|
||||
return TS_PRECHARGE;
|
||||
} else if (ts_state.target_state == TS_CHARGING && sdc_closed) {
|
||||
} else if (ts_state.target_state == TS_CHARGING) {
|
||||
charging_check_timestamp = HAL_GetTick();
|
||||
return TS_CHARGING_CHECK;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user