Skip to content

Improve RM4 communication - #490

Merged
felipediel merged 1 commit into
mjg59:masterfrom
felipediel:cleanup-rm
Jan 9, 2021
Merged

Improve RM4 communication#490
felipediel merged 1 commit into
mjg59:masterfrom
felipediel:cleanup-rm

Conversation

@felipediel

@felipedielfelipediel commented Dec 8, 2020

Copy link
Copy Markdown
Collaborator

The problem

When we added the RM4 class we didn't know the meaning of the new two bytes attached to the left of the payload, so we added them as constants, exactly as they appeared in the packets.

Although this implementation has served us relatively well so far, it is a poor implementation. These bytes represent the payload length. We are sending incorrect values for variable-sized packets. In rm4.send_data(), for example, we are prefixing the packets with the constant 0xda, or 218. If the packet is larger than 218 bytes, overflow information is lost.

Proposed changes

  1. Create rm._send() method to abstract enconding and decoding the messages.
  2. Prefix the packets with the length of the payload in rm4._send().

@felipediel
felipediel marked this pull request as draft December 8, 2020 05:37
@felipediel
felipedielforce-pushed the cleanup-rm branch 2 times, most recently from eedcaf0 to 0b46909CompareDecember 14, 2020 05:08
@felipediel
felipediel marked this pull request as ready for review December 16, 2020 05:30
@felipedielfelipediel changed the title Clean up remote.py and improve RM4 communicationImprove RM4 communicationDec 21, 2020
@felipediel
felipediel merged commit 8e7e118 into mjg59:masterJan 9, 2021
@felipedielfelipediel mentioned this pull request Jan 20, 2021
Merged
felipediel added a commit to felipediel/python-broadlink that referenced this pull request Jan 29, 2021
felipediel added a commit to felipediel/python-broadlink that referenced this pull request Jan 29, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@felipediel