diff --git a/openpilot/common/libparams_c.so b/openpilot/common/libparams_c.so index 868b3630b..6624bc339 100755 Binary files a/openpilot/common/libparams_c.so and b/openpilot/common/libparams_c.so differ diff --git a/openpilot/common/params_keys.h b/openpilot/common/params_keys.h index 33ea83cab..3114c1b5b 100644 --- a/openpilot/common/params_keys.h +++ b/openpilot/common/params_keys.h @@ -9,6 +9,7 @@ inline static std::unordered_map keys = { {"AccessToken", {CLEAR_ON_MANAGER_START | DONT_LOG, STRING}}, {"AdbEnabled", {PERSISTENT | BACKUP, BOOL}}, {"AlwaysOnDM", {PERSISTENT | BACKUP, BOOL}}, + {"BeepEnabled", {PERSISTENT | BACKUP, BOOL, "1"}}, {"ApiCache_Device", {PERSISTENT, STRING}}, {"ApiCache_FirehoseStats", {PERSISTENT, JSON}}, {"AssistNowToken", {PERSISTENT, STRING}}, diff --git a/openpilot/selfdrive/selfdrived/beep.py b/openpilot/selfdrive/selfdrived/beep.py index e92f195cc..e8d4c466d 100644 --- a/openpilot/selfdrive/selfdrived/beep.py +++ b/openpilot/selfdrive/selfdrived/beep.py @@ -5,6 +5,7 @@ import threading import openpilot.cereal.messaging as messaging from opendbc.car.structs import car +from openpilot.common.params import Params from openpilot.common.realtime import Ratekeeper AudibleAlert = car.CarControl.HUDControl.AudibleAlert @@ -12,6 +13,7 @@ AudibleAlert = car.CarControl.HUDControl.AudibleAlert class Beepd: def __init__(self): self.current_alert = AudibleAlert.none + self.params = Params() self.enable_gpio() #self.startup_beep() @@ -32,6 +34,8 @@ class Beepd: encoding='utf8') def _beep(self, on): + if on and not self.params.get_bool("BeepEnabled"): + return val = "1" if on else "0" subprocess.run(f"echo \"{val}\" | sudo tee /sys/class/gpio/gpio42/value", shell=True, diff --git a/openpilot/selfdrive/ui/sunnypilot/layouts/settings/visuals.py b/openpilot/selfdrive/ui/sunnypilot/layouts/settings/visuals.py index 84be5a26a..e960b7745 100644 --- a/openpilot/selfdrive/ui/sunnypilot/layouts/settings/visuals.py +++ b/openpilot/selfdrive/ui/sunnypilot/layouts/settings/visuals.py @@ -28,6 +28,11 @@ class VisualsLayout(Widget): def _initialize_items(self): self._toggle_defs = { + "BeepEnabled": ( + lambda: tr("Alert Beeper"), + tr("Play engage, disengage, and warning beeps using the hardware beeper."), + None, + ), "BlindSpot": ( lambda: tr("Show Blind Spot Warnings"), tr("Enabling this will display warnings when a vehicle is detected in your " + diff --git a/openpilot/selfdrive/ui/translations/app.pot b/openpilot/selfdrive/ui/translations/app.pot index 8b415c384..2f8d94135 100644 --- a/openpilot/selfdrive/ui/translations/app.pot +++ b/openpilot/selfdrive/ui/translations/app.pot @@ -2804,3 +2804,10 @@ msgstr "" msgid "Reverse" msgstr "" +#: openpilot/selfdrive/ui/sunnypilot/layouts/settings/visuals.py +msgid "Alert Beeper" +msgstr "" + +#: openpilot/selfdrive/ui/sunnypilot/layouts/settings/visuals.py +msgid "Play engage, disengage, and warning beeps using the hardware beeper." +msgstr "" diff --git a/openpilot/selfdrive/ui/translations/app_zh-CHS.po b/openpilot/selfdrive/ui/translations/app_zh-CHS.po index 23bd59e40..0c47aa204 100644 --- a/openpilot/selfdrive/ui/translations/app_zh-CHS.po +++ b/openpilot/selfdrive/ui/translations/app_zh-CHS.po @@ -2891,3 +2891,10 @@ msgstr "准备中" msgid "unavailable" msgstr "不可用" +#: openpilot/selfdrive/ui/sunnypilot/layouts/settings/visuals.py +msgid "Alert Beeper" +msgstr "提示音" + +#: openpilot/selfdrive/ui/sunnypilot/layouts/settings/visuals.py +msgid "Play engage, disengage, and warning beeps using the hardware beeper." +msgstr "使用硬件蜂鸣器播放接管、退出和警告提示音。"