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

* check all valid in if statement

* apply review
pull/23479/head
Dean Lee 4 years ago committed by GitHub
parent 2d08f8b318
commit 67af095692
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      selfdrive/controls/controlsd.py

@ -366,8 +366,9 @@ class Controls:
self.sm.update(0) self.sm.update(0)
if not self.initialized:
all_valid = CS.canValid and self.sm.all_alive_and_valid() 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 all_valid or self.sm.frame * DT_CTRL > 3.5 or SIMULATION:
if not self.read_only: if not self.read_only:
self.CI.init(self.CP, self.can_sock, self.pm.sock['sendcan']) self.CI.init(self.CP, self.can_sock, self.pm.sock['sendcan'])
self.initialized = True self.initialized = True

Loading…
Cancel
Save