don't go onroad if internet needed (#19572)

albatross
Adeeb Shihadeh 2020-12-21 15:13:20 -08:00 committed by GitHub
parent a56bbe1671
commit 41b31a1756
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 13 deletions

View File

@ -70,11 +70,9 @@ class Controls:
params = Params()
self.is_metric = params.get("IsMetric", encoding='utf8') == "1"
self.is_ldw_enabled = params.get("IsLdwEnabled", encoding='utf8') == "1"
internet_needed = (params.get("Offroad_ConnectivityNeeded", encoding='utf8') is not None) and (params.get("DisableUpdates") != b"1")
community_feature_toggle = params.get("CommunityFeaturesToggle", encoding='utf8') == "1"
openpilot_enabled_toggle = params.get("OpenpilotEnabledToggle", encoding='utf8') == "1"
passive = params.get("Passive", encoding='utf8') == "1" or \
internet_needed or not openpilot_enabled_toggle
passive = params.get("Passive", encoding='utf8') == "1" or not openpilot_enabled_toggle
# detect sound card presence and ensure successful init
sounds_available = HARDWARE.get_sound_card_online()
@ -133,8 +131,6 @@ class Controls:
if not sounds_available:
self.events.add(EventName.soundsUnavailable, static=True)
if internet_needed:
self.events.add(EventName.internetConnectivityNeeded, static=True)
if community_feature_disallowed:
self.events.add(EventName.communityFeatureDisallowed, static=True)
if not car_recognized:

View File

@ -13,7 +13,7 @@
"_comment": "Append the number of days at the end of the text"
},
"Offroad_ConnectivityNeeded": {
"text": "Connect to internet to check for updates. openpilot won't engage until it connects to internet to check for updates.",
"text": "Connect to internet to check for updates. openpilot won't start until it connects to internet to check for updates.",
"severity": 1
},
"Offroad_UpdateFailed": {

View File

@ -211,6 +211,8 @@ def wrong_car_mode_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: boo
EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, bool], Alert]]]] = {
# ********** events with no alerts **********
EventName.internetConnectivityNeeded: {},
# ********** events only containing alerts displayed in all states **********
EventName.debugAlert: {
@ -743,13 +745,6 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo
Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.),
},
# TODO: this is unclear, update check only happens offroad
EventName.internetConnectivityNeeded: {
ET.PERMANENT: NormalPermanentAlert("Connect to Internet", "An Update Check Is Required to Engage"),
ET.NO_ENTRY: NoEntryAlert("Connect to Internet",
audible_alert=AudibleAlert.chimeDisengage),
},
EventName.lowSpeedLockout: {
ET.PERMANENT: Alert(
"Cruise Fault: Restart the car to engage",

View File

@ -341,6 +341,7 @@ def thermald_thread():
set_offroad_alert_if_changed("Offroad_ConnectivityNeeded", False)
set_offroad_alert_if_changed("Offroad_ConnectivityNeededPrompt", False)
startup_conditions["up_to_date"] = params.get("Offroad_ConnectivityNeeded") is None or params.get("DisableUpdates") == b"1"
startup_conditions["not_uninstalling"] = not params.get("DoUninstall") == b"1"
startup_conditions["accepted_terms"] = params.get("HasAcceptedTerms") == terms_version