Skip to content

Commit

Permalink
Honda: Parse distance button from steering wheel (commaai#31763)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyhaibin authored and cydia2020 committed May 14, 2024
1 parent 9cc51a3 commit f4126d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions selfdrive/car/honda/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from openpilot.common.conversions import Conversions as CV
from openpilot.common.numpy_fast import interp
from openpilot.selfdrive.car.honda.hondacan import CanBus
from openpilot.selfdrive.car.honda.values import CarControllerParams, CruiseButtons, HondaFlags, CAR, HONDA_BOSCH, HONDA_NIDEC_ALT_SCM_MESSAGES, \
HONDA_BOSCH_RADARLESS
from openpilot.selfdrive.car.honda.values import CarControllerParams, CruiseButtons, CruiseSettings, HondaFlags, CAR, HONDA_BOSCH, \
HONDA_NIDEC_ALT_SCM_MESSAGES, HONDA_BOSCH_RADARLESS
from openpilot.selfdrive.car import create_button_events, get_safety_config
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
from openpilot.selfdrive.car.disable_ecu import disable_ecu
Expand All @@ -16,6 +16,7 @@
TransmissionType = car.CarParams.TransmissionType
BUTTONS_DICT = {CruiseButtons.RES_ACCEL: ButtonType.accelCruise, CruiseButtons.DECEL_SET: ButtonType.decelCruise,
CruiseButtons.MAIN: ButtonType.altButton3, CruiseButtons.CANCEL: ButtonType.cancel}
SETTINGS_BUTTONS_DICT = {CruiseSettings.DISTANCE: ButtonType.gapAdjustCruise, CruiseSettings.LKAS: ButtonType.altButton1}


class CarInterface(CarInterfaceBase):
Expand Down Expand Up @@ -237,7 +238,7 @@ def _update(self, c):

ret.buttonEvents = [
*create_button_events(self.CS.cruise_buttons, self.CS.prev_cruise_buttons, BUTTONS_DICT),
*create_button_events(self.CS.cruise_setting, self.CS.prev_cruise_setting, {1: ButtonType.altButton1}),
*create_button_events(self.CS.cruise_setting, self.CS.prev_cruise_setting, SETTINGS_BUTTONS_DICT),
]

# events
Expand Down
5 changes: 5 additions & 0 deletions selfdrive/car/honda/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ class CruiseButtons:
MAIN = 1


class CruiseSettings:
DISTANCE = 3
LKAS = 1


# See dbc files for info on values
VISUAL_HUD = {
VisualAlert.none: 0,
Expand Down

0 comments on commit f4126d5

Please sign in to comment.