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-apps
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 88bb365af2f5
Choose a base ref
...
head repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c077b8d18fa2
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Jun 1, 2019

  1. Copy the full SHA
    2626343 View commit details
  2. Copy the full SHA
    c077b8d View commit details
Showing with 27 additions and 16 deletions.
  1. +15 −15 examples/curvetrace/main.cpp
  2. +1 −1 examples/fgtest/main.cpp
  3. +11 −0 glscopeclient/main.cpp
30 changes: 15 additions & 15 deletions examples/curvetrace/main.cpp
Original file line number Diff line number Diff line change
@@ -43,16 +43,16 @@ using namespace std;
int main(int argc, char* argv[])
{
Severity console_verbosity = Severity::NOTICE;

string spsu = "";
string sdmm = "";

//Test configuration
int channel = 0;
double voltageMax = 4.0;
double currentMax = 0.02;
double voltageStep = 0.001;

//Parse command-line arguments
for(int i=1; i<argc; i++)
{
@@ -80,45 +80,45 @@ int main(int argc, char* argv[])

//Set up logging
g_log_sinks.emplace(g_log_sinks.begin(), new ColoredSTDLogSink(console_verbosity));
RohdeSchwarzHMC804xPowerSupply psu(spsu, 5025);
RohdeSchwarzHMC8012Multimeter dmm(sdmm, 5025);

RohdeSchwarzHMC804xPowerSupply psu(new SCPISocketTransport(spsu, 5025));
RohdeSchwarzHMC8012Multimeter dmm(new SCPISocketTransport(sdmm, 5025));

//Initial configuration
LogDebug("Initial output configuration\n");
psu.SetPowerOvercurrentShutdownEnabled(channel, false);
psu.SetPowerVoltage(channel, 0);
psu.SetPowerCurrent(channel, currentMax);
psu.SetPowerChannelActive(channel, true);
psu.SetMasterPowerEnable(true);

if(dmm.GetMeterMode() != Multimeter::DC_CURRENT)
dmm.SetMeterMode(Multimeter::DC_CURRENT);

//The actual curve tracing
LogNotice("Step,V,I\n");
for(int i=0;i*voltageStep < voltageMax; i++)
{
double v = i*voltageStep;
psu.SetPowerVoltage(channel, v);
LogNotice("%5d,%5.3f,",i,v);

//wait 25ms to stabilize
usleep(25 * 1000);

LogNotice("%5.7f\n", dmm.GetCurrent());

if(psu.IsPowerConstantCurrent(channel))
break;
}

//Clean up
psu.SetPowerVoltage(channel, 0);
psu.SetPowerChannelActive(channel, false);

//Make sure all writes have committed before we close the socket
psu.GetSerial();
usleep(50 * 1000);

return 0;
}
2 changes: 1 addition & 1 deletion examples/fgtest/main.cpp
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ int main(int argc, char* argv[])
//Set up logging
g_log_sinks.emplace(g_log_sinks.begin(), new ColoredSTDLogSink(console_verbosity));

LeCroyVICPOscilloscope scope(hostname, 1861);
LeCroyVICPOscilloscope scope(new SCPISocketTransport(hostname, 1861));
if(0 == (scope.GetInstrumentTypes() & Instrument::INST_FUNCTION))
{
LogError("not a function generator\n");
11 changes: 11 additions & 0 deletions glscopeclient/main.cpp
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@
#include "../scopemeasurements/scopemeasurements.h"
#include "../scopehal/LeCroyVICPOscilloscope.h"
#include "../scopehal/RigolOscilloscope.h"
#include "../scopehal/RohdeSchwarzOscilloscope.h"
#include <thread>

using namespace std;
@@ -216,6 +217,16 @@ int main(int argc, char* argv[])
scope->m_nickname = nick;
app->m_scopes.push_back(scope);
}
else if(sapi == "rs_lan")
{
//default port if not specified
if(port == 0)
port = 5025;

auto scope = new RohdeSchwarzOscilloscope(new SCPISocketTransport(host, port));
scope->m_nickname = nick;
app->m_scopes.push_back(scope);
}
else
{
LogError("Unrecognized API \"%s\", use --help\n", api);