diff --git a/selfdrive/boardd/boardd.cc b/selfdrive/boardd/boardd.cc index 4d241f2e2f..cad2305cde 100644 --- a/selfdrive/boardd/boardd.cc +++ b/selfdrive/boardd/boardd.cc @@ -476,13 +476,13 @@ void panda_state_thread(std::vector pandas, bool spoofing_started) { RateKeeper rk("panda_state_thread", 10); while (!do_exit && check_all_connected(pandas)) { + auto ignition_opt = send_panda_states(&pm, pandas, spoofing_started); + if (sm.frame % 5 == 0) { // send out peripheralState at 2Hz send_peripheral_state(&pm, peripheral_panda); } - auto ignition_opt = send_panda_states(&pm, pandas, spoofing_started); - if (!ignition_opt) { LOGE("Failed to get ignition_opt"); rk.keepTime(); diff --git a/selfdrive/thermald/thermald.py b/selfdrive/thermald/thermald.py index 97a0c08c03..bad5318b0f 100755 --- a/selfdrive/thermald/thermald.py +++ b/selfdrive/thermald/thermald.py @@ -34,7 +34,7 @@ NetworkStrength = log.DeviceState.NetworkStrength CURRENT_TAU = 15. # 15s time constant TEMP_TAU = 5. # 5s time constant DISCONNECT_TIMEOUT = 5. # wait 5 seconds before going offroad after disconnect so you get an alert -PANDA_STATES_TIMEOUT = round(1000 / service_list['pandaStates'].frequency * 1.5) # 1.5x the expected pandaState frequency +PERIPHERAL_STATE_TIMEOUT = round(1000 / service_list['peripheralState'].frequency * 1.5) # 1.5x the expected peripheralState frequency ThermalBand = namedtuple("ThermalBand", ['min_temp', 'max_temp']) HardwareState = namedtuple("HardwareState", ['network_type', 'network_info', 'network_strength', 'network_stats', @@ -168,7 +168,7 @@ def hw_state_thread(end_event, hw_queue): def thermald_thread(end_event, hw_queue) -> None: pm = messaging.PubMaster(['deviceState']) - sm = messaging.SubMaster(["peripheralState", "gpsLocationExternal", "controlsState", "pandaStates"], poll=["pandaStates"]) + sm = messaging.SubMaster(["peripheralState", "gpsLocationExternal", "controlsState", "pandaStates"], poll=["peripheralState"]) count = 0 @@ -209,11 +209,7 @@ def thermald_thread(end_event, hw_queue) -> None: fan_controller = None while not end_event.is_set(): - sm.update(PANDA_STATES_TIMEOUT) - - # Run at 2Hz - if sm.frame % round(service_list['pandaStates'].frequency * DT_TRML) != 0: - continue + sm.update(PERIPHERAL_STATE_TIMEOUT) pandaStates = sm['pandaStates'] peripheralState = sm['peripheralState']