From 6f3e44f76e05418ece5c1e4019571e62579ac403 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 11 Aug 2024 19:21:31 -0800 Subject: [PATCH 1/3] MADS: Hyundai: Skip cruise main button check with `pcmCruise` (#405) * MADS: Hyundai: Skip cruise main button check with `pcmCruise` * 2 modes! --- selfdrive/car/hyundai/interface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index c2140d2925..7db3dd9e41 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -221,8 +221,8 @@ class CarInterface(CarInterfaceBase): self.CS.accEnabled = True if self.enable_mads: - if not self.CS.prev_mads_enabled and self.CS.mads_enabled and \ - any(b.type == ButtonType.altButton3 for b in self.CS.button_events): + if not self.CS.prev_mads_enabled and self.CS.mads_enabled and (self.CP.pcmCruise or + (any(b.type == ButtonType.altButton3 for b in self.CS.button_events) and not self.CP.pcmCruise)): self.CS.madsEnabled = True if any(b.type == ButtonType.altButton1 and b.pressed for b in self.CS.button_events): self.CS.madsEnabled = not self.CS.madsEnabled From 117ad3b3ef3af42cba37b6a55b5dbf612973d42f Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 11 Aug 2024 19:29:42 -0800 Subject: [PATCH 2/3] Hyundai Longitudinal: Match stock timestep for ESCC and Camera-based SCC (#407) Hyundai ESCC: Match stock timestep --- selfdrive/car/hyundai/interface.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index 7db3dd9e41..59264da6d0 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -109,6 +109,7 @@ class CarInterface(CarInterfaceBase): if DBC[ret.carFingerprint]["radar"] is None: if ret.spFlags & (HyundaiFlagsSP.SP_ENHANCED_SCC | HyundaiFlagsSP.SP_CAMERA_SCC_LEAD): + ret.radarTimeStep = 0.02 ret.radarUnavailable = False # *** feature detection *** From 69f88da9c50b6c21502ff6800f0851fde6a89ff3 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 11 Aug 2024 19:32:43 -0800 Subject: [PATCH 3/3] Hyundai Longitudinal: Enable Cruise Main when started (#391) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Hyundai Longitudinal: Enable Cruise Main when started * don't do this for the ancients (@devtekve 😉) * okay, toggle per @devtekve xD * update texts * non pcm only * translations --- CHANGELOGS.md | 3 +++ common/params.cc | 1 + selfdrive/car/hyundai/interface.py | 5 +++++ selfdrive/car/param_manager.py | 2 ++ .../qt/offroad/settings/vehicle_settings.cc | 22 +++++++++++++++++++ .../qt/offroad/settings/vehicle_settings.h | 1 + selfdrive/ui/translations/main_ar.ts | 12 ++++++++++ selfdrive/ui/translations/main_de.ts | 12 ++++++++++ selfdrive/ui/translations/main_es.ts | 12 ++++++++++ selfdrive/ui/translations/main_fr.ts | 12 ++++++++++ selfdrive/ui/translations/main_ja.ts | 12 ++++++++++ selfdrive/ui/translations/main_ko.ts | 12 ++++++++++ selfdrive/ui/translations/main_pt-BR.ts | 12 ++++++++++ selfdrive/ui/translations/main_th.ts | 12 ++++++++++ selfdrive/ui/translations/main_tr.ts | 12 ++++++++++ selfdrive/ui/translations/main_zh-CHS.ts | 12 ++++++++++ selfdrive/ui/translations/main_zh-CHT.ts | 12 ++++++++++ system/manager/manager.py | 1 + 18 files changed, 167 insertions(+) diff --git a/CHANGELOGS.md b/CHANGELOGS.md index 650d149843..208512b3dd 100644 --- a/CHANGELOGS.md +++ b/CHANGELOGS.md @@ -14,6 +14,9 @@ sunnypilot - 0.9.8.0 (2024-xx-xx) * Provides a more responsive and tailored driving experience compared to predefined settings * UPDATED: Driving Personality: Updated mode names * Aggressive, Moderate, Standard, Relaxed +* NEW❗: Hyundai CAN: Enable Cruise Main by Default + * Set CRUISE MAIN to ON by default when the car starts, without engaging MADS + * This feature only applies when "openpilot Longitudinal Control (Alpha)" is enabled under the "Toggles" menu * NEW❗: Toyota - Enhanced Blind Spot Monitor (BSM) thanks to arne182, rav4kumar, and eFiniLan! * Enables Blind Spot Monitor (BSM) signals parsing in sunnypilot using the factory Blind Spot Monitor (BSM) * sunnypilot will use debugging CAN messages to receive unfiltered BSM signals, allowing detection of more objects diff --git a/common/params.cc b/common/params.cc index c613cf0a36..5cb98babf4 100644 --- a/common/params.cc +++ b/common/params.cc @@ -261,6 +261,7 @@ std::unordered_map keys = { {"HandsOnWheelMonitoring", PERSISTENT | BACKUP}, {"HasAcceptedTermsSP", PERSISTENT}, {"HideVEgoUi", PERSISTENT | BACKUP}, + {"HyundaiCruiseMainDefault", PERSISTENT | BACKUP}, {"HkgSmoothStop", PERSISTENT | BACKUP}, {"HotspotOnBoot", PERSISTENT}, {"HotspotOnBootConfirmed", PERSISTENT}, diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index 59264da6d0..a12bd0ed87 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -203,6 +203,11 @@ class CarInterface(CarInterfaceBase): enable_radar_tracks(logcan, sendcan, bus=0, addr=0x7d0, config_data_id=b'\x01\x42') def _update(self, c): + if not self.CS.control_initialized and not self.CP.pcmCruise: + can_cruise_main_default = self.CP.spFlags & HyundaiFlagsSP.SP_CAN_LFA_BTN and not self.CP.flags & HyundaiFlags.CANFD and \ + self.CS.params_list.hyundai_cruise_main_default + self.CS.mainEnabled = True if can_cruise_main_default or self.CP.carFingerprint in CANFD_CAR else False + ret = self.CS.update(self.cp, self.cp_cam) self.CS.button_events = [ diff --git a/selfdrive/car/param_manager.py b/selfdrive/car/param_manager.py index c7df87b9b7..6f393bd2d2 100644 --- a/selfdrive/car/param_manager.py +++ b/selfdrive/car/param_manager.py @@ -11,6 +11,7 @@ class ParamManager: "experimental_mode": False, "is_metric": False, "last_speed_limit_sign_tap": False, + "hyundai_cruise_main_default": False, "mads_main_toggle": False, "pause_lateral_speed": 0, "reverse_acc_change": False, @@ -37,6 +38,7 @@ class ParamManager: "experimental_mode": params.get_bool("ExperimentalMode"), "is_metric": params.get_bool("IsMetric"), "last_speed_limit_sign_tap": params.get_bool("LastSpeedLimitSignTap"), + "hyundai_cruise_main_default": params.get_bool("HyundaiCruiseMainDefault"), "mads_main_toggle": params.get_bool("MadsCruiseMain"), "pause_lateral_speed": int(params.get("PauseLateralSpeed", encoding="utf8")), "reverse_acc_change": params.get_bool("ReverseAccChange"), diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_settings.cc index 10ff22c028..330458de1c 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_settings.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_settings.cc @@ -109,6 +109,16 @@ SPVehiclesTogglesPanel::SPVehiclesTogglesPanel(VehiclePanel *parent) : ListWidge hkgSmoothStop->setConfirmation(true, false); addItem(hkgSmoothStop); + hyundaiCruiseMainDefault = new ParamControlSP( + "HyundaiCruiseMainDefault", + tr("HKG CAN: Enable Cruise Main by Default"), + QString("%1

%2") + .arg(tr("WARNING: This feature only applies when \"openpilot Longitudinal Control (Alpha)\" is enabled under \"Toggles\"")) + .arg(tr("Enabling this toggle sets CRUISE MAIN to ON by default when the car starts, without engaging MADS. The user still needs to manually engage MADS.")), + "../assets/offroad/icon_blank.png"); + hyundaiCruiseMainDefault->setConfirmation(true, false); + addItem(hyundaiCruiseMainDefault); + // Subaru addItem(new LabelControlSP(tr("Subaru"))); auto subaruManualParkingBrakeSng = new ParamControlSP( @@ -194,6 +204,7 @@ SPVehiclesTogglesPanel::SPVehiclesTogglesPanel(VehiclePanel *parent) : ListWidge connect(uiStateSP(), &UIStateSP::offroadTransition, [=](bool offroad) { is_onroad = !offroad; hkgSmoothStop->setEnabled(offroad); + hyundaiCruiseMainDefault->setEnabled(offroad); toyotaTss2LongTune->setEnabled(offroad); toyotaEnhancedBsm->setEnabled(offroad); toyotaSngHack->setEnabled(offroad); @@ -223,6 +234,17 @@ void SPVehiclesTogglesPanel::updateToggles() { capnp::FlatArrayMessageReader cmsg(aligned_buf.align(cp_bytes.data(), cp_bytes.size())); cereal::CarParams::Reader CP = cmsg.getRoot(); + // Hyundai/Kia/Genesis + { + if (CP.getCarName() == "hyundai") { + if ((CP.getSpFlags() & 2) and !(CP.getFlags() & 8192)) { + hyundaiCruiseMainDefault->setEnabled(true); + } else { + hyundaiCruiseMainDefault->setEnabled(false); + } + } + } + // Toyota: Enhanced Blind Spot Monitor { if (CP.getCarName() == "toyota") { diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_settings.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_settings.h index ddf61f6e76..9d172be239 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_settings.h +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/vehicle_settings.h @@ -67,6 +67,7 @@ private: Params params; bool is_onroad = false; + ParamControlSP *hyundaiCruiseMainDefault; ParamControlSP *stockLongToyota; ParamControlSP *toyotaEnhancedBsm; diff --git a/selfdrive/ui/translations/main_ar.ts b/selfdrive/ui/translations/main_ar.ts index 7dae31a53e..e40771ae8c 100644 --- a/selfdrive/ui/translations/main_ar.ts +++ b/selfdrive/ui/translations/main_ar.ts @@ -1583,6 +1583,18 @@ Reboot Required. Tested on RAV4 TSS1, Lexus LSS1, Toyota TSS1/1.5, and Prius TSS2. + + HKG CAN: Enable Cruise Main by Default + + + + WARNING: This feature only applies when "openpilot Longitudinal Control (Alpha)" is enabled under "Toggles" + + + + Enabling this toggle sets CRUISE MAIN to ON by default when the car starts, without engaging MADS. The user still needs to manually engage MADS. + + SettingsWindow diff --git a/selfdrive/ui/translations/main_de.ts b/selfdrive/ui/translations/main_de.ts index 6b8fd1efc1..d48c0f5330 100644 --- a/selfdrive/ui/translations/main_de.ts +++ b/selfdrive/ui/translations/main_de.ts @@ -1565,6 +1565,18 @@ Reboot Required. Tested on RAV4 TSS1, Lexus LSS1, Toyota TSS1/1.5, and Prius TSS2. + + HKG CAN: Enable Cruise Main by Default + + + + WARNING: This feature only applies when "openpilot Longitudinal Control (Alpha)" is enabled under "Toggles" + + + + Enabling this toggle sets CRUISE MAIN to ON by default when the car starts, without engaging MADS. The user still needs to manually engage MADS. + + SettingsWindow diff --git a/selfdrive/ui/translations/main_es.ts b/selfdrive/ui/translations/main_es.ts index 4b0262e699..36d8fb8c83 100644 --- a/selfdrive/ui/translations/main_es.ts +++ b/selfdrive/ui/translations/main_es.ts @@ -1563,6 +1563,18 @@ Reboot Required. Tested on RAV4 TSS1, Lexus LSS1, Toyota TSS1/1.5, and Prius TSS2. + + HKG CAN: Enable Cruise Main by Default + + + + WARNING: This feature only applies when "openpilot Longitudinal Control (Alpha)" is enabled under "Toggles" + + + + Enabling this toggle sets CRUISE MAIN to ON by default when the car starts, without engaging MADS. The user still needs to manually engage MADS. + + SettingsWindow diff --git a/selfdrive/ui/translations/main_fr.ts b/selfdrive/ui/translations/main_fr.ts index 0071a33e47..f76b7cb63b 100644 --- a/selfdrive/ui/translations/main_fr.ts +++ b/selfdrive/ui/translations/main_fr.ts @@ -1567,6 +1567,18 @@ Reboot Required. Tested on RAV4 TSS1, Lexus LSS1, Toyota TSS1/1.5, and Prius TSS2. + + HKG CAN: Enable Cruise Main by Default + + + + WARNING: This feature only applies when "openpilot Longitudinal Control (Alpha)" is enabled under "Toggles" + + + + Enabling this toggle sets CRUISE MAIN to ON by default when the car starts, without engaging MADS. The user still needs to manually engage MADS. + + SettingsWindow diff --git a/selfdrive/ui/translations/main_ja.ts b/selfdrive/ui/translations/main_ja.ts index 5db645c9f4..d8124dc12b 100644 --- a/selfdrive/ui/translations/main_ja.ts +++ b/selfdrive/ui/translations/main_ja.ts @@ -1561,6 +1561,18 @@ Reboot Required. Tested on RAV4 TSS1, Lexus LSS1, Toyota TSS1/1.5, and Prius TSS2. + + HKG CAN: Enable Cruise Main by Default + + + + WARNING: This feature only applies when "openpilot Longitudinal Control (Alpha)" is enabled under "Toggles" + + + + Enabling this toggle sets CRUISE MAIN to ON by default when the car starts, without engaging MADS. The user still needs to manually engage MADS. + + SettingsWindow diff --git a/selfdrive/ui/translations/main_ko.ts b/selfdrive/ui/translations/main_ko.ts index 1a55d59a3b..adb6547643 100644 --- a/selfdrive/ui/translations/main_ko.ts +++ b/selfdrive/ui/translations/main_ko.ts @@ -1563,6 +1563,18 @@ Reboot Required. Tested on RAV4 TSS1, Lexus LSS1, Toyota TSS1/1.5, and Prius TSS2. + + HKG CAN: Enable Cruise Main by Default + + + + WARNING: This feature only applies when "openpilot Longitudinal Control (Alpha)" is enabled under "Toggles" + + + + Enabling this toggle sets CRUISE MAIN to ON by default when the car starts, without engaging MADS. The user still needs to manually engage MADS. + + SettingsWindow diff --git a/selfdrive/ui/translations/main_pt-BR.ts b/selfdrive/ui/translations/main_pt-BR.ts index 856ef26ca8..b2cbf296e6 100644 --- a/selfdrive/ui/translations/main_pt-BR.ts +++ b/selfdrive/ui/translations/main_pt-BR.ts @@ -1567,6 +1567,18 @@ Reboot Required. Tested on RAV4 TSS1, Lexus LSS1, Toyota TSS1/1.5, and Prius TSS2. + + HKG CAN: Enable Cruise Main by Default + + + + WARNING: This feature only applies when "openpilot Longitudinal Control (Alpha)" is enabled under "Toggles" + + + + Enabling this toggle sets CRUISE MAIN to ON by default when the car starts, without engaging MADS. The user still needs to manually engage MADS. + + SettingsWindow diff --git a/selfdrive/ui/translations/main_th.ts b/selfdrive/ui/translations/main_th.ts index 220b6575c4..26d8e95fa1 100644 --- a/selfdrive/ui/translations/main_th.ts +++ b/selfdrive/ui/translations/main_th.ts @@ -1563,6 +1563,18 @@ Reboot Required. Tested on RAV4 TSS1, Lexus LSS1, Toyota TSS1/1.5, and Prius TSS2. + + HKG CAN: Enable Cruise Main by Default + + + + WARNING: This feature only applies when "openpilot Longitudinal Control (Alpha)" is enabled under "Toggles" + + + + Enabling this toggle sets CRUISE MAIN to ON by default when the car starts, without engaging MADS. The user still needs to manually engage MADS. + + SettingsWindow diff --git a/selfdrive/ui/translations/main_tr.ts b/selfdrive/ui/translations/main_tr.ts index a8c3992fd2..f55bbd7781 100644 --- a/selfdrive/ui/translations/main_tr.ts +++ b/selfdrive/ui/translations/main_tr.ts @@ -1561,6 +1561,18 @@ Reboot Required. Tested on RAV4 TSS1, Lexus LSS1, Toyota TSS1/1.5, and Prius TSS2. + + HKG CAN: Enable Cruise Main by Default + + + + WARNING: This feature only applies when "openpilot Longitudinal Control (Alpha)" is enabled under "Toggles" + + + + Enabling this toggle sets CRUISE MAIN to ON by default when the car starts, without engaging MADS. The user still needs to manually engage MADS. + + SettingsWindow diff --git a/selfdrive/ui/translations/main_zh-CHS.ts b/selfdrive/ui/translations/main_zh-CHS.ts index fddf413a50..98801bffbd 100644 --- a/selfdrive/ui/translations/main_zh-CHS.ts +++ b/selfdrive/ui/translations/main_zh-CHS.ts @@ -1563,6 +1563,18 @@ Reboot Required. Tested on RAV4 TSS1, Lexus LSS1, Toyota TSS1/1.5, and Prius TSS2. + + HKG CAN: Enable Cruise Main by Default + + + + WARNING: This feature only applies when "openpilot Longitudinal Control (Alpha)" is enabled under "Toggles" + + + + Enabling this toggle sets CRUISE MAIN to ON by default when the car starts, without engaging MADS. The user still needs to manually engage MADS. + + SettingsWindow diff --git a/selfdrive/ui/translations/main_zh-CHT.ts b/selfdrive/ui/translations/main_zh-CHT.ts index 684447b113..5e6e3a7418 100644 --- a/selfdrive/ui/translations/main_zh-CHT.ts +++ b/selfdrive/ui/translations/main_zh-CHT.ts @@ -1563,6 +1563,18 @@ Reboot Required. Tested on RAV4 TSS1, Lexus LSS1, Toyota TSS1/1.5, and Prius TSS2. + + HKG CAN: Enable Cruise Main by Default + + + + WARNING: This feature only applies when "openpilot Longitudinal Control (Alpha)" is enabled under "Toggles" + + + + Enabling this toggle sets CRUISE MAIN to ON by default when the car starts, without engaging MADS. The user still needs to manually engage MADS. + + SettingsWindow diff --git a/system/manager/manager.py b/system/manager/manager.py index 8169617302..e4537cac78 100755 --- a/system/manager/manager.py +++ b/system/manager/manager.py @@ -71,6 +71,7 @@ def manager_init() -> None: ("FeatureStatus", "1"), ("HandsOnWheelMonitoring", "0"), ("HasAcceptedTermsSP", "0"), + ("HyundaiCruiseMainDefault", "0"), ("HideVEgoUi", "0"), ("LastSpeedLimitSignTap", "0"), ("LkasToggle", "0"),