Offline Mode
Added button and toggle to allow the device to be offline indefinitely.
This commit is contained in:
@@ -316,6 +316,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
|||||||
{"NoUploads", PERSISTENT},
|
{"NoUploads", PERSISTENT},
|
||||||
{"NudgelessLaneChange", PERSISTENT},
|
{"NudgelessLaneChange", PERSISTENT},
|
||||||
{"NumericalTemp", PERSISTENT},
|
{"NumericalTemp", PERSISTENT},
|
||||||
|
{"OfflineMode", PERSISTENT},
|
||||||
{"OneLaneChange", PERSISTENT},
|
{"OneLaneChange", PERSISTENT},
|
||||||
{"PathEdgeWidth", PERSISTENT},
|
{"PathEdgeWidth", PERSISTENT},
|
||||||
{"PathWidth", PERSISTENT},
|
{"PathWidth", PERSISTENT},
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil
|
|||||||
{"MuteOverheated", "Bypass Thermal Safety Limits", "Allow the device to run at any temperature even above comma's recommended thermal limits.", ""},
|
{"MuteOverheated", "Bypass Thermal Safety Limits", "Allow the device to run at any temperature even above comma's recommended thermal limits.", ""},
|
||||||
{"NoLogging", "Disable Logging", "Turn off all data tracking to enhance privacy or reduce thermal load.\n\nWARNING: This action will prevent drive recording and data cannot be recovered!", ""},
|
{"NoLogging", "Disable Logging", "Turn off all data tracking to enhance privacy or reduce thermal load.\n\nWARNING: This action will prevent drive recording and data cannot be recovered!", ""},
|
||||||
{"NoUploads", "Disable Uploads", "Turn off all data uploads to comma's servers.\n\nWARNING: This action will prevent your drives from appearing on comma connect which may impact debugging and support!", ""},
|
{"NoUploads", "Disable Uploads", "Turn off all data uploads to comma's servers.\n\nWARNING: This action will prevent your drives from appearing on comma connect which may impact debugging and support!", ""},
|
||||||
|
{"OfflineMode", "Offline Mode", "Allow the device to be offline indefinitely.", ""},
|
||||||
|
|
||||||
{"LateralTune", "Lateral Tuning", "Modify openpilot's steering behavior.", "../frogpilot/assets/toggle_icons/icon_lateral_tune.png"},
|
{"LateralTune", "Lateral Tuning", "Modify openpilot's steering behavior.", "../frogpilot/assets/toggle_icons/icon_lateral_tune.png"},
|
||||||
{"ForceAutoTune", "Force Auto Tune", "Forces comma's auto lateral tuning for unsupported vehicles.", ""},
|
{"ForceAutoTune", "Force Auto Tune", "Forces comma's auto lateral tuning for unsupported vehicles.", ""},
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ private:
|
|||||||
|
|
||||||
std::set<QString> conditionalExperimentalKeys = {"CECurves", "CECurvesLead", "CESlowerLead", "CENavigation", "CEStopLights", "CESignal"};
|
std::set<QString> conditionalExperimentalKeys = {"CECurves", "CECurvesLead", "CESlowerLead", "CENavigation", "CEStopLights", "CESignal"};
|
||||||
std::set<QString> experimentalModeActivationKeys = {"ExperimentalModeViaDistance", "ExperimentalModeViaLKAS", "ExperimentalModeViaScreen"};
|
std::set<QString> experimentalModeActivationKeys = {"ExperimentalModeViaDistance", "ExperimentalModeViaLKAS", "ExperimentalModeViaScreen"};
|
||||||
std::set<QString> fireTheBabysitterKeys = {"NoLogging", "MuteOverheated", "NoUploads"};
|
std::set<QString> fireTheBabysitterKeys = {"NoLogging", "MuteOverheated", "NoUploads", "OfflineMode"};
|
||||||
std::set<QString> laneChangeKeys = {"LaneChangeTime", "LaneDetection", "LaneDetectionWidth", "OneLaneChange"};
|
std::set<QString> laneChangeKeys = {"LaneChangeTime", "LaneDetection", "LaneDetectionWidth", "OneLaneChange"};
|
||||||
std::set<QString> lateralTuneKeys = {"ForceAutoTune", "NNFF"};
|
std::set<QString> lateralTuneKeys = {"ForceAutoTune", "NNFF"};
|
||||||
std::set<QString> longitudinalTuneKeys = {"AccelerationProfile", "DecelerationProfile", "AggressiveAcceleration", "StoppingDistance"};
|
std::set<QString> longitudinalTuneKeys = {"AccelerationProfile", "DecelerationProfile", "AggressiveAcceleration", "StoppingDistance"};
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ def thermald_thread(end_event, hw_queue) -> None:
|
|||||||
|
|
||||||
# **** starting logic ****
|
# **** 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("OfflineMode") and params.get("FireTheBabysitter")) 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,18 @@ 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("SnoozeUpdate", true);
|
||||||
|
params.putBool("OfflineMode", true);
|
||||||
|
params.putBool("FiredTheBabysitter", 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 = 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 +119,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;
|
||||||
|
|||||||
@@ -238,6 +238,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") and self.params.get_bool("FireTheBabysitter")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def has_internet(self) -> bool:
|
def has_internet(self) -> bool:
|
||||||
@@ -327,6 +328,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