You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have identified a few problems in the SCPIDevice constructor:
If there is more than three lines of crap in the RX buffer before the *IDN? request is sent, thenthe identify will fail. I'm not sure if this is a theoretical problem, or something that can happen.
If there is one or two lines of crap, then *IDN? will succeed, but there will still be crap in the buffer afterwards. This is supposed to be cleaned up by calling m_transport->FlushRXBuffer();. However the C++ code is so quick that the cleanup will most likely be done before the other data is even received from the instrument. (This is the problem I'm encountering right now.)
There is no way to temporarily activate the rate limiting API or use the dynamic rate limiting to solve problem 2.
I would suggest the following:
Split the identify code to a function named SCPIDevice::RequestIdentity(), or similar. And then call that function from the constructor. This gives a little more flexibility on how to initialize stuff without calling the SCPIDevice constructor.
Call m_transport->FlushRXBuffer(); before RequestIdentity(). Maybe this should be configurable via a parameter bool clearBuffersBeforeStart = true that can be disabled. I have no idea if this might break other things. But I would assume not. If there is some driver that are able to resume a connection and get the state from the instrument, then it makes no sense to automatically ask for *IDN?.
The text was updated successfully, but these errors were encountered:
I have identified a few problems in the
SCPIDevice
constructor:If there is more than three lines of crap in the RX buffer before the *IDN? request is sent, thenthe identify will fail. I'm not sure if this is a theoretical problem, or something that can happen.
If there is one or two lines of crap, then *IDN? will succeed, but there will still be crap in the buffer afterwards. This is supposed to be cleaned up by calling
m_transport->FlushRXBuffer();
. However the C++ code is so quick that the cleanup will most likely be done before the other data is even received from the instrument. (This is the problem I'm encountering right now.)There is no way to temporarily activate the rate limiting API or use the dynamic rate limiting to solve problem 2.
I would suggest the following:
Split the identify code to a function named SCPIDevice::RequestIdentity(), or similar. And then call that function from the constructor. This gives a little more flexibility on how to initialize stuff without calling the
SCPIDevice
constructor.Call
m_transport->FlushRXBuffer();
beforeRequestIdentity()
. Maybe this should be configurable via a parameterbool clearBuffersBeforeStart = true
that can be disabled. I have no idea if this might break other things. But I would assume not. If there is some driver that are able to resume a connection and get the state from the instrument, then it makes no sense to automatically ask for *IDN?.The text was updated successfully, but these errors were encountered: