@@ -87,7 +87,7 @@ static void honda_rx_hook(const CANPacket_t *to_push) {
87
87
88
88
// check ACC main state
89
89
// 0x326 for all Bosch and some Nidec, 0x1A6 for some Nidec
90
- if ((addr == 0x326 ) || (addr == 0x1A6 )) {
90
+ if ((( addr == 0x326 ) && ( bus == pt_bus ) ) || (addr == 0x1A6 )) {
91
91
acc_main_on = GET_BIT (to_push , ((addr == 0x326 ) ? 28U : 47U ));
92
92
if (!acc_main_on ) {
93
93
controls_allowed = false;
@@ -173,6 +173,11 @@ static void honda_rx_hook(const CANPacket_t *to_push) {
173
173
int bus_rdr_car = (honda_hw == HONDA_BOSCH ) ? 0 : 2 ; // radar bus, car side
174
174
bool stock_ecu_detected = false;
175
175
176
+ // // TODO: tick the body harness gatewayheartbeat. If we lose contact with the OP, should we go not controls_allowed???
177
+ // if ((addr == 0x801) && (len == 8)) {
178
+ //
179
+ // }
180
+
176
181
// If steering controls messages are received on the destination bus, it's an indication
177
182
// that the relay might be malfunctioning
178
183
if ((addr == 0xE4 ) || (addr == 0x194 )) {
@@ -197,6 +202,7 @@ static bool honda_tx_hook(const CANPacket_t *to_send) {
197
202
.min_accel = -350 ,
198
203
199
204
.max_gas = 2000 ,
205
+ .min_gas = -40 ,
200
206
.inactive_gas = -30000 ,
201
207
};
202
208
@@ -299,11 +305,29 @@ static bool honda_tx_hook(const CANPacket_t *to_send) {
299
305
}
300
306
}
301
307
308
+ // KWP over CAN. Allow only short turn signal request and cancel
309
+ // TODO: move to gateway firmware
310
+ if (addr == 0x16F118F0 ){
311
+ bool signalCmd = ((GET_LEN (to_send ) == 8U ) && ((GET_BYTES (to_send , 0 , 4 ) == 0x000F0A30U ) || (GET_BYTES (to_send , 0 , 4 ) == 0x000F0B30U )) && (GET_BYTES (to_send , 4 , 4 ) == 0x0U ));
312
+ bool cancelCmd = ((GET_LEN (to_send ) == 1U ) && (GET_BYTE (to_send , 0 ) == 0x20U ));
313
+ // always allow cancel
314
+ if (!cancelCmd ) {
315
+ if (!controls_allowed ) {
316
+ tx = false;
317
+ }
318
+ else {
319
+ if (!signalCmd ) {
320
+ tx = false;
321
+ }
322
+ }
323
+ }
324
+ }
325
+
302
326
return tx ;
303
327
}
304
328
305
329
static safety_config honda_nidec_init (uint16_t param ) {
306
- static CanMsg HONDA_N_TX_MSGS [] = {{0xE4 , 0 , 5 }, {0x194 , 0 , 4 }, {0x1FA , 0 , 8 }, {0x30C , 0 , 8 }, {0x33D , 0 , 5 }};
330
+ static CanMsg HONDA_N_TX_MSGS [] = {{0xE4 , 0 , 5 }, {0x194 , 0 , 4 }, {0x1FA , 0 , 8 }, {0x30C , 0 , 8 }, {0x33D , 0 , 5 }, { 0x16F118F0 , 0 , 8 }, { 0x16F118F0 , 0 , 1 } };
307
331
308
332
const uint16_t HONDA_PARAM_NIDEC_ALT = 4 ;
309
333
@@ -321,7 +345,7 @@ static safety_config honda_nidec_init(uint16_t param) {
321
345
322
346
if (enable_nidec_alt ) {
323
347
// For Nidecs with main on signal on an alternate msg (missing 0x326)
324
- static RxCheck honda_nidec_alt_rx_checks [] = {
348
+ static RxCheck honda_nidec_alt_rx_checks [] = {
325
349
HONDA_COMMON_NO_SCM_FEEDBACK_RX_CHECKS (0 )
326
350
};
327
351
@@ -336,10 +360,10 @@ static safety_config honda_nidec_init(uint16_t param) {
336
360
}
337
361
338
362
static safety_config honda_bosch_init (uint16_t param ) {
339
- static CanMsg HONDA_BOSCH_TX_MSGS [] = {{0xE4 , 0 , 5 }, {0xE5 , 0 , 8 }, {0x296 , 1 , 4 }, {0x33D , 0 , 5 }, {0x33DA , 0 , 5 }, {0x33DB , 0 , 8 }} ; // Bosch
340
- static CanMsg HONDA_BOSCH_LONG_TX_MSGS [] = {{0xE4 , 1 , 5 }, {0x1DF , 1 , 8 }, {0x1EF , 1 , 8 }, {0x1FA , 1 , 8 }, {0x30C , 1 , 8 }, {0x33D , 1 , 5 }, {0x33DA , 1 , 5 }, {0x33DB , 1 , 8 }, {0x39F , 1 , 8 }, {0x18DAB0F1 , 1 , 8 }}; // Bosch w/ gas and brakes
341
- static CanMsg HONDA_RADARLESS_TX_MSGS [] = {{0xE4 , 0 , 5 }, {0x296 , 2 , 4 }, {0x33D , 0 , 8 }}; // Bosch radarless
342
- static CanMsg HONDA_RADARLESS_LONG_TX_MSGS [] = {{0xE4 , 0 , 5 }, {0x33D , 0 , 8 }, {0x1C8 , 0 , 8 }, {0x30C , 0 , 8 }}; // Bosch radarless w/ gas and brakes
363
+ static CanMsg HONDA_BOSCH_TX_MSGS [] = {{0xE4 , 0 , 5 }, {0xE5 , 0 , 8 }, {0x296 , 1 , 4 }, {0x33D , 0 , 5 }, {0x33DA , 0 , 5 }, {0x33DB , 0 , 8 }, { 0x16F118F0 , 0 , 8 }, { 0x16F118F0 , 0 , 1 }} ; // Bosch w/ body
364
+ static CanMsg HONDA_BOSCH_LONG_TX_MSGS [] = {{0xE4 , 1 , 5 }, {0x1DF , 1 , 8 }, {0x1EF , 1 , 8 }, {0x1FA , 1 , 8 }, {0x30C , 1 , 8 }, {0x33D , 1 , 5 }, {0x33DA , 1 , 5 }, {0x33DB , 1 , 8 }, {0x39F , 1 , 8 }, {0x16F118F0 , 0 , 8 }, { 0x16F118F0 , 0 , 1 }, { 0x18DAB0F1 , 1 , 8 }}; // Bosch w/ gas and brakes and body
365
+ static CanMsg HONDA_RADARLESS_TX_MSGS [] = {{0xE4 , 0 , 5 }, {0x296 , 2 , 4 }, {0x33D , 0 , 8 }, { 0x16F118F0 , 0 , 8 }, { 0x16F118F0 , 0 , 1 } }; // Bosch radarless
366
+ static CanMsg HONDA_RADARLESS_LONG_TX_MSGS [] = {{0xE4 , 0 , 5 }, {0x33D , 0 , 8 }, {0x1C8 , 0 , 8 }, {0x30C , 0 , 8 }, { 0x16F118F0 , 0 , 8 }, { 0x16F118F0 , 0 , 1 } }; // Bosch radarless w/ gas and brakes
343
367
344
368
const uint16_t HONDA_PARAM_ALT_BRAKE = 1 ;
345
369
const uint16_t HONDA_PARAM_RADARLESS = 8 ;
0 commit comments