diff --git a/.github/workflows/selfdrive_tests.yaml b/.github/workflows/selfdrive_tests.yaml index 219c316781703e..d7e8ab18880761 100644 --- a/.github/workflows/selfdrive_tests.yaml +++ b/.github/workflows/selfdrive_tests.yaml @@ -223,6 +223,7 @@ jobs: run: | ${{ env.RUN }} "unset PYTHONWARNINGS && AZURE_TOKEN='$AZURE_TOKEN' python3 selfdrive/test/process_replay/test_processes.py -j$(nproc) --upload-only" - name: Run regen + if: false timeout-minutes: 4 run: | ${{ env.RUN }} "ONNXCPU=1 $PYTEST selfdrive/test/process_replay/test_regen.py && \ diff --git a/.github/workflows/ui_preview.yaml b/.github/workflows/ui_preview.yaml index a6daaad19f0377..3ed882ed05ddd5 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/opendbc_repo b/opendbc_repo index 131fb136e5d538..85044f580766a6 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit 131fb136e5d538042bd7d9a221a2044ed4355d6d +Subproject commit 85044f580766a6d36946f984c99ad2cffa50a9cb diff --git a/panda b/panda index 15cbbd29fa009d..9a1d04254a5e31 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 15cbbd29fa009dab9a9567ac3e407ad0920f5ed5 +Subproject commit 9a1d04254a5e31036698e0d5a5a6b84944fcb885 diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index 66abbd2803bdab..6842530946b49d 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -22530fd1bd915d5b37db900e2ac42a9501cd5972 +8f9dba78b0a2a4fbf8122f61d49e9529dba9b3b4 \ No newline at end of file diff --git a/selfdrive/ui/SConscript b/selfdrive/ui/SConscript index 643951fff311cb..19dcc625e2fa61 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 22d9c01efe0b92..066dc3ca7ebbec 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 00000000000000..bb11b354047151 --- /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 00000000000000..9fcff1e97b8424 --- /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 29ff9807a10a64..d4aab53f5afcb6 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 0b98cb0b38a368..e6fd9a016ae465 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 @@ def setup_pair_device(click, pm: PubMaster): "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 5f254e9cd4ba51..2854aceeaa5d96 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 4f5997228a7724..2abed6e3055deb 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 fa50f33f15366a..45309eb7451238 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 566ed32f114c86..f4251bc41d3e79 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 90c8aba00bfbf2..bc83d3f9ae5b72 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 6d01b1289f65a3..0839ddf15eeba4 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 ba50e971418168..342a21204590df 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 6d89c049b18a84..c2b2771830eabf 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 663ad8c2813645..9a53449276fcd8 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 494b1bc170f4c6..f061322c45f6fa 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 7ce6ac6d208606..04e76a8d957272 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 diff --git a/system/sensord/sensors/bmx055_accel.cc b/system/sensord/sensors/bmx055_accel.cc index bdb0113de3e14c..bcc31e1d6cfd52 100644 --- a/system/sensord/sensors/bmx055_accel.cc +++ b/system/sensord/sensors/bmx055_accel.cc @@ -10,12 +10,15 @@ BMX055_Accel::BMX055_Accel(I2CBus *bus) : I2CSensor(bus) {} int BMX055_Accel::init() { int ret = verify_chip_id(BMX055_ACCEL_I2C_REG_ID, {BMX055_ACCEL_CHIP_ID}); - if (ret == -1) return -1; + if (ret == -1) { + goto fail; + } ret = set_register(BMX055_ACCEL_I2C_REG_PMU, BMX055_ACCEL_NORMAL_MODE); if (ret < 0) { goto fail; } + // bmx055 accel has a 1.3ms wakeup time from deep suspend mode util::sleep_for(10); @@ -36,11 +39,15 @@ int BMX055_Accel::init() { goto fail; } + enabled = true; + fail: return ret; } int BMX055_Accel::shutdown() { + if (!enabled) return 0; + // enter deep suspend mode (lowest power mode) int ret = set_register(BMX055_ACCEL_I2C_REG_PMU, BMX055_ACCEL_DEEP_SUSPEND); if (ret < 0) { diff --git a/system/sensord/sensors/bmx055_gyro.cc b/system/sensord/sensors/bmx055_gyro.cc index 411b2f445e25d5..0cc405f6547236 100644 --- a/system/sensord/sensors/bmx055_gyro.cc +++ b/system/sensord/sensors/bmx055_gyro.cc @@ -46,11 +46,15 @@ int BMX055_Gyro::init() { goto fail; } + enabled = true; + fail: return ret; } int BMX055_Gyro::shutdown() { + if (!enabled) return 0; + // enter deep suspend mode (lowest power mode) int ret = set_register(BMX055_GYRO_I2C_REG_LPM1, BMX055_GYRO_DEEP_SUSPEND); if (ret < 0) { diff --git a/system/sensord/sensors/bmx055_magn.cc b/system/sensord/sensors/bmx055_magn.cc index 223f0337e8e698..b498c5fe3d8979 100644 --- a/system/sensord/sensors/bmx055_magn.cc +++ b/system/sensord/sensors/bmx055_magn.cc @@ -78,7 +78,7 @@ int BMX055_Magn::init() { // suspend -> sleep int ret = set_register(BMX055_MAGN_I2C_REG_PWR_0, 0x01); if (ret < 0) { - LOGW("Enabling power failed: %d", ret); + LOGD("Enabling power failed: %d", ret); goto fail; } util::sleep_for(5); // wait until the chip is powered on @@ -139,7 +139,7 @@ int BMX055_Magn::init() { goto fail; } - + enabled = true; return 0; fail: @@ -147,6 +147,8 @@ int BMX055_Magn::init() { } int BMX055_Magn::shutdown() { + if (!enabled) return 0; + // move to suspend mode int ret = set_register(BMX055_MAGN_I2C_REG_PWR_0, 0); if (ret < 0) { diff --git a/system/sensord/sensors/i2c_sensor.h b/system/sensord/sensors/i2c_sensor.h index 6082510083ad3a..e6d328ce724418 100644 --- a/system/sensord/sensors/i2c_sensor.h +++ b/system/sensord/sensors/i2c_sensor.h @@ -39,7 +39,7 @@ class I2CSensor : public Sensor { uint8_t chip_id = 0; int ret = read_register(address, &chip_id, 1); if (ret < 0) { - LOGW("Reading chip ID failed: %d", ret); + LOGD("Reading chip ID failed: %d", ret); return -1; } for (int i = 0; i < expected_ids.size(); ++i) { diff --git a/system/sensord/sensors/sensor.h b/system/sensord/sensors/sensor.h index 1b0e3be0dc6065..ccf998d161fa4a 100644 --- a/system/sensord/sensors/sensor.h +++ b/system/sensord/sensors/sensor.h @@ -5,8 +5,10 @@ class Sensor { public: int gpio_fd = -1; + bool enabled = false; uint64_t start_ts = 0; uint64_t init_delay = 500e6; // default dealy 500ms + virtual ~Sensor() {} virtual int init() = 0; virtual bool get_event(MessageBuilder &msg, uint64_t ts = 0) = 0; diff --git a/system/sensord/sensors_qcom2.cc b/system/sensord/sensors_qcom2.cc index 55c8d2a4480a4c..532e28053f29ab 100644 --- a/system/sensord/sensors_qcom2.cc +++ b/system/sensord/sensors_qcom2.cc @@ -39,7 +39,7 @@ void interrupt_loop(std::vector> sensors) { } } - uint64_t offset = 0; + uint64_t offset = nanos_since_epoch() - nanos_since_boot(); struct pollfd fd_list[1] = {0}; fd_list[0].fd = fd; fd_list[0].events = POLLIN | POLLPRI; diff --git a/uv.lock b/uv.lock index eed10e22ea2d96..c4079add69b79d 100644 --- a/uv.lock +++ b/uv.lock @@ -4494,14 +4494,14 @@ wheels = [ [[package]] name = "pytest-randomly" -version = "3.15.0" +version = "3.16.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "pytest" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/c9/d4/6e924a0b2855736d942703dec88dfc98b4fe0881c8fa849b6b0fbb9182fa/pytest_randomly-3.15.0.tar.gz", hash = "sha256:b908529648667ba5e54723088edd6f82252f540cc340d748d1fa985539687047", size = 21743 } +sdist = { url = "https://files.pythonhosted.org/packages/c0/68/d221ed7f4a2a49a664da721b8e87b52af6dd317af2a6cb51549cf17ac4b8/pytest_randomly-3.16.0.tar.gz", hash = "sha256:11bf4d23a26484de7860d82f726c0629837cf4064b79157bd18ec9d41d7feb26", size = 13367 } wheels = [ - { url = "https://files.pythonhosted.org/packages/24/d3/00e575657422055c4ea220b2f80e8cc6026ab7130372b7067444d1b0ac10/pytest_randomly-3.15.0-py3-none-any.whl", hash = "sha256:0516f4344b29f4e9cdae8bce31c4aeebf59d0b9ef05927c33354ff3859eeeca6", size = 8685 }, + { url = "https://files.pythonhosted.org/packages/22/70/b31577d7c46d8e2f9baccfed5067dd8475262a2331ffb0bfdf19361c9bde/pytest_randomly-3.16.0-py3-none-any.whl", hash = "sha256:8633d332635a1a0983d3bba19342196807f6afb17c3eef78e02c2f85dade45d6", size = 8396 }, ] [[package]]