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: 80acbcb209ac
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 18275dce56ad
Choose a head ref
  • 1 commit
  • 8 files changed
  • 1 contributor

Commits on Dec 18, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    18275dc View commit details
6 changes: 4 additions & 2 deletions scopehal/LeCroyOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -1866,8 +1866,10 @@ Oscilloscope::TriggerMode LeCroyOscilloscope::PollTrigger()
}

//Stopped, no data available
//TODO: how to handle auto / normal trigger mode?
return TRIGGER_MODE_RUN;
if(m_triggerArmed)
return TRIGGER_MODE_RUN;
else
return TRIGGER_MODE_STOP;
}

bool LeCroyOscilloscope::ReadWaveformBlock(string& data)
7 changes: 6 additions & 1 deletion scopehal/Oscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -245,7 +245,7 @@ string Oscilloscope::SerializeConfiguration(IDTable& table)
//Basic channel info
snprintf(tmp, sizeof(tmp), " : \n");
config += tmp;
snprintf(tmp, sizeof(tmp), " id: %d\n", table.emplace(chan));
snprintf(tmp, sizeof(tmp), " id: virtual bool IsTriggerArmed(); %d\n", table.emplace(chan));
config += tmp;
snprintf(tmp, sizeof(tmp), " index: %zu\n", i);
config += tmp;
@@ -529,6 +529,11 @@ vector<string> Oscilloscope::GetTriggerTypes()
return ret;
}

bool Oscilloscope::PeekTriggerArmed()
{
return (PollTrigger() == TRIGGER_MODE_RUN);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Spectrum analyzer configuration (default no-op for scopes without SA feature)

8 changes: 8 additions & 0 deletions scopehal/Oscilloscope.h
Original file line number Diff line number Diff line change
@@ -323,6 +323,14 @@ class Oscilloscope : public virtual Instrument
*/
virtual Oscilloscope::TriggerMode PollTrigger() =0;

/**
@brief Checks if the trigger is armed, without altering internal state or checking caches.
The default implementation of this function simply calls PollTrigger(). This function should be overridden by
the driver class if PollTrigger() changes any internal driver state or updates caches.
*/
virtual bool PeekTriggerArmed();

/**
@brief Block until a trigger happens or a timeout elapses.
34 changes: 0 additions & 34 deletions scopehal/SCPITransport.cpp
Original file line number Diff line number Diff line change
@@ -40,7 +40,6 @@ using namespace std;
SCPITransport::CreateMapType SCPITransport::m_createprocs;

SCPITransport::SCPITransport()
: m_opcRequired(false)
{
}

@@ -100,13 +99,7 @@ bool SCPITransport::FlushCommandQueue()

lock_guard<recursive_mutex> lock(m_netMutex);
for(auto str : tmp)
{
SendCommand(str);

//Synchronize broken instruments without RX buffering
if(m_opcRequired)
OpcPing();
}
return true;
}

@@ -140,10 +133,6 @@ void SCPITransport::SendCommandImmediate(string cmd)
{
lock_guard<recursive_mutex> lock(m_netMutex);
SendCommand(cmd);

//Synchronize broken instruments without RX buffering
if(m_opcRequired)
OpcPing();
}

/**
@@ -173,26 +162,3 @@ 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;
}
6 changes: 0 additions & 6 deletions scopehal/SCPITransport.h
Original file line number Diff line number Diff line change
@@ -55,9 +55,6 @@ class SCPITransport
std::string SendCommandImmediateWithReply(std::string cmd, bool endOnSemicolon = true);
void* SendCommandImmediateWithRawBlockReply(std::string cmd, size_t& len);
bool FlushCommandQueue();
void SetOpcRequired()
{ m_opcRequired = true; }
bool OpcPing();

//Manual mutex locking for ReadRawData() etc
std::recursive_mutex& GetMutex()
@@ -89,9 +86,6 @@ class SCPITransport
std::mutex m_queueMutex;
std::recursive_mutex m_netMutex;
std::list<std::string> m_txQueue;

//True if we need to *OPC? between consecutive commands
bool m_opcRequired;
};

#define TRANSPORT_INITPROC(T) \
Loading