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

Siglent: Improve SetADCMode reliability under slow/unstable network connection #821

Closed
hansemro opened this issue Nov 21, 2023 · 3 comments · Fixed by #825
Closed

Siglent: Improve SetADCMode reliability under slow/unstable network connection #821

hansemro opened this issue Nov 21, 2023 · 3 comments · Fixed by #825

Comments

@hansemro
Copy link
Contributor

Setup

  • Arch Linux
  • scopehal-apps (45d255de8795bf5cf62054145907fcb5a022a104)
  • SDS2004X Plus connected via lan and lxi
    • Hardware revision: 05-05
    • Tested versions:
      • v1.5.2R3

Issue Description:

SetADCMode currently uses thread sleep to ensure sufficient delays between commands. However, 200 millisecond delays do not propagate well enough under slow/unstable network connection which may result in the :WAVeform:WIDTh command failing to execute.

Increasing the delay is one option, but not foolproof.

@azonenberg
Copy link
Collaborator

You're using SendCommandQueued(), which writes commands to the FIFO but they don't get flushed to the instrument until FlushCommandQueue() is called on the transport or a SendCommandQueuedWithReply() call is made. So you're racing the GUI thread against ScopeThread which may be in the middle of AcquireData() and not flushing write side data.

If exact timing is important, call FlushCommandQueue() before the sleep to ensure the first command is actually pushed out the socket.

@azonenberg
Copy link
Collaborator

The whole point of the queued command API is to avoid the GUI thread blocking on ScopeThread unless absolutely necessary. So instead of locking the mutex and waiting for an in progress AcquireData() call - usually pretty slow - to finish., it simply locks the queue mutex, writes the command to the queue, and returns immediately even if the socket is busy.

@hansemro
Copy link
Contributor Author

Makes sense. Thanks for explaining. I will look more into this.

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 a pull request may close this issue.

2 participants