From 805373657e49c2c14fd832f28f60d17644fc0c04 Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Fri, 10 May 2024 11:21:54 -0700 Subject: [PATCH] Controls - Device Management - Offline Mode Allow the device to be offline indefinitely. --- selfdrive/thermald/thermald.py | 2 +- selfdrive/ui/qt/widgets/offroad_alerts.cc | 13 +++++++++++++ selfdrive/ui/qt/widgets/offroad_alerts.h | 1 + selfdrive/updated/updated.py | 2 ++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/selfdrive/thermald/thermald.py b/selfdrive/thermald/thermald.py index bbaaab6..79733d1 100755 --- a/selfdrive/thermald/thermald.py +++ b/selfdrive/thermald/thermald.py @@ -298,7 +298,7 @@ def thermald_thread(end_event, hw_queue, frogpilot_toggles) -> None: # **** starting logic **** - startup_conditions["up_to_date"] = params.get("Offroad_ConnectivityNeeded") is None or params.get_bool("DisableUpdates") or params.get_bool("SnoozeUpdate") + startup_conditions["up_to_date"] = params.get("Offroad_ConnectivityNeeded") is None or params.get_bool("DisableUpdates") or params.get_bool("SnoozeUpdate") or frogpilot_toggles.offline_mode startup_conditions["not_uninstalling"] = not params.get_bool("DoUninstall") startup_conditions["accepted_terms"] = params.get("HasAcceptedTerms") == terms_version diff --git a/selfdrive/ui/qt/widgets/offroad_alerts.cc b/selfdrive/ui/qt/widgets/offroad_alerts.cc index 74ece36..f1cde09 100644 --- a/selfdrive/ui/qt/widgets/offroad_alerts.cc +++ b/selfdrive/ui/qt/widgets/offroad_alerts.cc @@ -32,6 +32,18 @@ AbstractAlert::AbstractAlert(bool hasRebootBtn, QWidget *parent) : QFrame(parent footer_layout->addWidget(dismiss_btn, 0, Qt::AlignBottom | Qt::AlignLeft); QObject::connect(dismiss_btn, &QPushButton::clicked, this, &AbstractAlert::dismiss); + disable_check_btn = new QPushButton(tr("Disable Internet Check")); + disable_check_btn->setVisible(false); + disable_check_btn->setFixedSize(625, 125); + footer_layout->addWidget(disable_check_btn, 1, Qt::AlignBottom | Qt::AlignCenter); + QObject::connect(disable_check_btn, &QPushButton::clicked, [=]() { + params.putBool("SnoozeUpdate", true); + params.putBool("DeviceManagement", true); + params.putBool("OfflineMode", true); + }); + QObject::connect(disable_check_btn, &QPushButton::clicked, this, &AbstractAlert::dismiss); + disable_check_btn->setStyleSheet(R"(color: white; background-color: #4F4F4F;)"); + snooze_btn = new QPushButton(tr("Snooze Update")); snooze_btn->setVisible(false); snooze_btn->setFixedSize(550, 125); @@ -107,6 +119,7 @@ int OffroadAlert::refresh() { label->setVisible(!text.isEmpty()); alertCount += !text.isEmpty(); } + disable_check_btn->setVisible(!alerts["Offroad_ConnectivityNeeded"]->text().isEmpty()); snooze_btn->setVisible(!alerts["Offroad_ConnectivityNeeded"]->text().isEmpty()); return alertCount; } diff --git a/selfdrive/ui/qt/widgets/offroad_alerts.h b/selfdrive/ui/qt/widgets/offroad_alerts.h index ace2e75..abeafd2 100644 --- a/selfdrive/ui/qt/widgets/offroad_alerts.h +++ b/selfdrive/ui/qt/widgets/offroad_alerts.h @@ -15,6 +15,7 @@ class AbstractAlert : public QFrame { protected: AbstractAlert(bool hasRebootBtn, QWidget *parent = nullptr); + QPushButton *disable_check_btn; QPushButton *snooze_btn; QVBoxLayout *scrollable_layout; Params params; diff --git a/selfdrive/updated/updated.py b/selfdrive/updated/updated.py index bd16024..7d66332 100644 --- a/selfdrive/updated/updated.py +++ b/selfdrive/updated/updated.py @@ -329,6 +329,8 @@ class Updater: set_offroad_alert(alert, False) now = datetime.datetime.utcnow() + if FrogPilotVariables.toggles.offline_mode: + last_update = now dt = now - last_update if failed_count > 15 and exception is not None and self.has_internet: if is_tested_branch():