|
|
@ -154,6 +154,7 @@ def thermald_thread(): |
|
|
|
pandaState_timeout = int(1000 * 2.5 * DT_TRML) # 2.5x the expected pandaState frequency |
|
|
|
pandaState_timeout = int(1000 * 2.5 * DT_TRML) # 2.5x the expected pandaState frequency |
|
|
|
pandaState_sock = messaging.sub_sock('pandaState', timeout=pandaState_timeout) |
|
|
|
pandaState_sock = messaging.sub_sock('pandaState', timeout=pandaState_timeout) |
|
|
|
location_sock = messaging.sub_sock('gpsLocationExternal') |
|
|
|
location_sock = messaging.sub_sock('gpsLocationExternal') |
|
|
|
|
|
|
|
managerState_sock = messaging.sub_sock('managerState', conflate=True) |
|
|
|
|
|
|
|
|
|
|
|
fan_speed = 0 |
|
|
|
fan_speed = 0 |
|
|
|
count = 0 |
|
|
|
count = 0 |
|
|
@ -179,6 +180,7 @@ def thermald_thread(): |
|
|
|
should_start_prev = False |
|
|
|
should_start_prev = False |
|
|
|
handle_fan = None |
|
|
|
handle_fan = None |
|
|
|
is_uno = False |
|
|
|
is_uno = False |
|
|
|
|
|
|
|
ui_running_prev = False |
|
|
|
|
|
|
|
|
|
|
|
params = Params() |
|
|
|
params = Params() |
|
|
|
power_monitor = PowerMonitoring() |
|
|
|
power_monitor = PowerMonitoring() |
|
|
@ -383,6 +385,14 @@ def thermald_thread(): |
|
|
|
time.sleep(10) |
|
|
|
time.sleep(10) |
|
|
|
HARDWARE.shutdown() |
|
|
|
HARDWARE.shutdown() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If UI has crashed, set the brightness to reasonable non-zero value |
|
|
|
|
|
|
|
manager_state = messaging.recv_one_or_none(managerState_sock) |
|
|
|
|
|
|
|
if manager_state is not None: |
|
|
|
|
|
|
|
ui_running = "ui" in (p.name for p in manager_state.managerState.processes if p.running) |
|
|
|
|
|
|
|
if ui_running_prev and not ui_running: |
|
|
|
|
|
|
|
HARDWARE.set_screen_brightness(20) |
|
|
|
|
|
|
|
ui_running_prev = ui_running |
|
|
|
|
|
|
|
|
|
|
|
msg.deviceState.chargingError = current_filter.x > 0. and msg.deviceState.batteryPercent < 90 # if current is positive, then battery is being discharged |
|
|
|
msg.deviceState.chargingError = current_filter.x > 0. and msg.deviceState.batteryPercent < 90 # if current is positive, then battery is being discharged |
|
|
|
msg.deviceState.started = started_ts is not None |
|
|
|
msg.deviceState.started = started_ts is not None |
|
|
|
msg.deviceState.startedMonoTime = int(1e9*(started_ts or 0)) |
|
|
|
msg.deviceState.startedMonoTime = int(1e9*(started_ts or 0)) |
|
|
|