Skip to content

Commit df898c6

Browse files
committed
Only update period when we have received two timestamps.
1 parent f5c6ae1 commit df898c6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

canopen/pdo/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ def on_message(self, can_id, data, timestamp):
268268
with self.receive_condition:
269269
self.is_received = True
270270
self.data = data
271-
self.period = timestamp - self.timestamp if self.timestamp is not None else timestamp
271+
if self.timestamp is not None:
272+
self.period = timestamp - self.timestamp
272273
self.timestamp = timestamp
273274
self.receive_condition.notify_all()
274275
for callback in self.callbacks:

0 commit comments

Comments
 (0)