@ -4,7 +4,7 @@ from math import fabs, exp
from panda import Panda
from panda import Panda
from openpilot . common . conversions import Conversions as CV
from openpilot . common . conversions import Conversions as CV
from openpilot . selfdrive . car import create_button_event , get_safety_config
from openpilot . selfdrive . car import create_button_events , get_safety_config
from openpilot . selfdrive . car . gm . radar_interface import RADAR_HEADER_MSG
from openpilot . selfdrive . car . gm . radar_interface import RADAR_HEADER_MSG
from openpilot . selfdrive . car . gm . values import CAR , CruiseButtons , CarControllerParams , EV_CAR , CAMERA_ACC_CAR , CanBus
from openpilot . selfdrive . car . gm . values import CAR , CruiseButtons , CarControllerParams , EV_CAR , CAMERA_ACC_CAR , CanBus
from openpilot . selfdrive . car . interfaces import CarInterfaceBase , TorqueFromLateralAccelCallbackType , FRICTION_THRESHOLD
from openpilot . selfdrive . car . interfaces import CarInterfaceBase , TorqueFromLateralAccelCallbackType , FRICTION_THRESHOLD
@ -253,13 +253,10 @@ class CarInterface(CarInterfaceBase):
def _update ( self , c ) :
def _update ( self , c ) :
ret = self . CS . update ( self . cp , self . cp_cam , self . cp_loopback )
ret = self . CS . update ( self . cp , self . cp_cam , self . cp_loopback )
if self . CS . cruise_buttons != self . CS . prev_cruise_buttons and self . CS . prev_cruise_buttons != CruiseButtons . INIT :
# Don't add event if transitioning from INIT, unless it's to an actual button
buttonEvents = [ create_button_event ( self . CS . cruise_buttons , self . CS . prev_cruise_buttons , BUTTONS_DICT , CruiseButtons . UNPRESS ) ]
if self . CS . cruise_buttons != CruiseButtons . UNPRESS or self . CS . prev_cruise_buttons != CruiseButtons . INIT :
# Handle ACCButtons changing buttons mid-press
ret . buttonEvents = create_button_events ( self . CS . cruise_buttons , self . CS . prev_cruise_buttons , BUTTONS_DICT ,
if self . CS . cruise_buttons != CruiseButtons . UNPRESS and self . CS . prev_cruise_buttons != CruiseButtons . UNPRESS :
unpressed_btn = CruiseButtons . UNPRESS )
buttonEvents . append ( create_button_event ( CruiseButtons . UNPRESS , self . CS . prev_cruise_buttons , BUTTONS_DICT , CruiseButtons . UNPRESS ) )
ret . buttonEvents = buttonEvents
# The ECM allows enabling on falling edge of set, but only rising edge of resume
# The ECM allows enabling on falling edge of set, but only rising edge of resume
events = self . create_common_events ( ret , extra_gears = [ GearShifter . sport , GearShifter . low ,
events = self . create_common_events ( ret , extra_gears = [ GearShifter . sport , GearShifter . low ,