mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-09-30 19:33:42 +08:00
Merge branch 'min-feat/dev/alert-mode' into full
This commit is contained in:
@@ -139,4 +139,5 @@ inline static std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"dp_lon_acm", PERSISTENT},
|
||||
{"dp_lon_acm_downhill", PERSISTENT},
|
||||
{"dp_lon_aem", PERSISTENT},
|
||||
{"dp_device_audible_alert_mode", PERSISTENT},
|
||||
};
|
||||
|
||||
@@ -282,6 +282,11 @@ void DPPanel::add_device_toggles() {
|
||||
"",
|
||||
}
|
||||
};
|
||||
std::vector<QString> audible_alert_mode_texts{tr("Std."), tr("Warning"), tr("Off")};
|
||||
ButtonParamControl* audible_alert_mode_setting = new ButtonParamControl("dp_device_audible_alert_mode", tr("Audible Alert Mode"),
|
||||
tr("Warning - Only emits sound when there is a warning.\nOff - Does not emit any sound at all."),
|
||||
"",
|
||||
audible_alert_mode_texts);
|
||||
|
||||
QWidget *label = nullptr;
|
||||
bool has_toggle = false;
|
||||
@@ -304,6 +309,10 @@ void DPPanel::add_device_toggles() {
|
||||
addItem(toggle);
|
||||
toggles[param.toStdString()] = toggle;
|
||||
}
|
||||
if (!getenv("DISABLE_DRIVER")) { // lite check
|
||||
addItem(audible_alert_mode_setting);
|
||||
has_toggle = true;
|
||||
}
|
||||
|
||||
// If no toggles were added, hide the label
|
||||
if (!has_toggle && label) {
|
||||
|
||||
@@ -10,6 +10,7 @@ from openpilot.common.filter_simple import FirstOrderFilter
|
||||
from openpilot.common.realtime import Ratekeeper
|
||||
from openpilot.common.retry import retry
|
||||
from openpilot.common.swaglog import cloudlog
|
||||
from openpilot.common.params import Params
|
||||
|
||||
from openpilot.system import micd
|
||||
|
||||
@@ -62,6 +63,11 @@ class Soundd:
|
||||
|
||||
self.spl_filter_weighted = FirstOrderFilter(0, 2.5, FILTER_DT, initialized=False)
|
||||
|
||||
try:
|
||||
self._dp_device_audible_alert_mode = int(Params().get("dp_device_audible_alert_mode"))
|
||||
except:
|
||||
self._dp_device_audible_alert_mode = 0
|
||||
|
||||
def load_sounds(self):
|
||||
self.loaded_sounds: dict[int, np.ndarray] = {}
|
||||
|
||||
@@ -96,6 +102,10 @@ class Soundd:
|
||||
written_frames += frames_to_write
|
||||
self.current_sound_frame += frames_to_write
|
||||
|
||||
# dp - set vol to 0 instead
|
||||
if self._dp_device_audible_alert_mode == 2 or (self._dp_device_audible_alert_mode == 1 and self.current_alert in [AudibleAlert.engage, AudibleAlert.disengage]):
|
||||
self.current_volume = 0
|
||||
|
||||
return ret * self.current_volume
|
||||
|
||||
def callback(self, data_out: np.ndarray, frames: int, time, status) -> None:
|
||||
|
||||
@@ -57,6 +57,7 @@ def manager_init() -> None:
|
||||
("dp_lon_acm", "0"),
|
||||
("dp_lon_acm_downhill", "0"),
|
||||
("dp_lon_aem", "0"),
|
||||
("dp_device_audible_alert_mode", "0"),
|
||||
]
|
||||
|
||||
if params.get_bool("RecordFrontLock"):
|
||||
|
||||
Reference in New Issue
Block a user