Skip to content
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

Add warning regarding reusing wave ids in flight #472

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xloem
Copy link

@xloem xloem commented May 21, 2021

I'm inspecting the source a little and it looks like this is the current situation:

  • if a wave at the end of the queue, possibly being actively transmitted, is added again with SYNC, it will be relinked to its start, and it will loop forever with no error returned. This is because waveEndPtr points to its own upcoming next pointer from its last transmission.

    pigpio/pigpio.c

    Line 9918 in accd69d

    *waveEndPtr = waveCbPOadr(waveInfo[wave_id].botCB+1);
  • if a wave already queued is added with SYNC, its next pointer will be re-mutated and everything on the queue after its previous position effectively dropped, with no error returned. This is because its next pointer was previously holding a role in the chain of waves.

    pigpio/pigpio.c

    Line 9912 in accd69d

    p->next = 0;

Ideally it would be an error to transmit a wave with SYNC that is still queued to be sent.

@guymcswain
Copy link
Collaborator

guymcswain commented May 22, 2021

Thank you. I believe this addresses one issue exposed in #457 but something else is going on there that I have not had the time to look into. I'm suspicious that changes made for padded waves may have broken the normal waves.

@guymcswain
Copy link
Collaborator

@xloem thanks for this contribution. I need to verify if this warns for the situation in #457. I then need to decide if a warning is sufficient or if an error more appropriate.

@xloem
Copy link
Author

xloem commented Aug 16, 2021

This warning was intended to address this issue mentioned in #457 (and to imply your proposed solution):

  // send second pulse before first has ended; second pulse does not appear

I'm not sure if this warning is clear, but I believe it to be much better than nothing :-)

It would indeed be nice to review the wave sending for robustness. Warnings in documentation are not the best solution in the end.

Sign up for free to 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.

None yet

2 participants