Skip to content

Commit

Permalink
controlsd: check all_valid only if not initialized (#23437)
Browse files Browse the repository at this point in the history
* check all valid in if statement

* apply review
  • Loading branch information
deanlee authored Jan 10, 2022
1 parent 2d08f8b commit 67af095
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions selfdrive/controls/controlsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,13 @@ def data_sample(self):

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:
Expand Down

0 comments on commit 67af095

Please sign in to comment.