It appears that the current behavior of calling listen with Matches will assign one (unused) mask and one (unused) filter for each Match provided, regardless if masks can be shared across multiple filters. This means the user can only utilize up to two filters out of the MCP2515's six. An improved behavior might roughly look like this:
MASKS = {
_RXM0SIDH: None
_RXM1SIDH: None
}
FILTERS = {
_RXM0SIDH: {
_RXF0SIDH: None
_RXF1SIDH: None
}
# mask 1 ...
}
def listen(matches):
for match in matches:
mask_id = self._get_or_create_mask(match)
# create filter ...
def _get_or_create_mask(match):
mask_id = 0
for reg, value in MASKS.values():
if match.mask == value and has_free_filters:
break # mask already exists, has free filters
if value is None:
break # otherwise use first available mask
If this looks good, I can help updating the current implementation.
It appears that the current behavior of calling
listen
withMatch
es will assign one (unused) mask and one (unused) filter for eachMatch
provided, regardless if masks can be shared across multiple filters. This means the user can only utilize up to two filters out of the MCP2515's six. An improved behavior might roughly look like this:If this looks good, I can help updating the current implementation.