|
|
@ -17,7 +17,7 @@ from common.dict_helpers import strip_deprecated_keys |
|
|
|
from common.time import MIN_DATE |
|
|
|
from common.time import MIN_DATE |
|
|
|
from common.filter_simple import FirstOrderFilter |
|
|
|
from common.filter_simple import FirstOrderFilter |
|
|
|
from common.params import Params |
|
|
|
from common.params import Params |
|
|
|
from common.realtime import DT_TRML, sec_since_boot |
|
|
|
from common.realtime import DT_TRML |
|
|
|
from selfdrive.controls.lib.alertmanager import set_offroad_alert |
|
|
|
from selfdrive.controls.lib.alertmanager import set_offroad_alert |
|
|
|
from system.hardware import HARDWARE, TICI, AGNOS |
|
|
|
from system.hardware import HARDWARE, TICI, AGNOS |
|
|
|
from system.loggerd.config import get_available_percent |
|
|
|
from system.loggerd.config import get_available_percent |
|
|
@ -230,7 +230,7 @@ def thermald_thread(end_event, hw_queue): |
|
|
|
if TICI: |
|
|
|
if TICI: |
|
|
|
fan_controller = TiciFanController() |
|
|
|
fan_controller = TiciFanController() |
|
|
|
|
|
|
|
|
|
|
|
elif (sec_since_boot() - sm.rcv_time['pandaStates']) > DISCONNECT_TIMEOUT: |
|
|
|
elif (time.monotonic() - sm.rcv_time['pandaStates']) > DISCONNECT_TIMEOUT: |
|
|
|
if onroad_conditions["ignition"]: |
|
|
|
if onroad_conditions["ignition"]: |
|
|
|
onroad_conditions["ignition"] = False |
|
|
|
onroad_conditions["ignition"] = False |
|
|
|
cloudlog.error("panda timed out onroad") |
|
|
|
cloudlog.error("panda timed out onroad") |
|
|
@ -273,7 +273,7 @@ def thermald_thread(end_event, hw_queue): |
|
|
|
if fan_controller is not None: |
|
|
|
if fan_controller is not None: |
|
|
|
msg.deviceState.fanSpeedPercentDesired = fan_controller.update(all_comp_temp, onroad_conditions["ignition"]) |
|
|
|
msg.deviceState.fanSpeedPercentDesired = fan_controller.update(all_comp_temp, onroad_conditions["ignition"]) |
|
|
|
|
|
|
|
|
|
|
|
is_offroad_for_5_min = (started_ts is None) and ((not started_seen) or (off_ts is None) or (sec_since_boot() - off_ts > 60 * 5)) |
|
|
|
is_offroad_for_5_min = (started_ts is None) and ((not started_seen) or (off_ts is None) or (time.monotonic() - off_ts > 60 * 5)) |
|
|
|
if is_offroad_for_5_min and offroad_comp_temp > OFFROAD_DANGER_TEMP: |
|
|
|
if is_offroad_for_5_min and offroad_comp_temp > OFFROAD_DANGER_TEMP: |
|
|
|
# if device is offroad and already hot without the extra onroad load, |
|
|
|
# if device is offroad and already hot without the extra onroad load, |
|
|
|
# we want to cool down first before increasing load |
|
|
|
# we want to cool down first before increasing load |
|
|
@ -354,10 +354,10 @@ def thermald_thread(end_event, hw_queue): |
|
|
|
if should_start: |
|
|
|
if should_start: |
|
|
|
off_ts = None |
|
|
|
off_ts = None |
|
|
|
if started_ts is None: |
|
|
|
if started_ts is None: |
|
|
|
started_ts = sec_since_boot() |
|
|
|
started_ts = time.monotonic() |
|
|
|
started_seen = True |
|
|
|
started_seen = True |
|
|
|
if startup_blocked_ts is not None: |
|
|
|
if startup_blocked_ts is not None: |
|
|
|
cloudlog.event("Startup after block", block_duration=(sec_since_boot() - startup_blocked_ts), |
|
|
|
cloudlog.event("Startup after block", block_duration=(time.monotonic() - startup_blocked_ts), |
|
|
|
startup_conditions=startup_conditions, onroad_conditions=onroad_conditions, |
|
|
|
startup_conditions=startup_conditions, onroad_conditions=onroad_conditions, |
|
|
|
startup_conditions_prev=startup_conditions_prev, error=True) |
|
|
|
startup_conditions_prev=startup_conditions_prev, error=True) |
|
|
|
startup_blocked_ts = None |
|
|
|
startup_blocked_ts = None |
|
|
@ -365,11 +365,11 @@ def thermald_thread(end_event, hw_queue): |
|
|
|
if onroad_conditions["ignition"] and (startup_conditions != startup_conditions_prev): |
|
|
|
if onroad_conditions["ignition"] and (startup_conditions != startup_conditions_prev): |
|
|
|
cloudlog.event("Startup blocked", startup_conditions=startup_conditions, onroad_conditions=onroad_conditions, error=True) |
|
|
|
cloudlog.event("Startup blocked", startup_conditions=startup_conditions, onroad_conditions=onroad_conditions, error=True) |
|
|
|
startup_conditions_prev = startup_conditions.copy() |
|
|
|
startup_conditions_prev = startup_conditions.copy() |
|
|
|
startup_blocked_ts = sec_since_boot() |
|
|
|
startup_blocked_ts = time.monotonic() |
|
|
|
|
|
|
|
|
|
|
|
started_ts = None |
|
|
|
started_ts = None |
|
|
|
if off_ts is None: |
|
|
|
if off_ts is None: |
|
|
|
off_ts = sec_since_boot() |
|
|
|
off_ts = time.monotonic() |
|
|
|
|
|
|
|
|
|
|
|
# Offroad power monitoring |
|
|
|
# Offroad power monitoring |
|
|
|
voltage = None if peripheralState.pandaType == log.PandaState.PandaType.unknown else peripheralState.voltage |
|
|
|
voltage = None if peripheralState.pandaType == log.PandaState.PandaType.unknown else peripheralState.voltage |
|
|
|