safety: add safety param for gas interceptor (#1735)

* some refactoring still needing to be done here

* 50hz

* set rx checks

* tx msgs

* test

* fix

* forgot to check this since it's static now

* enable_gas_interceptor

* more

* remove int funcs since are common

* generic!

* not generic

* need to set counter now

* set_enable_gas_interceptor not needed

* already reset in safety init

* fix test

* remove gas_interceptor_detected (partly)

* oof need for hjonda too

* edit structs

* more honda (still broken)

* fix typo

* shift these down

* can also make this extensible

* stash

* defining classes is much simpler, maybe in future we will have some sort of wrapper after some more thought

* remove create_interceptor_test now

* add lta interceptor

* clean up print

* clean up

* once

* type hint

* rm

* no interceptor with stock long + good test

* add interceptor counter to honda

* need alt interceptor + set rx checks for honda

* we were never testing button enable with nidec + interceptor!

honda almost all passing

* these fixes make sense

* clean up

* better

* clean up test cov

* clean up

* not needed

* fix tx msgs

* clean up

* cppcheck

* fix

* unnecessary
This commit is contained in:
Shane Smiskol
2023-12-14 15:22:17 -08:00
committed by GitHub
parent 30647d6604
commit bb75afc84e
13 changed files with 195 additions and 78 deletions

View File

@@ -167,9 +167,9 @@ class Panda:
HW_TYPE_TRES = b'\x09'
CAN_PACKET_VERSION = 4
HEALTH_PACKET_VERSION = 14
HEALTH_PACKET_VERSION = 15
CAN_HEALTH_PACKET_VERSION = 5
HEALTH_STRUCT = struct.Struct("<IIIIIIIIIBBBBBBHBBBHfBBHBHHB")
HEALTH_STRUCT = struct.Struct("<IIIIIIIIIBBBBBHBBBHfBBHBHHB")
CAN_HEALTH_STRUCT = struct.Struct("<BIBBBBBBBBIIIIIIIHHBBBIIII")
F2_DEVICES = [HW_TYPE_PEDAL, ]
@@ -193,11 +193,13 @@ class Panda:
FLAG_TOYOTA_ALT_BRAKE = (1 << 8)
FLAG_TOYOTA_STOCK_LONGITUDINAL = (2 << 8)
FLAG_TOYOTA_LTA = (4 << 8)
FLAG_TOYOTA_GAS_INTERCEPTOR = (8 << 8)
FLAG_HONDA_ALT_BRAKE = 1
FLAG_HONDA_BOSCH_LONG = 2
FLAG_HONDA_NIDEC_ALT = 4
FLAG_HONDA_RADARLESS = 8
FLAG_HONDA_GAS_INTERCEPTOR = 16
FLAG_HYUNDAI_EV_GAS = 1
FLAG_HYUNDAI_HYBRID_GAS = 2
@@ -591,22 +593,21 @@ class Panda:
"ignition_line": a[9],
"ignition_can": a[10],
"controls_allowed": a[11],
"gas_interceptor_detected": a[12],
"car_harness_status": a[13],
"safety_mode": a[14],
"safety_param": a[15],
"fault_status": a[16],
"power_save_enabled": a[17],
"heartbeat_lost": a[18],
"alternative_experience": a[19],
"interrupt_load": a[20],
"fan_power": a[21],
"safety_rx_checks_invalid": a[22],
"spi_checksum_error_count": a[23],
"fan_stall_count": a[24],
"sbu1_voltage_mV": a[25],
"sbu2_voltage_mV": a[26],
"som_reset_triggered": a[27],
"car_harness_status": a[12],
"safety_mode": a[13],
"safety_param": a[14],
"fault_status": a[15],
"power_save_enabled": a[16],
"heartbeat_lost": a[17],
"alternative_experience": a[18],
"interrupt_load": a[19],
"fan_power": a[20],
"safety_rx_checks_invalid": a[21],
"spi_checksum_error_count": a[22],
"fan_stall_count": a[23],
"sbu1_voltage_mV": a[24],
"sbu2_voltage_mV": a[25],
"som_reset_triggered": a[26],
}
@ensure_can_health_packet_version