Skip to content

Inconsistent Position Definition for Serverdown Tickle and PlayLoop #679

Open
@vt128

Description

Issue Description:
The Serverdown Tickle and PlayLoop commands in the firmware have inconsistent position definitions despite sharing the same definition according to HID instructions.

Reproducing the Issue:

Based on experiments conducted on a mk2 device, it has been observed that the start and end positions of the Serverdown Tickle command are handled differently compared to the PlayLoop command. The start position of the Serverdown Tickle command is inclusive, while the end position is exclusive. On the other hand, both the start and end positions of the PlayLoop command are inclusive.

Here are the observed results for different start and end positions:

Start Position End Position Play Loop Tickle
0 0 0-31 0-31
0 31 0-31 0-30
0 32 0-31 0-31
0 1 0-1 0 only

Diagnostic Investigation:
To better understand the cause of this inconsistency, the firmware code was carefully examined. The following code snippets are relevant to the Serverdown Tickle and PlayLoop modes:

  • Server mode tickle: link
  • PlayLoop mode: link
  • Main loop about playing: link

Based on my understanding of the code (correct me if I'm wrong ❤️), the following observations were made:

For Server mode tickle:

  • If the end position from the input is 0, it will be set to 1, resulting in a loop with only one element (position 0). However, the actual behavior is a loop from position 0 to 31.
  • If the end position from the input is 31, it will be set to 32, resulting in a loop from position 0 to 31. However, the actual behavior is a loop from position 0 to 30.
  • If the end position from the input is 32, it will be set to 32, resulting in a loop from position 0 to 31, which is the correct behavior.

For PlayLoop mode:

  • If the end position from the input is 0, it will be set to 32, resulting in a loop from position 0 to 31, which is the correct behavior.
  • If the end position from the input is 31, it will be set to 32, resulting in a loop from position 0 to 31, which is the correct behavior.
  • If the end position from the input is 32, it will be set to 33, resulting in a loop from position 0 to 32. This would have caused an out-of-bound error (maybe crash the device?) in code like ctmp = pattern[playpos].color;, even though the actual behavior is a loop from position 0 to 31 with no error.

Expected Outcome:

It is expected that the position definitions for Serverdown Tickle and PlayLoop commands align with the HID instructions and have consistent behavior. The observed inconsistencies should be resolved to ensure the expected behavior is maintained.

Thank you for taking the time to review this issue! It is hoped that this inconsistency can be addressed in future updates, providing clarity and resolving the confusion surrounding this matter 💯

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions