mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-04 07:03:44 +08:00
01c5dbdc4c
* more * event and checks * comments * missed events * retry 2 times is enough * rename to radar tracks * fix data type * more rename * bump opendbc * drain first * put it behind a toggle lol * re-enable * update comments * revert lead smoothing * Revert "revert lead smoothing" This reverts commit 872267970c3dd1dbfd64a5bdd21d2e1b9ea600bf. * real events and radard engagement * only show up for hyundai with mando * update translations * bump opendbc * fix event name * update description * move above * translations --------- Co-authored-by: rav4kumar <meetkumardesai@gmail.com>
83 lines
3.2 KiB
C++
83 lines
3.2 KiB
C++
#include <QDebug>
|
|
|
|
#include "selfdrive/ui/qt/offroad/developer_panel.h"
|
|
#include "selfdrive/ui/qt/widgets/ssh_keys.h"
|
|
#include "common/util.h"
|
|
|
|
#ifdef SUNNYPILOT
|
|
#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h"
|
|
#else
|
|
#include "selfdrive/ui/qt/widgets/controls.h"
|
|
#endif
|
|
|
|
DeveloperPanel::DeveloperPanel(SettingsWindow *parent) : ListWidget(parent) {
|
|
// SSH keys
|
|
addItem(new SshToggle());
|
|
addItem(new SshControl());
|
|
|
|
joystickToggle = new ParamControl("JoystickDebugMode", tr("Joystick Debug Mode"), "", "");
|
|
QObject::connect(joystickToggle, &ParamControl::toggleFlipped, [=](bool state) {
|
|
params.putBool("LongitudinalManeuverMode", false);
|
|
longManeuverToggle->refresh();
|
|
});
|
|
addItem(joystickToggle);
|
|
|
|
longManeuverToggle = new ParamControl("LongitudinalManeuverMode", tr("Longitudinal Maneuver Mode"), "", "");
|
|
QObject::connect(longManeuverToggle, &ParamControl::toggleFlipped, [=](bool state) {
|
|
params.putBool("JoystickDebugMode", false);
|
|
joystickToggle->refresh();
|
|
});
|
|
addItem(longManeuverToggle);
|
|
|
|
// TODO-SP: Move to Vehicles panel when ported back
|
|
hyundaiRadarTracksToggle = new ParamControl(
|
|
"HyundaiRadarTracksToggle",
|
|
tr("Hyundai: Enable Radar Tracks"),
|
|
tr("Enable this to attempt to enable radar tracks for Hyundai, Kia, and Genesis models equipped with the supported Mando SCC radar. "
|
|
"This allows sunnypilot to use radar data for improved lead tracking and overall longitudinal performance."), "");
|
|
hyundaiRadarTracksToggle->setConfirmation(true, false);
|
|
QObject::connect(hyundaiRadarTracksToggle, &ParamControl::toggleFlipped, [=](bool state) {
|
|
updateToggles(offroad);
|
|
});
|
|
addItem(hyundaiRadarTracksToggle);
|
|
|
|
auto enableGithubRunner = new ParamControl("EnableGithubRunner", tr("Enable GitHub runner service"), tr("Enables or disables the github runner service."), "");
|
|
addItem(enableGithubRunner);
|
|
|
|
// Joystick and longitudinal maneuvers should be hidden on release branches
|
|
is_release = params.getBool("IsReleaseBranch");
|
|
|
|
// Toggles should be not available to change in onroad state
|
|
QObject::connect(uiState(), &UIState::offroadTransition, this, &DeveloperPanel::updateToggles);
|
|
}
|
|
|
|
void DeveloperPanel::updateToggles(bool _offroad) {
|
|
for (auto btn : findChildren<ParamControl *>()) {
|
|
btn->setVisible(!is_release);
|
|
btn->setEnabled(_offroad);
|
|
}
|
|
|
|
// longManeuverToggle should not be toggleable if the car don't have longitudinal control
|
|
auto cp_bytes = params.get("CarParamsPersistent");
|
|
if (!cp_bytes.empty()) {
|
|
AlignedBuffer aligned_buf;
|
|
capnp::FlatArrayMessageReader cmsg(aligned_buf.align(cp_bytes.data(), cp_bytes.size()));
|
|
cereal::CarParams::Reader CP = cmsg.getRoot<cereal::CarParams>();
|
|
|
|
auto hyundai = CP.getCarName() == "hyundai";
|
|
auto hyundai_mando_radar = hyundai && (CP.getFlags() & 4096);
|
|
|
|
longManeuverToggle->setEnabled(hasLongitudinalControl(CP) && _offroad);
|
|
hyundaiRadarTracksToggle->setVisible(hyundai_mando_radar && hasLongitudinalControl(CP));
|
|
} else {
|
|
longManeuverToggle->setEnabled(false);
|
|
hyundaiRadarTracksToggle->setVisible(false);
|
|
}
|
|
|
|
offroad = _offroad;
|
|
}
|
|
|
|
void DeveloperPanel::showEvent(QShowEvent *event) {
|
|
updateToggles(offroad);
|
|
}
|