wip
This commit is contained in:
@@ -15,6 +15,7 @@ from openpilot.selfdrive.frogpilot.functions.speed_limit_controller import Speed
|
|||||||
# Class for intercepting when buttons are pressed, or dispatching buttons to be pressed
|
# Class for intercepting when buttons are pressed, or dispatching buttons to be pressed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class OscarPilotButtons:
|
class OscarPilotButtons:
|
||||||
def __init__(self, params, params_memory):
|
def __init__(self, params, params_memory):
|
||||||
self.params_memory = params_memory
|
self.params_memory = params_memory
|
||||||
|
|||||||
@@ -0,0 +1,177 @@
|
|||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
#include "selfdrive/frogpilot/ui/frogpilot_functions.h"
|
||||||
|
#include "selfdrive/ui/ui.h"
|
||||||
|
|
||||||
|
bool FrogPilotConfirmationDialog::toggle(const QString &prompt_text, const QString &confirm_text, QWidget *parent) {
|
||||||
|
ConfirmationDialog d = ConfirmationDialog(prompt_text, confirm_text, tr("Reboot Later"), false, parent);
|
||||||
|
return d.exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FrogPilotConfirmationDialog::toggleAlert(const QString &prompt_text, const QString &button_text, QWidget *parent) {
|
||||||
|
ConfirmationDialog d = ConfirmationDialog(prompt_text, button_text, "", false, parent);
|
||||||
|
return d.exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FrogPilotConfirmationDialog::yesorno(const QString &prompt_text, QWidget *parent) {
|
||||||
|
ConfirmationDialog d = ConfirmationDialog(prompt_text, tr("Yes"), tr("No"), false, parent);
|
||||||
|
return d.exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
FrogPilotButtonIconControl::FrogPilotButtonIconControl(const QString &title, const QString &text, const QString &desc, const QString &icon, QWidget *parent) : AbstractControl(title, desc, icon, parent) {
|
||||||
|
btn.setText(text);
|
||||||
|
btn.setStyleSheet(R"(
|
||||||
|
QPushButton {
|
||||||
|
padding: 0;
|
||||||
|
border-radius: 50px;
|
||||||
|
font-size: 35px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #E4E4E4;
|
||||||
|
background-color: #393939;
|
||||||
|
}
|
||||||
|
QPushButton:pressed {
|
||||||
|
background-color: #4a4a4a;
|
||||||
|
}
|
||||||
|
QPushButton:disabled {
|
||||||
|
color: #33E4E4E4;
|
||||||
|
}
|
||||||
|
)");
|
||||||
|
btn.setFixedSize(250, 100);
|
||||||
|
QObject::connect(&btn, &QPushButton::clicked, this, &FrogPilotButtonIconControl::clicked);
|
||||||
|
hlayout->addWidget(&btn);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDefaultParams() {
|
||||||
|
Params params = Params();
|
||||||
|
bool FrogsGoMoo = params.get("DongleId").substr(0, 3) == "be6";
|
||||||
|
|
||||||
|
bool brianbot = params.get("DongleId").substr(0, 6) == "90bb71";
|
||||||
|
|
||||||
|
std::map<std::string, std::string> defaultValues {
|
||||||
|
{"AccelerationPath", brianbot ? "1" : "0"},
|
||||||
|
{"AccelerationProfile", brianbot ? "2" : "2"},
|
||||||
|
{"AdjacentPath", FrogsGoMoo ? "1" : "0"},
|
||||||
|
{"AdjustablePersonalities", "0"},
|
||||||
|
{"AggressiveAcceleration", "1"},
|
||||||
|
{"AggressiveFollow", FrogsGoMoo ? "10" : "12"},
|
||||||
|
{"AggressiveJerk", FrogsGoMoo ? "6" : "5"},
|
||||||
|
{"AlwaysOnLateral", "1"},
|
||||||
|
{"AlwaysOnLateralMain", brianbot ? "1" : "0"},
|
||||||
|
{"AverageCurvature", brianbot ? "1" : "0"},
|
||||||
|
{"BlindSpotPath", "1"},
|
||||||
|
{"CameraView", FrogsGoMoo ? "1" : "0"},
|
||||||
|
{"CECurves", "1"},
|
||||||
|
{"CECurvesLead", "0"},
|
||||||
|
{"CENavigation", "1"},
|
||||||
|
{"CESignal", "1"},
|
||||||
|
{"CESlowerLead", "0"},
|
||||||
|
{"CESpeed", "0"},
|
||||||
|
{"CESpeedLead", "0"},
|
||||||
|
{"CEStopLights", "0"},
|
||||||
|
{"CEStopLightsLead", FrogsGoMoo ? "0" : "0"},
|
||||||
|
{"Compass", FrogsGoMoo ? "1" : "0"},
|
||||||
|
{"ConditionalExperimental", "1"},
|
||||||
|
{"CurveSensitivity", FrogsGoMoo ? "125" : "100"},
|
||||||
|
{"CustomColors", "1"},
|
||||||
|
{"CustomIcons", "1"},
|
||||||
|
{"CustomPersonalities", "0"},
|
||||||
|
{"CustomSignals", "0"},
|
||||||
|
{"CustomSounds", "1"},
|
||||||
|
{"CustomTheme", "1"},
|
||||||
|
{"CustomUI", "0"},
|
||||||
|
{"DeviceShutdown", "1"},
|
||||||
|
{"DisableOnroadUploads", "1"},
|
||||||
|
{"DriverCamera", "0"},
|
||||||
|
{"DriveStats", "1"},
|
||||||
|
{"EVTable", FrogsGoMoo ? "0" : "1"},
|
||||||
|
{"ExperimentalModeActivation", "1"},
|
||||||
|
{"ExperimentalModeViaLKAS", "0"},
|
||||||
|
{"ExperimentalModeViaScreen", FrogsGoMoo ? "0" : "1"},
|
||||||
|
{"Fahrenheit", "0"},
|
||||||
|
{"FireTheBabysitter", FrogsGoMoo ? "1" : "0"},
|
||||||
|
{"FullMap", "0"},
|
||||||
|
{"GasRegenCmd", "0"},
|
||||||
|
{"GoatScream", "0"},
|
||||||
|
{"GreenLightAlert", "0"},
|
||||||
|
{"HideSpeed", "0"},
|
||||||
|
{"HigherBitrate", "0"},
|
||||||
|
{"LaneChangeTime", "0"},
|
||||||
|
{"LaneDetection", "1"},
|
||||||
|
{"LaneLinesWidth", "4"},
|
||||||
|
{"LateralTune", "1"},
|
||||||
|
{"LeadInfo", FrogsGoMoo ? "1" : "0"},
|
||||||
|
{"LockDoors", "0"},
|
||||||
|
{"LongitudinalTune", "1"},
|
||||||
|
{"LongPitch", FrogsGoMoo ? "0" : "1"},
|
||||||
|
{"LowerVolt", FrogsGoMoo ? "0" : "1"},
|
||||||
|
{"Model", "3"},
|
||||||
|
{"ModelUI", "1"},
|
||||||
|
{"MTSCEnabled", "1"},
|
||||||
|
{"MuteDM", FrogsGoMoo ? "1" : "1"},
|
||||||
|
{"MuteDoor", FrogsGoMoo ? "1" : "1"},
|
||||||
|
{"MuteOverheated", FrogsGoMoo ? "1" : "0"},
|
||||||
|
{"MuteSeatbelt", FrogsGoMoo ? "1" : "0"},
|
||||||
|
{"NNFF", FrogsGoMoo ? "1" : "1"},
|
||||||
|
{"NoLogging", "1"},
|
||||||
|
{"NudgelessLaneChange", "0"},
|
||||||
|
{"NumericalTemp", FrogsGoMoo ? "1" : "0"},
|
||||||
|
{"Offset1", "3"},
|
||||||
|
{"Offset2", FrogsGoMoo ? "7" : "5"},
|
||||||
|
{"Offset3", "7"},
|
||||||
|
{"Offset4", FrogsGoMoo ? "20" : "7"},
|
||||||
|
{"OneLaneChange", "1"},
|
||||||
|
{"PathEdgeWidth", "20"},
|
||||||
|
{"PathWidth", "61"},
|
||||||
|
{"PauseLateralOnSignal", "20"},
|
||||||
|
{"PreferredSchedule", "0"},
|
||||||
|
{"QOLControls", "1"},
|
||||||
|
{"QOLVisuals", "1"},
|
||||||
|
{"RandomEvents", FrogsGoMoo ? "1" : "0"},
|
||||||
|
{"RelaxedFollow", "30"},
|
||||||
|
{"RelaxedJerk", "50"},
|
||||||
|
{"ReverseCruise", "0"},
|
||||||
|
{"RoadEdgesWidth", "2"},
|
||||||
|
{"RoadNameUI", "1"},
|
||||||
|
{"RotatingWheel", "1"},
|
||||||
|
{"ScreenBrightness", "101"},
|
||||||
|
{"SearchInput", "0"},
|
||||||
|
{"ShowCPU", FrogsGoMoo ? "1" : "0"},
|
||||||
|
{"ShowFPS", FrogsGoMoo ? "1" : "0"},
|
||||||
|
{"ShowGPU", "0"},
|
||||||
|
{"ShowMemoryUsage", FrogsGoMoo ? "1" : "0"},
|
||||||
|
{"Sidebar", FrogsGoMoo ? "1" : "0"},
|
||||||
|
{"SilentMode", "0"},
|
||||||
|
{"SLCFallback", "2"},
|
||||||
|
{"SLCOverride", FrogsGoMoo ? "2" : "1"},
|
||||||
|
{"SLCPriority", "1"},
|
||||||
|
{"SmoothBraking", "1"},
|
||||||
|
{"SNGHack", FrogsGoMoo ? "0" : "1"},
|
||||||
|
{"SpeedLimitController", "1"},
|
||||||
|
{"StandardFollow", "15"},
|
||||||
|
{"StandardJerk", "10"},
|
||||||
|
{"StoppingDistance", FrogsGoMoo ? "6" : "0"},
|
||||||
|
{"TSS2Tune", "1"},
|
||||||
|
{"TurnAggressiveness", FrogsGoMoo ? "150" : "100"}, // Test 90?
|
||||||
|
{"TurnDesires", "0"},
|
||||||
|
{"UnlimitedLength", "1"},
|
||||||
|
{"UseSI", FrogsGoMoo ? "1" : "0"},
|
||||||
|
{"UseVienna", "0"},
|
||||||
|
{"VisionTurnControl", "1"},
|
||||||
|
{"WheelIcon", FrogsGoMoo ? "1" : "0"}
|
||||||
|
};
|
||||||
|
|
||||||
|
bool rebootRequired = false;
|
||||||
|
for (const auto &[key, value] : defaultValues) {
|
||||||
|
if (params.get(key).empty()) {
|
||||||
|
params.put(key, value);
|
||||||
|
rebootRequired = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rebootRequired) {
|
||||||
|
while (!std::filesystem::exists("/data/openpilot/prebuilt")) {
|
||||||
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
|
}
|
||||||
|
Hardware::reboot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent) {
|
|||||||
QObject::connect(homeWindow, &HomeWindow::openSettings, this, &MainWindow::openSettings);
|
QObject::connect(homeWindow, &HomeWindow::openSettings, this, &MainWindow::openSettings);
|
||||||
QObject::connect(homeWindow, &HomeWindow::closeSettings, this, &MainWindow::closeSettings);
|
QObject::connect(homeWindow, &HomeWindow::closeSettings, this, &MainWindow::closeSettings);
|
||||||
|
|
||||||
settingsWindow = new SettingsWindow(this);
|
OscarSettingsWindow = new OscarSettingsWindow(this);
|
||||||
main_layout->addWidget(settingsWindow);
|
main_layout->addWidget(OscarSettingsWindow);
|
||||||
QObject::connect(settingsWindow, &SettingsWindow::closeSettings, this, &MainWindow::closeSettings);
|
QObject::connect(OscarSettingsWindow, &OscarSettingsWindow::closeSettings, this, &MainWindow::closeSettings);
|
||||||
QObject::connect(settingsWindow, &SettingsWindow::reviewTrainingGuide, [=]() {
|
QObject::connect(OscarSettingsWindow, &OscarSettingsWindow::reviewTrainingGuide, [=]() {
|
||||||
onboardingWindow->showTrainingGuide();
|
onboardingWindow->showTrainingGuide();
|
||||||
main_layout->setCurrentWidget(onboardingWindow);
|
main_layout->setCurrentWidget(onboardingWindow);
|
||||||
});
|
});
|
||||||
QObject::connect(settingsWindow, &SettingsWindow::showDriverView, [=] {
|
QObject::connect(OscarSettingsWindow, &OscarSettingsWindow::showDriverView, [=] {
|
||||||
homeWindow->showDriverView(true);
|
homeWindow->showDriverView(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
// QObject::connect(device(), &Device::interactiveTimeout, [=]() {
|
// QObject::connect(device(), &Device::interactiveTimeout, [=]() {
|
||||||
// if (main_layout->currentWidget() == settingsWindow) {
|
// if (main_layout->currentWidget() == OscarSettingsWindow) {
|
||||||
// closeSettings();
|
// closeSettings();
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
@@ -66,8 +66,8 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::openSettings(int index, const QString ¶m) {
|
void MainWindow::openSettings(int index, const QString ¶m) {
|
||||||
main_layout->setCurrentWidget(settingsWindow);
|
main_layout->setCurrentWidget(OscarSettingsWindow);
|
||||||
settingsWindow->setCurrentPanel(index, param);
|
OscarSettingsWindow->setCurrentPanel(index, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::closeSettings() {
|
void MainWindow::closeSettings() {
|
||||||
@@ -93,7 +93,7 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event) {
|
|||||||
case QEvent::MouseMove: {
|
case QEvent::MouseMove: {
|
||||||
// ignore events when device is awakened by resetInteractiveTimeout
|
// ignore events when device is awakened by resetInteractiveTimeout
|
||||||
ignore = !device()->isAwake();
|
ignore = !device()->isAwake();
|
||||||
// if (main_layout->currentWidget() == settingsWindow) {
|
// if (main_layout->currentWidget() == OscarSettingsWindow) {
|
||||||
// Not working...
|
// Not working...
|
||||||
// device()->resetInteractiveTimeout(60 * 5); // 5 minute timeout if looking at settings window
|
// device()->resetInteractiveTimeout(60 * 5); // 5 minute timeout if looking at settings window
|
||||||
// } else {
|
// } else {
|
||||||
|
|||||||
Reference in New Issue
Block a user