1
1
const int CADILLAC_STEER_MAX = 150 ; // 1s
2
- const int CADILLAC_IGNITION_TIMEOUT = 1000000 ; // 1s
3
2
// real time torque limit to prevent controls spamming
4
3
// the real time limit is 1500/sec
5
4
const int CADILLAC_MAX_RT_DELTA = 75 ; // max delta torque allowed for real time checks
@@ -11,7 +10,6 @@ const int CADILLAC_DRIVER_TORQUE_FACTOR = 4;
11
10
12
11
int cadillac_ign = 0 ;
13
12
int cadillac_cruise_engaged_last = 0 ;
14
- uint32_t cadillac_ts_ign_last = 0 ;
15
13
int cadillac_rt_torque_last = 0 ;
16
14
int cadillac_desired_torque_last = 0 ;
17
15
uint32_t cadillac_ts_last = 0 ;
@@ -31,9 +29,8 @@ static void cadillac_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
31
29
}
32
30
33
31
// this message isn't all zeros when ignition is on
34
- if ((addr == 0x160 ) && (bus_number == 0 ) && to_push -> RDLR ) {
35
- cadillac_ign = 1 ;
36
- cadillac_ts_ign_last = TIM2 -> CNT ; // reset timer when ign is received
32
+ if (addr == 0x160 && bus_number == 0 ) {
33
+ cadillac_ign = to_push -> RDLR > 0 ;
37
34
}
38
35
39
36
// enter controls on rising edge of ACC, exit controls on ACC off
@@ -131,15 +128,11 @@ static int cadillac_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
131
128
}
132
129
133
130
static void cadillac_init (int16_t param ) {
131
+ controls_allowed = 0 ;
134
132
cadillac_ign = 0 ;
135
133
}
136
134
137
135
static int cadillac_ign_hook () {
138
- uint32_t ts = TIM2 -> CNT ;
139
- uint32_t ts_elapsed = get_ts_elapsed (ts , cadillac_ts_ign_last );
140
- if (ts_elapsed > CADILLAC_IGNITION_TIMEOUT ) {
141
- cadillac_ign = 0 ;
142
- }
143
136
return cadillac_ign ;
144
137
}
145
138
0 commit comments