thermald: prevent started cycling too quickly (#25971)

* thermald: prevent started cycling too quickly

* move that

* fix logging and no wait after boot

Co-authored-by: Comma Device <device@comma.ai>
pull/25976/head
Adeeb Shihadeh 3 years ago committed by GitHub
parent 7ed064f7ba
commit f2859b3be5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      selfdrive/thermald/thermald.py

@ -278,6 +278,7 @@ def thermald_thread(end_event, hw_queue):
startup_conditions["up_to_date"] = 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
startup_conditions["offroad_min_time"] = (not started_seen) or ((off_ts is not None) and (sec_since_boot() - off_ts) > 5.)
# with 2% left, we killall, otherwise the phone will take a long time to boot
startup_conditions["free_space"] = msg.deviceState.freeSpacePercent > 2
@ -338,7 +339,8 @@ def thermald_thread(end_event, hw_queue):
started_seen = True
else:
if onroad_conditions["ignition"] and (startup_conditions != startup_conditions_prev):
cloudlog.event("Startup blocked", startup_conditions=startup_conditions, onroad_conditions=onroad_conditions)
cloudlog.event("Startup blocked", startup_conditions=startup_conditions, onroad_conditions=onroad_conditions, error=True)
startup_conditions_prev = startup_conditions.copy()
started_ts = None
if off_ts is None:
@ -372,7 +374,6 @@ def thermald_thread(end_event, hw_queue):
pm.send("deviceState", msg)
should_start_prev = should_start
startup_conditions_prev = startup_conditions.copy()
# Log to statsd
statlog.gauge("free_space_percent", msg.deviceState.freeSpacePercent)

Loading…
Cancel
Save