From c598053ef234cc9f0760d670853bce0853e928e8 Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Sun, 10 Mar 2024 20:59:55 -0700 Subject: [PATCH] Revert ""Soft" reboot button" This reverts commit d48819df05f43368b0fe043de4154df990008bcd. --- common/params.cc | 1 - .../navigation/ui/navigation_settings.cc | 2 +- selfdrive/frogpilot/ui/control_settings.cc | 4 +-- selfdrive/frogpilot/ui/vehicle_settings.cc | 4 +-- selfdrive/frogpilot/ui/visual_settings.cc | 2 +- selfdrive/manager/manager.py | 5 +--- selfdrive/ui/qt/offroad/settings.cc | 25 +++---------------- selfdrive/ui/qt/offroad/settings.h | 1 - system/hardware/base.h | 1 - system/hardware/base.py | 4 --- system/hardware/pc/hardware.py | 3 --- system/hardware/tici/hardware.h | 7 ------ system/hardware/tici/hardware.py | 8 ------ 13 files changed, 10 insertions(+), 57 deletions(-) diff --git a/common/params.cc b/common/params.cc index 34f1e21d..1b5fbfb4 100644 --- a/common/params.cc +++ b/common/params.cc @@ -263,7 +263,6 @@ std::unordered_map keys = { {"DisableOnroadUploads", PERSISTENT}, {"DisableVTSCSmoothing", PERSISTENT}, {"DisengageVolume", PERSISTENT}, - {"DoSoftReboot", CLEAR_ON_MANAGER_START}, {"DragonPilotTune", PERSISTENT}, {"DriverCamera", PERSISTENT}, {"DriveStats", PERSISTENT}, diff --git a/selfdrive/frogpilot/navigation/ui/navigation_settings.cc b/selfdrive/frogpilot/navigation/ui/navigation_settings.cc index df04ead4..09aadb3d 100644 --- a/selfdrive/frogpilot/navigation/ui/navigation_settings.cc +++ b/selfdrive/frogpilot/navigation/ui/navigation_settings.cc @@ -209,7 +209,7 @@ void FrogPilotNavigationPanel::cancelDownload(QWidget *parent) { std::system("pkill mapd"); }).detach(); if (FrogPilotConfirmationDialog::toggle("Reboot required to re-enable map downloads", "Reboot Now", parent)) { - Hardware::soft_reboot(); + Hardware::reboot(); } downloadActive = false; updateVisibility(downloadActive); diff --git a/selfdrive/frogpilot/ui/control_settings.cc b/selfdrive/frogpilot/ui/control_settings.cc index 52cf182e..4bba952b 100644 --- a/selfdrive/frogpilot/ui/control_settings.cc +++ b/selfdrive/frogpilot/ui/control_settings.cc @@ -282,7 +282,7 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil } if (started) { if (FrogPilotConfirmationDialog::toggle("Reboot required to take effect.", "Reboot Now", this)) { - Hardware::soft_reboot(); + Hardware::reboot(); } } } @@ -513,7 +513,7 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil QObject::connect(toggles[key], &ToggleControl::toggleFlipped, [this, key]() { if (started) { if (FrogPilotConfirmationDialog::toggle("Reboot required to take effect.", "Reboot Now", this)) { - Hardware::soft_reboot(); + Hardware::reboot(); } } }); diff --git a/selfdrive/frogpilot/ui/vehicle_settings.cc b/selfdrive/frogpilot/ui/vehicle_settings.cc index 1d59ccff..bc217714 100644 --- a/selfdrive/frogpilot/ui/vehicle_settings.cc +++ b/selfdrive/frogpilot/ui/vehicle_settings.cc @@ -126,7 +126,7 @@ FrogPilotVehiclesPanel::FrogPilotVehiclesPanel(SettingsWindow *parent) : FrogPil QObject::connect(static_cast(toggle), &FrogPilotButtonsParamControl::buttonClicked, [this]() { if (started) { if (FrogPilotConfirmationDialog::toggle("Reboot required to take effect.", "Reboot Now", this)) { - Hardware::soft_reboot(); + Hardware::reboot(); } } }); @@ -153,7 +153,7 @@ FrogPilotVehiclesPanel::FrogPilotVehiclesPanel(SettingsWindow *parent) : FrogPil QObject::connect(toggles[key], &ToggleControl::toggleFlipped, [this]() { if (started) { if (FrogPilotConfirmationDialog::toggle("Reboot required to take effect.", "Reboot Now", this)) { - Hardware::soft_reboot(); + Hardware::reboot(); } } }); diff --git a/selfdrive/frogpilot/ui/visual_settings.cc b/selfdrive/frogpilot/ui/visual_settings.cc index 95e2aef4..1277edba 100644 --- a/selfdrive/frogpilot/ui/visual_settings.cc +++ b/selfdrive/frogpilot/ui/visual_settings.cc @@ -278,7 +278,7 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot QObject::connect(toggles[key], &ToggleControl::toggleFlipped, [this, key]() { if (started || key == "DriveStats") { if (FrogPilotConfirmationDialog::toggle("Reboot required to take effect.", "Reboot Now", this)) { - Hardware::soft_reboot(); + Hardware::reboot(); } } }); diff --git a/selfdrive/manager/manager.py b/selfdrive/manager/manager.py index 6b1c7ed1..593a76fb 100755 --- a/selfdrive/manager/manager.py +++ b/selfdrive/manager/manager.py @@ -413,7 +413,7 @@ def manager_thread() -> None: # Exit main loop when uninstall/shutdown/reboot is needed shutdown = False - for param in ("DoUninstall", "DoShutdown", "DoReboot", "DoSoftReboot"): + for param in ("DoUninstall", "DoShutdown", "DoReboot"): if params.get_bool(param): shutdown = True params.put("LastManagerExitReason", f"{param} {datetime.datetime.now()}") @@ -489,9 +489,6 @@ def main() -> None: if params.get_bool("DoUninstall"): cloudlog.warning("uninstalling") HARDWARE.uninstall() - elif params.get_bool("DoSoftReboot"): - cloudlog.warning("softreboot") - HARDWARE.soft_reboot() elif params.get_bool("DoReboot"): cloudlog.warning("reboot") HARDWARE.reboot() diff --git a/selfdrive/ui/qt/offroad/settings.cc b/selfdrive/ui/qt/offroad/settings.cc index 45ce7b8d..c2f55433 100644 --- a/selfdrive/ui/qt/offroad/settings.cc +++ b/selfdrive/ui/qt/offroad/settings.cc @@ -488,7 +488,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) { process.setWorkingDirectory("/data/openpilot/panda"); process.start("/bin/sh", QStringList{"-c", "pkill -f boardd; PYTHONPATH=.. python -c \"from panda import Panda; Panda().flash()\""}); process.waitForFinished(); - Hardware::soft_reboot(); + Hardware::reboot(); }); addItem(flashPandaBtn); @@ -507,11 +507,6 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) { power_layout->addWidget(reboot_btn); QObject::connect(reboot_btn, &QPushButton::clicked, this, &DevicePanel::reboot); - QPushButton *softreboot_btn = new QPushButton(tr("Soft Reboot")); - softreboot_btn->setObjectName("softreboot_btn"); - power_layout->addWidget(softreboot_btn); - QObject::connect(softreboot_btn, &QPushButton::clicked, this, &DevicePanel::softreboot); - QPushButton *poweroff_btn = new QPushButton(tr("Power Off")); poweroff_btn->setObjectName("poweroff_btn"); power_layout->addWidget(poweroff_btn); @@ -522,10 +517,8 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) { } setStyleSheet(R"( - #softreboot_btn { height: 120px; border-radius: 15px; background-color: #e2e22c; } - #softreboot_btn:pressed { background-color: #ffe224; } - #reboot_btn { height: 120px; border-radius: 15px; background-color: #e2872c; } - #reboot_btn:pressed { background-color: #ff9724; } + #reboot_btn { height: 120px; border-radius: 15px; background-color: #393939; } + #reboot_btn:pressed { background-color: #4a4a4a; } #poweroff_btn { height: 120px; border-radius: 15px; background-color: #E22C2C; } #poweroff_btn:pressed { background-color: #FF2424; } )"); @@ -569,18 +562,6 @@ void DevicePanel::reboot() { } } -void DevicePanel::softreboot() { - if (!uiState()->engaged()) { - if (ConfirmationDialog::confirm(tr("Are you sure you want to soft reboot?"), tr("Soft Reboot"), this)) { - if (!uiState()->engaged()) { - params.putBool("DoSoftReboot", true); - } - } - } else { - ConfirmationDialog::alert(tr("Disengage to Soft Reboot"), this); - } -} - void DevicePanel::poweroff() { if (!uiState()->engaged()) { if (ConfirmationDialog::confirm(tr("Are you sure you want to power off?"), tr("Power Off"), this)) { diff --git a/selfdrive/ui/qt/offroad/settings.h b/selfdrive/ui/qt/offroad/settings.h index 6b58a982..9ab41129 100644 --- a/selfdrive/ui/qt/offroad/settings.h +++ b/selfdrive/ui/qt/offroad/settings.h @@ -60,7 +60,6 @@ signals: private slots: void poweroff(); void reboot(); - void softreboot(); void updateCalibDescription(); private: diff --git a/system/hardware/base.h b/system/hardware/base.h index 6fe65f83..dc2282a9 100644 --- a/system/hardware/base.h +++ b/system/hardware/base.h @@ -26,7 +26,6 @@ public: } static void reboot() {} - static void soft_reboot() {} static void poweroff() {} static void set_brightness(int percent) {} static void set_display_power(bool on) {} diff --git a/system/hardware/base.py b/system/hardware/base.py index 527518a9..7434bb61 100644 --- a/system/hardware/base.py +++ b/system/hardware/base.py @@ -30,10 +30,6 @@ class HardwareBase(ABC): def reboot(self, reason=None): pass - @abstractmethod - def soft_reboot(self): - pass - @abstractmethod def uninstall(self): pass diff --git a/system/hardware/pc/hardware.py b/system/hardware/pc/hardware.py index 704d65aa..719e272a 100644 --- a/system/hardware/pc/hardware.py +++ b/system/hardware/pc/hardware.py @@ -19,9 +19,6 @@ class Pc(HardwareBase): def reboot(self, reason=None): print("REBOOT!") - - def soft_reboot(self): - print("SOFT REBOOT!") def uninstall(self): print("uninstall") diff --git a/system/hardware/tici/hardware.h b/system/hardware/tici/hardware.h index 2d3cc72c..e553a665 100644 --- a/system/hardware/tici/hardware.h +++ b/system/hardware/tici/hardware.h @@ -50,13 +50,6 @@ public: } static void reboot() { std::system("sudo reboot"); } - static void soft_reboot() { - std::system("echo 894000.i2c | sudo tee /sys/bus/platform/drivers/i2c_geni/unbind"); - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - std::system("echo 894000.i2c | sudo tee /sys/bus/platform/drivers/i2c_geni/bind"); - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - std::system("sudo systemctl restart comma"); - } static void poweroff() { std::system("sudo poweroff"); } static void set_brightness(int percent) { std::string max = util::read_file("/sys/class/backlight/panel0-backlight/max_brightness"); diff --git a/system/hardware/tici/hardware.py b/system/hardware/tici/hardware.py index ae3f0869..5bb1032b 100644 --- a/system/hardware/tici/hardware.py +++ b/system/hardware/tici/hardware.py @@ -134,14 +134,6 @@ class Tici(HardwareBase): def reboot(self, reason=None): subprocess.check_output(["sudo", "reboot"]) - def soft_reboot(self): - # Reload the touchscreen driver to reset touch_count and avoid triggering a system reset prompt - sudo_write("894000.i2c", "/sys/bus/platform/drivers/i2c_geni/unbind") - time.sleep(0.5) - sudo_write("894000.i2c", "/sys/bus/platform/drivers/i2c_geni/bind") - time.sleep(0.5) - os.system("sudo systemctl restart comma") - def uninstall(self): Path("/data/__system_reset__").touch() os.sync()