diff --git a/.github/workflows/ui_preview.yaml b/.github/workflows/ui_preview.yaml index a6daaad19f..3ed882ed05 100644 --- a/.github/workflows/ui_preview.yaml +++ b/.github/workflows/ui_preview.yaml @@ -84,7 +84,7 @@ jobs: run: >- sudo apt-get install -y imagemagick - scenes="homescreen settings_device settings_toggles offroad_alert update_available prime onroad onroad_disengaged onroad_override onroad_sidebar onroad_wide onroad_wide_sidebar onroad_alert_small onroad_alert_mid onroad_alert_full driver_camera body keyboard" + scenes="homescreen settings_device settings_toggles settings_developer offroad_alert update_available prime onroad onroad_disengaged onroad_override onroad_sidebar onroad_wide onroad_wide_sidebar onroad_alert_small onroad_alert_mid onroad_alert_full driver_camera body keyboard" A=($scenes) DIFF="" diff --git a/selfdrive/ui/SConscript b/selfdrive/ui/SConscript index 643951fff3..19dcc625e2 100644 --- a/selfdrive/ui/SConscript +++ b/selfdrive/ui/SConscript @@ -28,7 +28,7 @@ qt_libs = [widgets, qt_util] + base_libs qt_src = ["main.cc", "ui.cc", "qt/sidebar.cc", "qt/body.cc", "qt/window.cc", "qt/home.cc", "qt/offroad/settings.cc", - "qt/offroad/software_settings.cc", "qt/offroad/onboarding.cc", + "qt/offroad/software_settings.cc", "qt/offroad/developer_panel.cc", "qt/offroad/onboarding.cc", "qt/offroad/driverview.cc", "qt/offroad/experimental_mode.cc", "qt/onroad/onroad_home.cc", "qt/onroad/annotated_camera.cc", "qt/onroad/model.cc", "qt/onroad/buttons.cc", "qt/onroad/alerts.cc", "qt/onroad/driver_monitoring.cc", "qt/onroad/hud.cc"] diff --git a/selfdrive/ui/qt/network/networking.cc b/selfdrive/ui/qt/network/networking.cc index 22d9c01efe..066dc3ca7e 100644 --- a/selfdrive/ui/qt/network/networking.cc +++ b/selfdrive/ui/qt/network/networking.cc @@ -149,10 +149,6 @@ AdvancedNetworking::AdvancedNetworking(QWidget* parent, WifiManager* wifi): QWid ipLabel = new LabelControl(tr("IP Address"), wifi->ipv4_address); list->addItem(ipLabel); - // SSH keys - list->addItem(new SshToggle()); - list->addItem(new SshControl()); - // Roaming toggle const bool roamingEnabled = params.getBool("GsmRoaming"); roamingToggle = new ToggleControl(tr("Enable Roaming"), "", "", roamingEnabled); diff --git a/selfdrive/ui/qt/offroad/developer_panel.cc b/selfdrive/ui/qt/offroad/developer_panel.cc new file mode 100644 index 0000000000..bb11b35404 --- /dev/null +++ b/selfdrive/ui/qt/offroad/developer_panel.cc @@ -0,0 +1,36 @@ +#include + +#include "selfdrive/ui/qt/offroad/developer_panel.h" +#include "selfdrive/ui/qt/widgets/ssh_keys.h" +#include "selfdrive/ui/qt/widgets/controls.h" + +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); + + // Joystick and longitudinal maneuvers should be hidden on release branches + // also the toggles should be not available to change in onroad state + const bool is_release = params.getBool("IsReleaseBranch"); + QObject::connect(uiState(), &UIState::offroadTransition, [=](bool offroad) { + for (auto btn : findChildren()) { + btn->setVisible(!is_release); + btn->setEnabled(offroad); + } + }); + +} diff --git a/selfdrive/ui/qt/offroad/developer_panel.h b/selfdrive/ui/qt/offroad/developer_panel.h new file mode 100644 index 0000000000..9fcff1e97b --- /dev/null +++ b/selfdrive/ui/qt/offroad/developer_panel.h @@ -0,0 +1,14 @@ +#pragma once + +#include "selfdrive/ui/qt/offroad/settings.h" + +class DeveloperPanel : public ListWidget { + Q_OBJECT +public: + explicit DeveloperPanel(SettingsWindow *parent); + +private: + Params params; + ParamControl* joystickToggle; + ParamControl* longManeuverToggle; +}; diff --git a/selfdrive/ui/qt/offroad/settings.cc b/selfdrive/ui/qt/offroad/settings.cc index 29ff9807a1..d4aab53f5a 100644 --- a/selfdrive/ui/qt/offroad/settings.cc +++ b/selfdrive/ui/qt/offroad/settings.cc @@ -14,6 +14,7 @@ #include "selfdrive/ui/qt/qt_window.h" #include "selfdrive/ui/qt/widgets/prime.h" #include "selfdrive/ui/qt/widgets/scrollview.h" +#include "selfdrive/ui/qt/offroad/developer_panel.h" TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) { // param, title, desc, icon @@ -393,6 +394,7 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) { {tr("Network"), networking}, {tr("Toggles"), toggles}, {tr("Software"), new SoftwarePanel(this)}, + {tr("Developer"), new DeveloperPanel(this)}, }; nav_btns = new QButtonGroup(this); diff --git a/selfdrive/ui/tests/test_ui/run.py b/selfdrive/ui/tests/test_ui/run.py index 0b98cb0b38..e6fd9a016a 100644 --- a/selfdrive/ui/tests/test_ui/run.py +++ b/selfdrive/ui/tests/test_ui/run.py @@ -42,7 +42,12 @@ def setup_settings_device(click, pm: PubMaster): def setup_settings_toggles(click, pm: PubMaster): setup_settings_device(click, pm) - click(278, 760) + click(278, 650) + time.sleep(UI_DELAY) + +def setup_settings_developer(click, pm: PubMaster): + setup_settings_device(click, pm) + click(278, 960) time.sleep(UI_DELAY) def setup_onroad(click, pm: PubMaster): @@ -175,6 +180,7 @@ CASES = { "pair_device": setup_pair_device, "settings_device": setup_settings_device, "settings_toggles": setup_settings_toggles, + "settings_developer": setup_settings_developer, "onroad": setup_onroad, "onroad_disengaged": setup_onroad_disengaged, "onroad_override": setup_onroad_override, diff --git a/selfdrive/ui/translations/main_ar.ts b/selfdrive/ui/translations/main_ar.ts index 5f254e9cd4..2854aceeaa 100644 --- a/selfdrive/ui/translations/main_ar.ts +++ b/selfdrive/ui/translations/main_ar.ts @@ -113,6 +113,17 @@ رفض، إلغاء التثبيت %1 + + DeveloperPanel + + Joystick Debug Mode + + + + Longitudinal Maneuver Mode + + + DevicePanel @@ -618,6 +629,10 @@ This may take up to a minute. Software البرنامج + + Developer + + Setup diff --git a/selfdrive/ui/translations/main_de.ts b/selfdrive/ui/translations/main_de.ts index 4f5997228a..2abed6e305 100644 --- a/selfdrive/ui/translations/main_de.ts +++ b/selfdrive/ui/translations/main_de.ts @@ -113,6 +113,17 @@ Ablehnen, deinstallieren %1 + + DeveloperPanel + + Joystick Debug Mode + + + + Longitudinal Maneuver Mode + + + DevicePanel @@ -600,6 +611,10 @@ This may take up to a minute. Software Software + + Developer + + Setup diff --git a/selfdrive/ui/translations/main_es.ts b/selfdrive/ui/translations/main_es.ts index fa50f33f15..45309eb745 100644 --- a/selfdrive/ui/translations/main_es.ts +++ b/selfdrive/ui/translations/main_es.ts @@ -113,6 +113,17 @@ Rechazar, desinstalar %1 + + DeveloperPanel + + Joystick Debug Mode + + + + Longitudinal Maneuver Mode + + + DevicePanel @@ -602,6 +613,10 @@ Esto puede tardar un minuto. Software Software + + Developer + + Setup diff --git a/selfdrive/ui/translations/main_fr.ts b/selfdrive/ui/translations/main_fr.ts index 566ed32f11..f4251bc41d 100644 --- a/selfdrive/ui/translations/main_fr.ts +++ b/selfdrive/ui/translations/main_fr.ts @@ -113,6 +113,17 @@ Refuser, désinstaller %1 + + DeveloperPanel + + Joystick Debug Mode + + + + Longitudinal Maneuver Mode + + + DevicePanel @@ -602,6 +613,10 @@ Cela peut prendre jusqu'à une minute. Software Logiciel + + Developer + + Setup diff --git a/selfdrive/ui/translations/main_ja.ts b/selfdrive/ui/translations/main_ja.ts index 90c8aba00b..bc83d3f9ae 100644 --- a/selfdrive/ui/translations/main_ja.ts +++ b/selfdrive/ui/translations/main_ja.ts @@ -113,6 +113,17 @@ 拒否して %1 をアンインストール + + DeveloperPanel + + Joystick Debug Mode + + + + Longitudinal Maneuver Mode + + + DevicePanel @@ -596,6 +607,10 @@ This may take up to a minute. Software ソフトウェア + + Developer + + Setup diff --git a/selfdrive/ui/translations/main_ko.ts b/selfdrive/ui/translations/main_ko.ts index 6d01b1289f..0839ddf15e 100644 --- a/selfdrive/ui/translations/main_ko.ts +++ b/selfdrive/ui/translations/main_ko.ts @@ -113,6 +113,17 @@ 거절, %1 제거 + + DeveloperPanel + + Joystick Debug Mode + + + + Longitudinal Maneuver Mode + + + DevicePanel @@ -598,6 +609,10 @@ This may take up to a minute. Software 소프트웨어 + + Developer + + Setup diff --git a/selfdrive/ui/translations/main_pt-BR.ts b/selfdrive/ui/translations/main_pt-BR.ts index ba50e97141..342a212045 100644 --- a/selfdrive/ui/translations/main_pt-BR.ts +++ b/selfdrive/ui/translations/main_pt-BR.ts @@ -113,6 +113,17 @@ Rejeitar, desintalar %1 + + DeveloperPanel + + Joystick Debug Mode + + + + Longitudinal Maneuver Mode + + + DevicePanel @@ -602,6 +613,10 @@ Isso pode levar até um minuto. Software Software + + Developer + + Setup diff --git a/selfdrive/ui/translations/main_th.ts b/selfdrive/ui/translations/main_th.ts index 6d89c049b1..c2b2771830 100644 --- a/selfdrive/ui/translations/main_th.ts +++ b/selfdrive/ui/translations/main_th.ts @@ -113,6 +113,17 @@ ปฏิเสธ และถอนการติดตั้ง %1 + + DeveloperPanel + + Joystick Debug Mode + + + + Longitudinal Maneuver Mode + + + DevicePanel @@ -598,6 +609,10 @@ This may take up to a minute. Software ซอฟต์แวร์ + + Developer + + Setup diff --git a/selfdrive/ui/translations/main_tr.ts b/selfdrive/ui/translations/main_tr.ts index 663ad8c281..9a53449276 100644 --- a/selfdrive/ui/translations/main_tr.ts +++ b/selfdrive/ui/translations/main_tr.ts @@ -113,6 +113,17 @@ Reddet, Kurulumu kaldır. %1 + + DeveloperPanel + + Joystick Debug Mode + + + + Longitudinal Maneuver Mode + + + DevicePanel @@ -596,6 +607,10 @@ This may take up to a minute. Software Yazılım + + Developer + + Setup diff --git a/selfdrive/ui/translations/main_zh-CHS.ts b/selfdrive/ui/translations/main_zh-CHS.ts index 494b1bc170..f061322c45 100644 --- a/selfdrive/ui/translations/main_zh-CHS.ts +++ b/selfdrive/ui/translations/main_zh-CHS.ts @@ -113,6 +113,17 @@ 拒绝并卸载%1 + + DeveloperPanel + + Joystick Debug Mode + + + + Longitudinal Maneuver Mode + + + DevicePanel @@ -598,6 +609,10 @@ This may take up to a minute. Software 软件 + + Developer + + Setup diff --git a/selfdrive/ui/translations/main_zh-CHT.ts b/selfdrive/ui/translations/main_zh-CHT.ts index 7ce6ac6d20..04e76a8d95 100644 --- a/selfdrive/ui/translations/main_zh-CHT.ts +++ b/selfdrive/ui/translations/main_zh-CHT.ts @@ -113,6 +113,17 @@ 拒絕並解除安裝 %1 + + DeveloperPanel + + Joystick Debug Mode + + + + Longitudinal Maneuver Mode + + + DevicePanel @@ -598,6 +609,10 @@ This may take up to a minute. Software 軟體 + + Developer + + Setup