File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ static int subaru_rx_hook(CANPacket_t *to_push) {
6464 bool valid = addr_safety_check (to_push , & subaru_rx_checks ,
6565 subaru_get_checksum , subaru_compute_checksum , subaru_get_counter );
6666
67+ int addr = GET_ADDR (to_push );
6768 if (valid && (GET_BUS (to_push ) == 2U ) && subaru_forester_hybrid ) {
6869 // enter controls on rising edge of ACC, exit controls on ACC off (ES_DashStatus)
6970 if (addr == 0x321 ) {
@@ -79,7 +80,6 @@ static int subaru_rx_hook(CANPacket_t *to_push) {
7980 }
8081
8182 if (valid && (GET_BUS (to_push ) == 0U )) {
82- int addr = GET_ADDR (to_push );
8383 if (addr == 0x119 ) {
8484 int torque_driver_new ;
8585 torque_driver_new = ((GET_BYTES_04 (to_push ) >> 16 ) & 0x7FFU );
Original file line number Diff line number Diff line change @@ -73,5 +73,19 @@ def _pcm_status_msg(self, enable):
7373 return self .packer .make_can_msg_panda ("CruiseControl" , 0 , values )
7474
7575
76+ class TestSubaruForesterHybridSafety (TestSubaruSafety ):
77+
78+ def setUp (self ):
79+ self .packer = CANPackerPanda ("subaru_global_2017_generated" )
80+ self .safety = libpandasafety_py .libpandasafety
81+ self .safety .set_safety_hooks (Panda .SAFETY_SUBARU , Panda .FLAG_SUBARU_FORESTER_HYBRID )
82+ self .safety .init_tests ()
83+
84+ def _pcm_status_msg (self , enable ):
85+ values = {"Cruise_Activated" : enable , "Counter" : self .cnt_cruise % 4 }
86+ self .__class__ .cnt_cruise += 1
87+ return self .packer .make_can_msg_panda ("ES_DashStatus" , 2 , values )
88+
89+
7690if __name__ == "__main__" :
7791 unittest .main ()
You can’t perform that action at this time.
0 commit comments