controlsd: check all_valid only if not initialized (#23437)

* check all valid in if statement

* apply review
old-commit-hash: 67af095692
commatwo_master
Dean Lee 3 years ago committed by GitHub
parent df63cf059a
commit 61a28b2fb7
  1. 13
      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:

Loading…
Cancel
Save