From 053418d46bc3780f141c23b40eb1e5cc354df1ea Mon Sep 17 00:00:00 2001 From: dragonpilot Date: Thu, 12 Mar 2020 23:21:06 +1000 Subject: [PATCH 1/2] fix shutdownd logic error --- selfdrive/dragonpilot/shutdownd/shutdownd.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/selfdrive/dragonpilot/shutdownd/shutdownd.py b/selfdrive/dragonpilot/shutdownd/shutdownd.py index ab5f9bd95..cbf104554 100644 --- a/selfdrive/dragonpilot/shutdownd/shutdownd.py +++ b/selfdrive/dragonpilot/shutdownd/shutdownd.py @@ -11,12 +11,12 @@ def main(): thermal_sock = messaging.sub_sock('thermal') last_ts = 0 secs = 0 - last_secs = 0 + last_secs = None shutdown_at = 0 started = False usb_online = False enabled = False - last_enabled = False + last_enabled = None dp_last_modified = None while 1: cur_time = sec_since_boot() @@ -24,31 +24,25 @@ def main(): modified = dp_get_last_modified() if dp_last_modified != modified: enabled = True if params.get("DragonEnableAutoShutdown", encoding='utf8') == '1' else False - # reset timer when enabled status has changed - if not last_enabled and enabled: - shutdown_at = cur_time + secs - last_enabled = enabled - if enabled: secs = int(params.get("DragonAutoShutdownAt", encoding='utf8')) * 60 # reset timer when secs num has changed - if last_secs != secs: + if last_secs != secs or last_enabled != enabled: shutdown_at = cur_time + secs - last_secs = secs msg = messaging.recv_sock(thermal_sock, wait=True) started = msg.thermal.started with open("/sys/class/power_supply/usb/present") as f: usb_online = bool(int(f.read())) + last_enabled = enabled dp_last_modified = modified - + last_ts = cur_time if enabled: if started or usb_online: shutdown_at = cur_time + secs else: if secs > 0 and cur_time >= shutdown_at: os.system('LD_LIBRARY_PATH="" svc power shutdown') - time.sleep(10) if __name__ == "__main__": From 5918e54e98739b4c4a7a2c61388f2ccf2c60a632 Mon Sep 17 00:00:00 2001 From: dragonpilot Date: Thu, 12 Mar 2020 23:49:03 +1000 Subject: [PATCH 2/2] remove duplicated candidate --- selfdrive/car/toyota/interface.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/selfdrive/car/toyota/interface.py b/selfdrive/car/toyota/interface.py index 62e60f200..69e052e5a 100644 --- a/selfdrive/car/toyota/interface.py +++ b/selfdrive/car/toyota/interface.py @@ -225,16 +225,6 @@ class CarInterface(CarInterfaceBase): ret.mass = 3800. * CV.LB_TO_KG + STD_CARGO_KG ret.lateralTuning.pid.kf = 0.00007818594 - elif candidate == CAR.RAV4H_TSS2: - stop_and_go = True - ret.safetyParam = 73 - ret.wheelbase = 2.68986 - ret.steerRatio = 14.3 - tire_stiffness_factor = 0.7933 - ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.1]] - ret.mass = 3800. * CV.LB_TO_KG + STD_CARGO_KG - ret.lateralTuning.pid.kf = 0.00007818594 - elif candidate in [CAR.COROLLA_TSS2, CAR.COROLLAH_TSS2]: stop_and_go = True ret.safetyParam = 73