Skip to content

Commit

Permalink
AlertManager: cleanup add_many (commaai#23438)
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee authored Jan 11, 2022
1 parent 5fb9c6a commit 678732d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions selfdrive/controls/lib/alertmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ def __init__(self):

def add_many(self, frame: int, alerts: List[Alert]) -> None:
for alert in alerts:
key = alert.alert_type
self.alerts[key].alert = alert
if not self.alerts[key].active(frame):
self.alerts[key].start_frame = frame
min_end_frame = self.alerts[key].start_frame + alert.duration
self.alerts[key].end_frame = max(frame + 1, min_end_frame)
entry = self.alerts[alert.alert_type]
entry.alert = alert
if not entry.active(frame):
entry.start_frame = frame
min_end_frame = entry.start_frame + alert.duration
entry.end_frame = max(frame + 1, min_end_frame)

def process_alerts(self, frame: int, clear_event_type=None) -> Optional[Alert]:
current_alert = AlertEntry()
Expand Down

0 comments on commit 678732d

Please sign in to comment.