Skip to content

max_packet_length check doesn't account for 4 byte radiohead prepend #14

Closed
@nateinaction

Description

@nateinaction

assert 0 < len(data) <= self.max_packet_length
# pylint: enable=len-as-condition
self.idle() # Stop receiving to clear FIFO and keep it clear.
# Combine header and data to form payload
if self.radiohead:
payload = bytearray(4)

In asyncio_send() we assert that the passed data arg is no larger than the chip's FIFO (252 bytes) but then when radiohead is enabled, we prepend 4 bytes to data potentially making it larger than 252 bytes. This behavior results in data not being sent via the radio when it is equal to self.max_packet_length and radio head is enabled.

It feels like we should assert max packet length is 248 when radiohead is enabled. Even with the comment detailing how self.max_packet_length is used on async_send() I think this would also be a helpful note above all the locations where self.max_packet_length is set.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions