Allow device to be offline indefinitely
Added button to allow the device to be offline indefinitely.
This commit is contained in:
@@ -219,6 +219,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
|||||||
{"GasRegenCmd", PERSISTENT},
|
{"GasRegenCmd", PERSISTENT},
|
||||||
{"LateralTune", PERSISTENT},
|
{"LateralTune", PERSISTENT},
|
||||||
{"LongitudinalTune", PERSISTENT},
|
{"LongitudinalTune", PERSISTENT},
|
||||||
|
{"OfflineMode", PERSISTENT},
|
||||||
{"Updated", PERSISTENT},
|
{"Updated", PERSISTENT},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ def thermald_thread(end_event, hw_queue) -> None:
|
|||||||
startup_conditions["time_valid"] = now > MIN_DATE
|
startup_conditions["time_valid"] = now > MIN_DATE
|
||||||
set_offroad_alert_if_changed("Offroad_InvalidTime", (not startup_conditions["time_valid"]) and peripheral_panda_present)
|
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["not_uninstalling"] = not params.get_bool("DoUninstall")
|
||||||
startup_conditions["accepted_terms"] = params.get("HasAcceptedTerms") == terms_version
|
startup_conditions["accepted_terms"] = params.get("HasAcceptedTerms") == terms_version
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,17 @@ AbstractAlert::AbstractAlert(bool hasRebootBtn, QWidget *parent) : QFrame(parent
|
|||||||
footer_layout->addWidget(dismiss_btn, 0, Qt::AlignBottom | Qt::AlignLeft);
|
footer_layout->addWidget(dismiss_btn, 0, Qt::AlignBottom | Qt::AlignLeft);
|
||||||
QObject::connect(dismiss_btn, &QPushButton::clicked, this, &AbstractAlert::dismiss);
|
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 = new QPushButton(tr("Snooze Update"));
|
||||||
snooze_btn->setVisible(false);
|
snooze_btn->setVisible(false);
|
||||||
snooze_btn->setFixedSize(550, 125);
|
snooze_btn->setFixedSize(550, 125);
|
||||||
@@ -107,6 +118,7 @@ int OffroadAlert::refresh() {
|
|||||||
label->setVisible(!text.isEmpty());
|
label->setVisible(!text.isEmpty());
|
||||||
alertCount += !text.isEmpty();
|
alertCount += !text.isEmpty();
|
||||||
}
|
}
|
||||||
|
disable_check_btn->setVisible(!alerts["Offroad_ConnectivityNeeded"]->text().isEmpty());
|
||||||
snooze_btn->setVisible(!alerts["Offroad_ConnectivityNeeded"]->text().isEmpty());
|
snooze_btn->setVisible(!alerts["Offroad_ConnectivityNeeded"]->text().isEmpty());
|
||||||
return alertCount;
|
return alertCount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ class AbstractAlert : public QFrame {
|
|||||||
protected:
|
protected:
|
||||||
AbstractAlert(bool hasRebootBtn, QWidget *parent = nullptr);
|
AbstractAlert(bool hasRebootBtn, QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
QPushButton *disable_check_btn;
|
||||||
QPushButton *snooze_btn;
|
QPushButton *snooze_btn;
|
||||||
QVBoxLayout *scrollable_layout;
|
QVBoxLayout *scrollable_layout;
|
||||||
Params params;
|
Params params;
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ def finalize_update() -> None:
|
|||||||
# FrogPilot update functions
|
# FrogPilot update functions
|
||||||
params = Params()
|
params = Params()
|
||||||
params.put("Updated", datetime.datetime.now().astimezone(ZoneInfo('America/Phoenix')).strftime("%B %d, %Y - %I:%M%p"))
|
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:
|
def handle_agnos_update() -> None:
|
||||||
from openpilot.system.hardware.tici.agnos import flash_agnos_update, get_target_slot_number
|
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
|
self._has_internet: bool = False
|
||||||
|
|
||||||
# FrogPilot variables
|
# FrogPilot variables
|
||||||
|
self.disable_internet_check = self.params.get_bool("OfflineMode")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def has_internet(self) -> bool:
|
def has_internet(self) -> bool:
|
||||||
@@ -318,6 +320,8 @@ class Updater:
|
|||||||
set_offroad_alert(alert, False)
|
set_offroad_alert(alert, False)
|
||||||
|
|
||||||
now = datetime.datetime.utcnow()
|
now = datetime.datetime.utcnow()
|
||||||
|
if self.disable_internet_check:
|
||||||
|
last_update = now
|
||||||
dt = now - last_update
|
dt = now - last_update
|
||||||
if failed_count > 15 and exception is not None and self.has_internet:
|
if failed_count > 15 and exception is not None and self.has_internet:
|
||||||
if is_tested_branch():
|
if is_tested_branch():
|
||||||
|
|||||||
Reference in New Issue
Block a user