Skip to content

Adding neoVI support for receive_own_messages #434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 5, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions can/interfaces/ics_neovi/neovi_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def __init__(self, channel, can_filters=None, **config):
:type channel: int or str or list(int) or list(str)
:param list can_filters:
See :meth:`can.BusABC.set_filters` for details.
:param bool receive_own_messages:
If transmitted messages should also be received by this bus.
:param bool use_system_timestamp:
Use system timestamp for can messages instead of the hardware time
stamp
Expand Down Expand Up @@ -127,6 +129,7 @@ def __init__(self, channel, can_filters=None, **config):
self._use_system_timestamp = bool(
config.get('use_system_timestamp', False)
)
self._receive_own_messages = config.get('receive_own_messages', True)

self.channel_info = '%s %s CH:%s' % (
self.dev.Name,
Expand Down Expand Up @@ -222,6 +225,9 @@ def _process_msg_queue(self, timeout=0.1):
for ics_msg in messages:
if ics_msg.NetworkID not in self.channels:
continue
is_tx = bool(ics_msg.StatusBitField & ics.SPY_STATUS_TX_MSG)
if not self._receive_own_messages and is_tx:
continue
self.rx_buffer.append(ics_msg)
if errors:
logger.warning("%d error(s) found" % errors)
Expand Down