diff --git a/common/params.cc b/common/params.cc index 8dac8b7..3b5dd72 100644 --- a/common/params.cc +++ b/common/params.cc @@ -219,6 +219,7 @@ std::unordered_map keys = { {"GasRegenCmd", PERSISTENT}, {"LateralTune", PERSISTENT}, {"LongitudinalTune", PERSISTENT}, + {"OfflineMode", PERSISTENT}, {"Updated", PERSISTENT}, }; diff --git a/selfdrive/thermald/thermald.py b/selfdrive/thermald/thermald.py index 9280225..3854c53 100755 --- a/selfdrive/thermald/thermald.py +++ b/selfdrive/thermald/thermald.py @@ -302,7 +302,7 @@ def thermald_thread(end_event, hw_queue) -> None: startup_conditions["time_valid"] = now > MIN_DATE set_offroad_alert_if_changed("Offroad_InvalidTime", (not startup_conditions["time_valid"]) and peripheral_panda_present) - 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("OfflineMode") or params.get("Offroad_ConnectivityNeeded") is None or params.get_bool("DisableUpdates") or params.get_bool("SnoozeUpdate") 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..b5140cd 100644 --- a/selfdrive/ui/qt/widgets/offroad_alerts.cc +++ b/selfdrive/ui/qt/widgets/offroad_alerts.cc @@ -32,6 +32,17 @@ 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("OfflineMode", true); + Hardware::reboot(); + }); + 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 +118,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.py b/selfdrive/updated.py index e5a6bb3..a8ac2d6 100755 --- a/selfdrive/updated.py +++ b/selfdrive/updated.py @@ -194,6 +194,7 @@ def finalize_update() -> None: # FrogPilot update functions params = Params() params.put("Updated", datetime.datetime.now().astimezone(ZoneInfo('America/Phoenix')).strftime("%B %d, %Y - %I:%M%p")) + params.remove("OfflineMode") # Reset the param since the user has internet connection again def handle_agnos_update() -> None: from openpilot.system.hardware.tici.agnos import flash_agnos_update, get_target_slot_number @@ -226,6 +227,7 @@ class Updater: self._has_internet: bool = False # FrogPilot variables + self.disable_internet_check = self.params.get_bool("OfflineMode") @property def has_internet(self) -> bool: @@ -318,6 +320,8 @@ class Updater: set_offroad_alert(alert, False) now = datetime.datetime.utcnow() + if self.disable_internet_check: + last_update = now dt = now - last_update if failed_count > 15 and exception is not None and self.has_internet: if is_tested_branch():