From 2d495e2c1eb178a1f57cfef79b9cc82a906e4b50 Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Mon, 4 Oct 2021 18:42:06 +0200 Subject: [PATCH] Honda Bosch: switch ACC_HUD between metric/imperial (#22428) * Honda Bosch: switch ACC_HUD between metric/imperial * bump opendbc old-commit-hash: 26ce0fa0cbffc477c5a667df4c35ba2ead2cd10a --- opendbc | 2 +- selfdrive/car/honda/carstate.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/opendbc b/opendbc index 1bf5b62008..8ca52eb1f8 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit 1bf5b62008b91456616fda342771a2ecd1b8c296 +Subproject commit 8ca52eb1f84a76c07ab6385adf64c1ee6a1a5517 diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index e42583a000..c45573c726 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -80,9 +80,11 @@ def get_can_signals(CP, gearbox_msg, main_on_sig_msg): if CP.carFingerprint in HONDA_BOSCH: signals += [ ("EPB_STATE", "EPB_STATUS", 0), + ("IMPERIAL_UNIT", "CAR_SPEED", 1), ] checks += [ ("EPB_STATUS", 50), + ("CAR_SPEED", 10), ] if not CP.openpilotLongitudinalControl: @@ -291,7 +293,12 @@ class CarState(CarStateBase): ret.brakePressed = True # TODO: discover the CAN msg that has the imperial unit bit for all other cars - self.is_metric = not cp.vl["HUD_SETTING"]["IMPERIAL_UNIT"] if self.CP.carFingerprint in (CAR.CIVIC) else False + if self.CP.carFingerprint in (CAR.CIVIC, ): + self.is_metric = not cp.vl["HUD_SETTING"]["IMPERIAL_UNIT"] + elif self.CP.carFingerprint in HONDA_BOSCH: + self.is_metric = not cp.vl["CAR_SPEED"]["IMPERIAL_UNIT"] + else: + self.is_metric = False if self.CP.carFingerprint in HONDA_BOSCH: ret.stockAeb = (not self.CP.openpilotLongitudinalControl) and bool(cp.vl["ACC_CONTROL"]["AEB_STATUS"] and cp.vl["ACC_CONTROL"]["ACCEL_COMMAND"] < -1e-5)