Skip to content

Commit

Permalink
Merge branch 'juergenH87:master' into memory-access
Browse files Browse the repository at this point in the history
  • Loading branch information
khauersp authored Jun 8, 2024
2 parents a76f4f9 + 44b714c commit 9675f85
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion j1939/electronic_control_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,13 +358,17 @@ class MessageListener(Listener):

def __init__(self, ecu : ElectronicControlUnit):
self.ecu = ecu
self.stopped = False

def on_message_received(self, msg : can.Message):
if msg.is_error_frame or msg.is_remote_frame or (msg.is_extended_id == False):
if self.stopped or msg.is_error_frame or msg.is_remote_frame or (msg.is_extended_id == False):
return

try:
self.ecu.notify(msg.arbitration_id, msg.data, msg.timestamp)
except Exception as e:
# Exceptions in any callbaks should not affect CAN processing
logger.error(str(e))

def stop(self):
self.stopped = True

0 comments on commit 9675f85

Please sign in to comment.