Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b135693f9f95
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 80acbcb209ac
Choose a head ref
  • 1 commit
  • 4 files changed
  • 1 contributor

Commits on Dec 18, 2020

  1. Copy the full SHA
    80acbcb View commit details
Showing with 130 additions and 81 deletions.
  1. +25 −10 scopehal/SCPITransport.cpp
  2. +1 −0 scopehal/SCPITransport.h
  3. +101 −70 scopehal/TektronixOscilloscope.cpp
  4. +3 −1 scopehal/TektronixOscilloscope.h
35 changes: 25 additions & 10 deletions scopehal/SCPITransport.cpp
Original file line number Diff line number Diff line change
@@ -105,11 +105,7 @@ bool SCPITransport::FlushCommandQueue()

//Synchronize broken instruments without RX buffering
if(m_opcRequired)
{
uint8_t ignored[2];
SendCommand("*OPC?");
ReadRawData(2, ignored); //always returns "1\n"
}
OpcPing();
}
return true;
}
@@ -147,11 +143,7 @@ void SCPITransport::SendCommandImmediate(string cmd)

//Synchronize broken instruments without RX buffering
if(m_opcRequired)
{
uint8_t ignored[2];
SendCommand("*OPC?");
ReadRawData(2, ignored); //always returns "1\n"
}
OpcPing();
}

/**
@@ -181,3 +173,26 @@ void* SCPITransport::SendCommandImmediateWithRawBlockReply(string cmd, size_t& l
len = ReadRawData(len, buf);
return buf;
}

/**
@brief Blocks until the pending operation completes
*/
bool SCPITransport::OpcPing()
{
uint8_t tmp[2];
SendCommand("*OPC?");
if(2 != ReadRawData(2, tmp))
{
LogWarning("Response to *OPC? timed out\n");
return false;
}

//Sanity check
if( (tmp[0] != '1') || (tmp[1] != '\n') )
{
LogWarning("OpcPing(): got garbage instead of \"1\\n\" in response to *OPC?\n");
return false;
}

return true;
}
1 change: 1 addition & 0 deletions scopehal/SCPITransport.h
Original file line number Diff line number Diff line change
@@ -57,6 +57,7 @@ class SCPITransport
bool FlushCommandQueue();
void SetOpcRequired()
{ m_opcRequired = true; }
bool OpcPing();

//Manual mutex locking for ReadRawData() etc
std::recursive_mutex& GetMutex()
Loading