-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
epaperdisplay: fix delay when two_byte_sequence_length is true #9694
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dkulinski you added support for two byte sequence lengths back in #5874 -- if you have a chance you might want to make sure this change is compatible with your displays & their control sequences.
@@ -157,7 +157,7 @@ static void send_command_sequence(epaperdisplay_epaperdisplay_obj_t *self, | |||
uint16_t delay_length_ms = 0; | |||
if (delay) { | |||
data_size++; | |||
delay_length_ms = *(cmd + 1 + data_size); | |||
delay_length_ms = *(cmd + 1 + data_size + self->two_byte_sequence_length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks -- I think I understand why the existing code is wrong, but maybe you want to have it as delay_length_ms = *(data + data_size)
so that it always refers to the next byte after the end of data
. I think that's clearer overall, and might even result in smaller generated code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do *(data+datasize)
, but then I think we have to move the increment of data_size
to after reading delay_length_ms
. I can try this out this evening and update the PR.
I can't comment directly on this line of code because it's not touched by the change .. anyway, the position within the init sequence is advanced by |
|
Thanks, I missed that. If you'd prefer not to tinker further with the code and call it good, I'm OK with that as well. |
I'll test on a MagTag, just to check for regression. |
If you're ok with it and Dan's test is ok, then let's just leave it as it is for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works on a MagTag
When playing around with custom LUT waveforms on an epaperdisplay, I needed
two_byte_sequence_length=True
, in order to be able to send more than 128 bytes ofstart_sequence
data. However, I noticed that the delays between commands were read incorrectly in this case.When
two_byte_sequence_length=True
, the adress of the delay (if present) is shifted back by 1 byte as compared to whentwo_byte_sequence_length=False
, but prior to this PR the delay was always read from the same adress.The memory layout for one command is: "
command
(1 byte),data_size
(1-2 bytes),data
(data_size
bytes),delay
(0-1 bytes)".