From 8846b907d7a08ec93eca7f4d3b6d494e57b1ef92 Mon Sep 17 00:00:00 2001 From: prabhaavp <143428353+prabhaavp@users.noreply.github.com> Date: Mon, 18 May 2026 18:33:23 -0400 Subject: [PATCH] Disable Widecam Feature Disable Widecam Feature Disable Widecam Feature Disable Widecam Feature Disable Widecam Feature --- common/params_keys.h | 1 + selfdrive/ui/mici/onroad/augmented_road_view.py | 2 +- .../components/tools/device_settings_layout.json | 13 +++++++++++++ starpilot/ui/qt/offroad/device_settings.cc | 3 ++- starpilot/ui/qt/offroad/device_settings.h | 2 +- starpilot/ui/qt/offroad/visual_settings.cc | 11 ++++++++++- system/camerad/cameras/hw.h | 6 +++--- system/camerad/cameras/spectra.cc | 12 +++++++++++- system/camerad/main.cc | 5 +++++ 9 files changed, 47 insertions(+), 8 deletions(-) diff --git a/common/params_keys.h b/common/params_keys.h index bea75ad57..c8cc8790b 100644 --- a/common/params_keys.h +++ b/common/params_keys.h @@ -179,6 +179,7 @@ inline static std::unordered_map keys = { {"CalibrationProgress", {PERSISTENT, FLOAT, "0.0", "0.0", 3}}, {"CameraView", {PERSISTENT, INT, "3", "0", 2}}, {"CancelDownloadMaps", {CLEAR_ON_MANAGER_START, BOOL, "0", "0"}}, + {"DisableWideRoad", {PERSISTENT, BOOL, "0", "0", 3}}, {"CancelModelDownload", {CLEAR_ON_MANAGER_START, BOOL, "0", "0"}}, {"CancelThemeDownload", {CLEAR_ON_MANAGER_START, BOOL, "0", "0"}}, {"CarMake", {PERSISTENT, STRING, "mock", "mock", 0}}, diff --git a/selfdrive/ui/mici/onroad/augmented_road_view.py b/selfdrive/ui/mici/onroad/augmented_road_view.py index 4fdbb5947..c0c51c6e2 100644 --- a/selfdrive/ui/mici/onroad/augmented_road_view.py +++ b/selfdrive/ui/mici/onroad/augmented_road_view.py @@ -576,7 +576,7 @@ class AugmentedRoadView(CameraView): elif camera_view == CAMERA_VIEW_STANDARD: target = ROAD_CAM elif camera_view == CAMERA_VIEW_WIDE: - target = WIDE_CAM + target = WIDE_CAM if WIDE_CAM in self.available_streams else ROAD_CAM elif sm['selfdriveState'].experimentalMode and WIDE_CAM in self.available_streams: v_ego = sm['carState'].vEgo if v_ego < WIDE_CAM_MAX_SPEED: diff --git a/starpilot/system/the_pond/assets/components/tools/device_settings_layout.json b/starpilot/system/the_pond/assets/components/tools/device_settings_layout.json index bfdceb1d9..799709cde 100644 --- a/starpilot/system/the_pond/assets/components/tools/device_settings_layout.json +++ b/starpilot/system/the_pond/assets/components/tools/device_settings_layout.json @@ -3141,5 +3141,18 @@ "options_endpoint": "/api/models/installed" } ] + }, + { + "name": "Developer", + "icon": "bi-exclamation-triangle", + "params": [ + { + "key": "DisableWideRoad", + "label": "Disable Wide Road Camera", + "description": "Only enable this if the wide camera is broken or for development!\n\nDisabling the wide camera may degrade driving performance and cause instability.\n\nRequires a reboot to take effect.", + "data_type": "bool", + "ui_type": "toggle" + } + ] } ] diff --git a/starpilot/ui/qt/offroad/device_settings.cc b/starpilot/ui/qt/offroad/device_settings.cc index f43187e96..996246fab 100644 --- a/starpilot/ui/qt/offroad/device_settings.cc +++ b/starpilot/ui/qt/offroad/device_settings.cc @@ -49,6 +49,7 @@ StarPilotDevicePanel::StarPilotDevicePanel(StarPilotSettingsWindow *parent, bool const std::vector> deviceToggles { {"DeviceManagement", tr("Device Settings"), tr("Settings that control how the device runs, powers off, and manages driving data."), "../../starpilot/assets/toggle_icons/icon_device.png"}, {"DeviceShutdown", tr("Device Shutdown Timer"), tr("Keep the device on for the set amount of time after a drive before it shuts down automatically."), ""}, + {"DisableWideRoad", tr("Disable Wide Road Camera"), QString("%1

%2").arg(tr("WARNING: Only use this if the wide camera is malfunctioning or for development purposes. This may cause instability!")).arg(tr("Requires a reboot to take effect.")), ""}, {"NoLogging", tr("Disable Logging"), QString("%1

%2").arg(tr("WARNING: This will prevent your drives from being recorded and all data will be unobtainable!")).arg(tr("Prevent the device from saving driving data.")), ""}, {"NoUploads", tr("Disable Uploads"), QString("%1

%2").arg(tr("WARNING: This will prevent your drives from being uploaded to comma connect which will impact debugging and official support from comma!")).arg(tr("Prevent the device from uploading driving data.")), ""}, {"HigherBitrate", tr("High-Quality Recording"), tr("Save drive footage in higher video quality."), ""}, @@ -178,7 +179,7 @@ StarPilotDevicePanel::StarPilotDevicePanel(StarPilotSettingsWindow *parent, bool QObject::connect(static_cast(toggles[key]), &ToggleControl::toggleFlipped, this, &StarPilotDevicePanel::updateToggles); } - QSet rebootKeys = {"HigherBitrate", "UseKonikServer"}; + QSet rebootKeys = {"DisableWideRoad", "HigherBitrate", "UseKonikServer"}; for (const QString &key : rebootKeys) { QObject::connect(static_cast(toggles[key]), &ToggleControl::toggleFlipped, [key, this](bool state) { QString filePath; diff --git a/starpilot/ui/qt/offroad/device_settings.h b/starpilot/ui/qt/offroad/device_settings.h index 569fc9bce..8d152741a 100644 --- a/starpilot/ui/qt/offroad/device_settings.h +++ b/starpilot/ui/qt/offroad/device_settings.h @@ -23,7 +23,7 @@ private: std::map toggles; - QSet deviceManagementKeys = {"DeviceShutdown", "HigherBitrate", "IncreaseThermalLimits", "LowVoltageShutdown", "NoLogging", "NoUploads", "UseKonikServer"}; + QSet deviceManagementKeys = {"DeviceShutdown", "DisableWideRoad", "HigherBitrate", "IncreaseThermalLimits", "LowVoltageShutdown", "NoLogging", "NoUploads", "UseKonikServer"}; QSet screenKeys = {"ScreenBrightness", "ScreenBrightnessOnroad", "ScreenRecorder", "ScreenTimeout", "ScreenTimeoutOnroad", "StandbyMode"}; QSet parentKeys; diff --git a/starpilot/ui/qt/offroad/visual_settings.cc b/starpilot/ui/qt/offroad/visual_settings.cc index 1f66a0358..4f5fb2da4 100644 --- a/starpilot/ui/qt/offroad/visual_settings.cc +++ b/starpilot/ui/qt/offroad/visual_settings.cc @@ -69,7 +69,9 @@ StarPilotVisualsPanel::StarPilotVisualsPanel(StarPilotSettingsWindow *parent, bo {"QOLVisuals", tr("Quality of Life"), tr("Miscellaneous visual changes to fine-tune how the driving screen looks."), "../../starpilot/assets/toggle_icons/icon_quality_of_life.png"}, {"CameraView", tr("Camera View"), tr("Select the active camera view. This is purely a visual change and doesn't impact how openpilot drives!"), ""}, {"DriverCamera", tr("Show Driver Camera When In Reverse"), tr("Show the driver camera feed when the vehicle is in reverse."), ""}, - {"StoppedTimer", tr("Stopped Timer"), tr("Show a timer when stopped in place of the current speed to indicate how long the vehicle has been stopped."), ""} + {"StoppedTimer", tr("Stopped Timer"), tr("Show a timer when stopped in place of the current speed to indicate how long the vehicle has been stopped."), ""}, + + {"DisableWideRoad", tr("Disable Wide Road Camera"), QString("%1

%2").arg(tr("Only enable this if the wide camera is broken or for development!")).arg(tr("Disabling the wide camera may degrade driving performance and cause instability.

Requires a reboot to take effect.")), "../../starpilot/assets/toggle_icons/icon_advanced_device.png"} }; for (const auto &[param, title, desc, icon] : visualToggles) { @@ -178,6 +180,13 @@ StarPilotVisualsPanel::StarPilotVisualsPanel(StarPilotSettingsWindow *parent, bo QObject::connect(static_cast(toggles[key]), &ToggleControl::toggleFlipped, this, &StarPilotVisualsPanel::updateToggles); } + static_cast(toggles["DisableWideRoad"])->setConfirmation(true, false); + QObject::connect(static_cast(toggles["DisableWideRoad"]), &ToggleControl::toggleFlipped, [this](bool state) { + if (StarPilotConfirmationDialog::toggleReboot(this)) { + Hardware::reboot(); + } + }); + openDescriptions(forceOpenDescriptions, toggles); QObject::connect(parent, &StarPilotSettingsWindow::closeSubPanel, [visualsLayout, visualsPanel, this] { diff --git a/system/camerad/cameras/hw.h b/system/camerad/cameras/hw.h index f20a1b3ad..23409087a 100644 --- a/system/camerad/cameras/hw.h +++ b/system/camerad/cameras/hw.h @@ -35,7 +35,7 @@ const CameraConfig WIDE_ROAD_CAMERA_CONFIG = { .focal_len = 1.71, .publish_name = "wideRoadCameraState", .init_camera_state = &cereal::Event::Builder::initWideRoadCameraState, - .enabled = !getenv("DISABLE_WIDE_ROAD"), + .enabled = true, // Runtime check happens in SpectraCamera constructor .phy = CAM_ISP_IFE_IN_RES_PHY_0, .vignetting_correction = false, .output_type = ISP_IFE_PROCESSED, @@ -47,7 +47,7 @@ const CameraConfig ROAD_CAMERA_CONFIG = { .focal_len = 8.0, .publish_name = "roadCameraState", .init_camera_state = &cereal::Event::Builder::initRoadCameraState, - .enabled = !getenv("DISABLE_ROAD"), + .enabled = true, // Runtime check happens in SpectraCamera constructor .phy = CAM_ISP_IFE_IN_RES_PHY_1, .vignetting_correction = true, .output_type = ISP_IFE_PROCESSED, @@ -59,7 +59,7 @@ const CameraConfig DRIVER_CAMERA_CONFIG = { .focal_len = 1.71, .publish_name = "driverCameraState", .init_camera_state = &cereal::Event::Builder::initDriverCameraState, - .enabled = !getenv("DISABLE_DRIVER"), + .enabled = true, // Runtime check happens in SpectraCamera constructor .phy = CAM_ISP_IFE_IN_RES_PHY_2, .vignetting_correction = false, .output_type = ISP_BPS_PROCESSED, diff --git a/system/camerad/cameras/spectra.cc b/system/camerad/cameras/spectra.cc index 47ae9061f..e841f2a1a 100644 --- a/system/camerad/cameras/spectra.cc +++ b/system/camerad/cameras/spectra.cc @@ -234,8 +234,18 @@ void SpectraMaster::init() { SpectraCamera::SpectraCamera(SpectraMaster *master, const CameraConfig &config) : m(master), - enabled(config.enabled), cc(config) { + // Runtime check for disable environment variables (must happen after main() sets them) + bool should_disable = false; + if (config.camera_num == 0 && getenv("DISABLE_WIDE_ROAD")) { + should_disable = true; + } else if (config.camera_num == 1 && getenv("DISABLE_ROAD")) { + should_disable = true; + } else if (config.camera_num == 2 && getenv("DISABLE_DRIVER")) { + should_disable = true; + } + enabled = !should_disable; + ife_buf_depth = VIPC_BUFFER_COUNT; assert(ife_buf_depth < MAX_IFE_BUFS); } diff --git a/system/camerad/main.cc b/system/camerad/main.cc index 3dc004767..ba684f37a 100644 --- a/system/camerad/main.cc +++ b/system/camerad/main.cc @@ -12,6 +12,11 @@ int main(int argc, char *argv[]) { LOGW("camerad: set_core_affinity failed (%d), continuing", ret); } + if (Params().getBool("DisableWideRoad")) { + setenv("DISABLE_WIDE_ROAD", "1", 1); + LOGW("camerad: DisableWideRoad param set, disabling wide road camera"); + } + camerad_thread(); return 0; }