mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-08 11:25:51 +08:00
Compare commits
32 Commits
67e5bd3c1e
...
hyundai-ra
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
743aa8e736 | ||
|
|
5847256371 | ||
|
|
c13f909390 | ||
|
|
f1de835d17 | ||
|
|
76ddb20cd5 | ||
|
|
ede7f70ddc | ||
|
|
46c3047fa7 | ||
|
|
cf5b5c666d | ||
|
|
03b56d6f09 | ||
|
|
ab180ce1e5 | ||
|
|
e0d8bc88b2 | ||
|
|
1dc45adb1c | ||
|
|
c3bd613885 | ||
|
|
55edb4efcb | ||
|
|
7ff9b28c94 | ||
|
|
5f9d340d7b | ||
|
|
e82b47cb70 | ||
|
|
10b5e58558 | ||
|
|
116936341f | ||
|
|
8d5bd92d51 | ||
|
|
4453dba6ed | ||
|
|
cc20313815 | ||
|
|
3b30b93bbb | ||
|
|
5d9de36d40 | ||
|
|
a91b97b89a | ||
|
|
ec4e2ec3c1 | ||
|
|
1f49367380 | ||
|
|
040f81fc91 | ||
|
|
5253b33b7a | ||
|
|
fc46a0ed7f | ||
|
|
8056a797c7 | ||
|
|
a492625927 |
@@ -205,6 +205,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
|
||||
|
||||
// sunnypilot car specific params
|
||||
{"HyundaiLongitudinalTuning", {PERSISTENT | BACKUP, INT, "0"}},
|
||||
{"HyundaiRadar", {PERSISTENT | BACKUP, INT, "0"}},
|
||||
|
||||
{"DynamicExperimentalControl", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"BlindSpot", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
|
||||
Submodule opendbc_repo updated: b592ecdd3b...4b1731609f
@@ -20,6 +20,19 @@ HyundaiSettings::HyundaiSettings(QWidget *parent) : BrandSettingsInterface(paren
|
||||
QObject::connect(longitudinalTuningToggle, &ButtonParamControlSP::buttonClicked, this, &HyundaiSettings::updateSettings);
|
||||
list->addItem(longitudinalTuningToggle);
|
||||
longitudinalTuningToggle->showDescription();
|
||||
|
||||
std::vector<QString> radar_tuning_texts{ tr("Off"), tr("Lead Only"), tr("Full Radar") };
|
||||
radarToggle = new ButtonParamControl(
|
||||
"HyundaiRadar",
|
||||
tr("Radar Tracks"),
|
||||
"",
|
||||
"",
|
||||
radar_tuning_texts,
|
||||
500
|
||||
);
|
||||
QObject::connect(radarToggle, &ButtonParamControlSP::buttonClicked, this, &HyundaiSettings::updateSettings);
|
||||
list->addItem(radarToggle);
|
||||
radarToggle->showDescription();
|
||||
}
|
||||
|
||||
void HyundaiSettings::updateSettings() {
|
||||
@@ -54,4 +67,25 @@ void HyundaiSettings::updateSettings() {
|
||||
longitudinalTuningToggle->setEnabled(!longitudinal_tuning_disabled);
|
||||
longitudinalTuningToggle->setDescription(longitudinal_tuning_description);
|
||||
longitudinalTuningToggle->showDescription();
|
||||
|
||||
auto radar_param = std::atoi(params.get("HyundaiRadar").c_str());
|
||||
|
||||
RadarOption radar_option;
|
||||
if (radar_param == int(RadarOption::LEAD_ONLY)) {
|
||||
radar_option = RadarOption::LEAD_ONLY;
|
||||
} else if (radar_param == int(RadarOption::FULL_RADAR)) {
|
||||
radar_option = RadarOption::FULL_RADAR;
|
||||
} else {
|
||||
radar_option = RadarOption::OFF;
|
||||
}
|
||||
|
||||
bool radar_disabled = !offroad || !has_longitudinal_control;
|
||||
QString radar_description = radarDescription(radar_option);
|
||||
if (radar_disabled) {
|
||||
radar_description = toggleDisableMsg(offroad, has_longitudinal_control);
|
||||
}
|
||||
|
||||
radarToggle->setEnabled(!radar_disabled);
|
||||
radarToggle->setDescription(radar_description);
|
||||
radarToggle->showDescription();
|
||||
}
|
||||
|
||||
@@ -20,6 +20,12 @@ enum class LongitudinalTuningOption {
|
||||
PREDICTIVE,
|
||||
};
|
||||
|
||||
enum class RadarOption {
|
||||
OFF,
|
||||
LEAD_ONLY,
|
||||
FULL_RADAR,
|
||||
};
|
||||
|
||||
class HyundaiSettings : public BrandSettingsInterface {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -30,6 +36,7 @@ public:
|
||||
private:
|
||||
bool has_longitudinal_control = false;
|
||||
ButtonParamControl *longitudinalTuningToggle = nullptr;
|
||||
ButtonParamControl *radarToggle = nullptr;
|
||||
|
||||
static QString toggleDisableMsg(bool _offroad, bool _has_longitudinal_control) {
|
||||
if (!_has_longitudinal_control) {
|
||||
@@ -62,4 +69,24 @@ private:
|
||||
.arg(dynamic_str)
|
||||
.arg(predictive_str);
|
||||
}
|
||||
|
||||
static QString radarDescription(RadarOption option = RadarOption::OFF) {
|
||||
QString off_str = tr("Off: Disables radar tracking. Vision-only vehicle detection.");
|
||||
QString lead_only_str = tr("Lead Only: Tracks only the closest vehicle ahead.");
|
||||
QString full_radar_str = tr("Full Radar: Tracks all nearby vehicles using radar.");
|
||||
|
||||
if (option == RadarOption::LEAD_ONLY) {
|
||||
lead_only_str = "<font color='white'><b>" + lead_only_str + "</b></font>";
|
||||
} else if (option == RadarOption::FULL_RADAR) {
|
||||
full_radar_str = "<font color='white'><b>" + full_radar_str + "</b></font>";
|
||||
} else {
|
||||
off_str = "<font color='white'><b>" + off_str + "</b></font>";
|
||||
}
|
||||
|
||||
return QString("%1<br><br>%2<br>%3<br>%4<br>")
|
||||
.arg(tr("Configure how radar tracks surrounding vehicles — turn it off, track only the lead, or track all."))
|
||||
.arg(off_str)
|
||||
.arg(lead_only_str)
|
||||
.arg(full_radar_str);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -81,7 +81,8 @@ def initialize_params(params) -> list[dict[str, Any]]:
|
||||
|
||||
# hyundai
|
||||
keys.extend([
|
||||
"HyundaiLongitudinalTuning"
|
||||
"HyundaiLongitudinalTuning",
|
||||
"HyundaiRadar"
|
||||
])
|
||||
|
||||
return [{k: params.get(k, return_default=True)} for k in keys]
|
||||
|
||||
Reference in New Issue
Block a user