Commit 8fa507b 1 parent c7e2c2d commit 8fa507b Copy full SHA for 8fa507b
File tree 2 files changed +3
-7
lines changed
2 files changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ static void cadillac_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
23
23
uint32_t addr = to_push -> RIR >> 21 ;
24
24
25
25
if (addr == 356 ) {
26
- int torque_driver_new = ((to_push -> RDLR & 0x3 ) << 8 ) | ((to_push -> RDLR >> 8 ) & 0xFF );
26
+ int torque_driver_new = ((to_push -> RDLR & 0x7 ) << 8 ) | ((to_push -> RDLR >> 8 ) & 0xFF );
27
27
torque_driver_new = to_signed (torque_driver_new , 11 );
28
28
29
29
// update array of sample
Original file line number Diff line number Diff line change @@ -136,14 +136,10 @@ static int gm_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
136
136
if (addr == 384 ) {
137
137
int rdlr = to_send -> RDLR ;
138
138
int steer = ((rdlr & 0x7 ) << 8 ) + ((rdlr & 0xFF00 ) >> 8 );
139
+ steer = to_signed (steer , 11 );
139
140
int max_steer = 255 ;
140
141
if (current_controls_allowed ) {
141
- // Signed arithmetic
142
- if (steer & 0x400 ) {
143
- if (steer < (0x800 - max_steer )) return 0 ;
144
- } else {
145
- if (steer > max_steer ) return 0 ;
146
- }
142
+ if ((steer > max_steer ) || (steer < - max_steer )) return 0 ;
147
143
} else {
148
144
if (steer != 0 ) return 0 ;
149
145
}
You can’t perform that action at this time.
0 commit comments