thermald: remove panda disconnect logic (#23526)
* thermald: remove panda disconnect logic * keep thatpull/23529/head
parent
e72eb1d472
commit
ed23177898
|
@ -8,7 +8,6 @@ cdef extern from "selfdrive/common/params.h":
|
||||||
cpdef enum ParamKeyType:
|
cpdef enum ParamKeyType:
|
||||||
PERSISTENT
|
PERSISTENT
|
||||||
CLEAR_ON_MANAGER_START
|
CLEAR_ON_MANAGER_START
|
||||||
CLEAR_ON_PANDA_DISCONNECT
|
|
||||||
CLEAR_ON_IGNITION_ON
|
CLEAR_ON_IGNITION_ON
|
||||||
CLEAR_ON_IGNITION_OFF
|
CLEAR_ON_IGNITION_OFF
|
||||||
ALL
|
ALL
|
||||||
|
|
|
@ -24,14 +24,6 @@ class TestParams(unittest.TestCase):
|
||||||
self.params.put("CarParams", st)
|
self.params.put("CarParams", st)
|
||||||
assert self.params.get("CarParams") == st
|
assert self.params.get("CarParams") == st
|
||||||
|
|
||||||
def test_params_get_cleared_panda_disconnect(self):
|
|
||||||
self.params.put("CarParams", "test")
|
|
||||||
self.params.put("DongleId", "cb38263377b873ee")
|
|
||||||
assert self.params.get("CarParams") == b"test"
|
|
||||||
self.params.clear_all(ParamKeyType.CLEAR_ON_PANDA_DISCONNECT)
|
|
||||||
assert self.params.get("CarParams") is None
|
|
||||||
assert self.params.get("DongleId") is not None
|
|
||||||
|
|
||||||
def test_params_get_cleared_manager_start(self):
|
def test_params_get_cleared_manager_start(self):
|
||||||
self.params.put("CarParams", "test")
|
self.params.put("CarParams", "test")
|
||||||
self.params.put("DongleId", "cb38263377b873ee")
|
self.params.put("DongleId", "cb38263377b873ee")
|
||||||
|
|
|
@ -88,12 +88,12 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||||
{"AthenadUploadQueue", PERSISTENT},
|
{"AthenadUploadQueue", PERSISTENT},
|
||||||
{"CalibrationParams", PERSISTENT},
|
{"CalibrationParams", PERSISTENT},
|
||||||
{"CarBatteryCapacity", PERSISTENT},
|
{"CarBatteryCapacity", PERSISTENT},
|
||||||
{"CarParams", CLEAR_ON_MANAGER_START | CLEAR_ON_PANDA_DISCONNECT | CLEAR_ON_IGNITION_ON},
|
{"CarParams", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
|
||||||
{"CarParamsCache", CLEAR_ON_MANAGER_START | CLEAR_ON_PANDA_DISCONNECT},
|
{"CarParamsCache", CLEAR_ON_MANAGER_START},
|
||||||
{"CarVin", CLEAR_ON_MANAGER_START | CLEAR_ON_PANDA_DISCONNECT | CLEAR_ON_IGNITION_ON},
|
{"CarVin", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
|
||||||
{"CommunityFeaturesToggle", PERSISTENT},
|
{"CommunityFeaturesToggle", PERSISTENT},
|
||||||
{"CompletedTrainingVersion", PERSISTENT},
|
{"CompletedTrainingVersion", PERSISTENT},
|
||||||
{"ControlsReady", CLEAR_ON_MANAGER_START | CLEAR_ON_PANDA_DISCONNECT | CLEAR_ON_IGNITION_ON},
|
{"ControlsReady", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
|
||||||
{"CurrentRoute", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
|
{"CurrentRoute", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
|
||||||
{"DisablePowerDown", PERSISTENT},
|
{"DisablePowerDown", PERSISTENT},
|
||||||
{"DisableRadar_Allow", PERSISTENT},
|
{"DisableRadar_Allow", PERSISTENT},
|
||||||
|
@ -163,7 +163,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||||
{"ApiCache_NavDestinations", PERSISTENT},
|
{"ApiCache_NavDestinations", PERSISTENT},
|
||||||
{"ApiCache_Owner", PERSISTENT},
|
{"ApiCache_Owner", PERSISTENT},
|
||||||
{"Offroad_CarUnrecognized", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
|
{"Offroad_CarUnrecognized", CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON},
|
||||||
{"Offroad_ChargeDisabled", CLEAR_ON_MANAGER_START | CLEAR_ON_PANDA_DISCONNECT},
|
{"Offroad_ChargeDisabled", CLEAR_ON_MANAGER_START },
|
||||||
{"Offroad_ConnectivityNeeded", CLEAR_ON_MANAGER_START},
|
{"Offroad_ConnectivityNeeded", CLEAR_ON_MANAGER_START},
|
||||||
{"Offroad_ConnectivityNeededPrompt", CLEAR_ON_MANAGER_START},
|
{"Offroad_ConnectivityNeededPrompt", CLEAR_ON_MANAGER_START},
|
||||||
{"Offroad_InvalidTime", CLEAR_ON_MANAGER_START},
|
{"Offroad_InvalidTime", CLEAR_ON_MANAGER_START},
|
||||||
|
|
|
@ -6,10 +6,9 @@
|
||||||
enum ParamKeyType {
|
enum ParamKeyType {
|
||||||
PERSISTENT = 0x02,
|
PERSISTENT = 0x02,
|
||||||
CLEAR_ON_MANAGER_START = 0x04,
|
CLEAR_ON_MANAGER_START = 0x04,
|
||||||
CLEAR_ON_PANDA_DISCONNECT = 0x08,
|
CLEAR_ON_IGNITION_ON = 0x08,
|
||||||
CLEAR_ON_IGNITION_ON = 0x10,
|
CLEAR_ON_IGNITION_OFF = 0x10,
|
||||||
CLEAR_ON_IGNITION_OFF = 0x20,
|
DONT_LOG = 0x20,
|
||||||
DONT_LOG = 0x40,
|
|
||||||
ALL = 0xFFFFFFFF
|
ALL = 0xFFFFFFFF
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import cereal.messaging as messaging
|
||||||
from cereal import log
|
from cereal import log
|
||||||
from common.filter_simple import FirstOrderFilter
|
from common.filter_simple import FirstOrderFilter
|
||||||
from common.numpy_fast import interp
|
from common.numpy_fast import interp
|
||||||
from common.params import Params, ParamKeyType
|
from common.params import Params
|
||||||
from common.realtime import DT_TRML, sec_since_boot
|
from common.realtime import DT_TRML, sec_since_boot
|
||||||
from common.dict_helpers import strip_deprecated_keys
|
from common.dict_helpers import strip_deprecated_keys
|
||||||
from selfdrive.controls.lib.alertmanager import set_offroad_alert
|
from selfdrive.controls.lib.alertmanager import set_offroad_alert
|
||||||
|
@ -185,7 +185,6 @@ def thermald_thread() -> NoReturn:
|
||||||
|
|
||||||
current_filter = FirstOrderFilter(0., CURRENT_TAU, DT_TRML)
|
current_filter = FirstOrderFilter(0., CURRENT_TAU, DT_TRML)
|
||||||
temp_filter = FirstOrderFilter(0., TEMP_TAU, DT_TRML)
|
temp_filter = FirstOrderFilter(0., TEMP_TAU, DT_TRML)
|
||||||
pandaState_prev = None
|
|
||||||
should_start_prev = False
|
should_start_prev = False
|
||||||
in_car = False
|
in_car = False
|
||||||
handle_fan = None
|
handle_fan = None
|
||||||
|
@ -194,7 +193,6 @@ def thermald_thread() -> NoReturn:
|
||||||
|
|
||||||
params = Params()
|
params = Params()
|
||||||
power_monitor = PowerMonitoring()
|
power_monitor = PowerMonitoring()
|
||||||
no_panda_cnt = 0
|
|
||||||
|
|
||||||
HARDWARE.initialize_hardware()
|
HARDWARE.initialize_hardware()
|
||||||
thermal_config = HARDWARE.get_thermal_config()
|
thermal_config = HARDWARE.get_thermal_config()
|
||||||
|
@ -213,15 +211,7 @@ def thermald_thread() -> NoReturn:
|
||||||
if pandaStates is not None and len(pandaStates.pandaStates) > 0:
|
if pandaStates is not None and len(pandaStates.pandaStates) > 0:
|
||||||
pandaState = pandaStates.pandaStates[0]
|
pandaState = pandaStates.pandaStates[0]
|
||||||
|
|
||||||
# If we lose connection to the panda, wait 5 seconds before going offroad
|
if pandaState.pandaType != log.PandaState.PandaType.unknown:
|
||||||
if pandaState.pandaType == log.PandaState.PandaType.unknown:
|
|
||||||
no_panda_cnt += 1
|
|
||||||
if no_panda_cnt > DISCONNECT_TIMEOUT / DT_TRML:
|
|
||||||
if onroad_conditions["ignition"]:
|
|
||||||
cloudlog.error("Lost panda connection while onroad")
|
|
||||||
onroad_conditions["ignition"] = False
|
|
||||||
else:
|
|
||||||
no_panda_cnt = 0
|
|
||||||
onroad_conditions["ignition"] = pandaState.ignitionLine or pandaState.ignitionCan
|
onroad_conditions["ignition"] = pandaState.ignitionLine or pandaState.ignitionCan
|
||||||
|
|
||||||
in_car = pandaState.harnessStatus != log.PandaState.HarnessStatus.notConnected
|
in_car = pandaState.harnessStatus != log.PandaState.HarnessStatus.notConnected
|
||||||
|
@ -242,13 +232,6 @@ def thermald_thread() -> NoReturn:
|
||||||
setup_eon_fan()
|
setup_eon_fan()
|
||||||
handle_fan = handle_fan_eon
|
handle_fan = handle_fan_eon
|
||||||
|
|
||||||
# Handle disconnect
|
|
||||||
if pandaState_prev is not None:
|
|
||||||
if pandaState.pandaType == log.PandaState.PandaType.unknown and \
|
|
||||||
pandaState_prev.pandaType != log.PandaState.PandaType.unknown:
|
|
||||||
params.clear_all(ParamKeyType.CLEAR_ON_PANDA_DISCONNECT)
|
|
||||||
pandaState_prev = pandaState
|
|
||||||
|
|
||||||
# these are expensive calls. update every 10s
|
# these are expensive calls. update every 10s
|
||||||
if (count % int(10. / DT_TRML)) == 0:
|
if (count % int(10. / DT_TRML)) == 0:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue