Commit 74ad3d6 Commaremote
committed
1 parent 38a9ea9 commit 74ad3d6 Copy full SHA for 74ad3d6
File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,9 @@ const int GM_MAX_RATE_UP = 7;
15
15
const int GM_MAX_RATE_DOWN = 17 ;
16
16
const int GM_DRIVER_TORQUE_ALLOWANCE = 50 ;
17
17
const int GM_DRIVER_TORQUE_FACTOR = 4 ;
18
+ const int GM_MAX_GAS = 3072 ;
19
+ const int GM_MAX_REGEN = 1404 ;
20
+ const int GM_MAX_BRAKE = 255 ;
18
21
19
22
int gm_brake_prev = 0 ;
20
23
int gm_gas_prev = 0 ;
@@ -143,7 +146,7 @@ static int gm_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
143
146
int brake = ((rdlr & 0xF ) << 8 ) + ((rdlr & 0xFF00 ) >> 8 );
144
147
brake = (0x1000 - brake ) & 0xFFF ;
145
148
if (current_controls_allowed ) {
146
- if (brake > 255 ) return 0 ;
149
+ if (brake > GM_MAX_BRAKE ) return 0 ;
147
150
} else {
148
151
if (brake != 0 ) return 0 ;
149
152
}
@@ -207,11 +210,11 @@ static int gm_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
207
210
int gas_regen = ((rdlr & 0x7F0000 ) >> 11 ) + ((rdlr & 0xF8000000 ) >> 27 );
208
211
int apply = rdlr & 1 ;
209
212
if (current_controls_allowed ) {
210
- if (gas_regen > 3072 ) return 0 ;
213
+ if (gas_regen > GM_MAX_GAS ) return 0 ;
211
214
} else {
212
215
// Disabled message is !engaed with gas
213
216
// value that corresponds to max regen.
214
- if (apply || gas_regen != 1404 ) return 0 ;
217
+ if (apply || gas_regen != GM_MAX_REGEN ) return 0 ;
215
218
}
216
219
}
217
220
You can’t perform that action at this time.
0 commit comments