From 61a28b2fb7f14e913c3aa25bbbb401665df782d8 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Mon, 10 Jan 2022 19:13:58 +0800 Subject: [PATCH] controlsd: check all_valid only if not initialized (#23437) * check all valid in if statement * apply review old-commit-hash: 67af0956923558059d1feea9a9e263d37d09e865 --- selfdrive/controls/controlsd.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index e3f85d3e3..49e9b42d1 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -366,12 +366,13 @@ class Controls: self.sm.update(0) - all_valid = CS.canValid and self.sm.all_alive_and_valid() - if not self.initialized and (all_valid or self.sm.frame * DT_CTRL > 3.5 or SIMULATION): - if not self.read_only: - self.CI.init(self.CP, self.can_sock, self.pm.sock['sendcan']) - self.initialized = True - Params().put_bool("ControlsReady", True) + if not self.initialized: + all_valid = CS.canValid and self.sm.all_alive_and_valid() + if all_valid or self.sm.frame * DT_CTRL > 3.5 or SIMULATION: + if not self.read_only: + self.CI.init(self.CP, self.can_sock, self.pm.sock['sendcan']) + self.initialized = True + Params().put_bool("ControlsReady", True) # Check for CAN timeout if not can_strs: