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: 4ad046374b1b
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 716c869a5704
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Mar 21, 2020

  1. Copy the full SHA
    716c869 View commit details
Showing with 31 additions and 30 deletions.
  1. +31 −30 scopehal/Oscilloscope.cpp
61 changes: 31 additions & 30 deletions scopehal/Oscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -252,25 +252,6 @@ string Oscilloscope::SerializeConfiguration(IDTable& table)
config += " enabled: 1\n";
else
config += " enabled: 0\n";
switch(chan->GetCoupling())
{
case OscilloscopeChannel::COUPLE_DC_1M:
config += " coupling: dc_1M\n";
break;
case OscilloscopeChannel::COUPLE_AC_1M:
config += " coupling: ac_1M\n";
break;
case OscilloscopeChannel::COUPLE_DC_50:
config += " coupling: dc_50\n";
break;
case OscilloscopeChannel::COUPLE_GND:
config += " coupling: gnd\n";
break;

//should never get synthetic coupling on a scope channel
default:
break;
}

if(chan->GetType() == OscilloscopeChannel::CHANNEL_TYPE_ANALOG)
{
@@ -282,6 +263,26 @@ string Oscilloscope::SerializeConfiguration(IDTable& table)
config += tmp;
snprintf(tmp, sizeof(tmp), " offset: %f\n", chan->GetOffset());
config += tmp;

switch(chan->GetCoupling())
{
case OscilloscopeChannel::COUPLE_DC_1M:
config += " coupling: dc_1M\n";
break;
case OscilloscopeChannel::COUPLE_AC_1M:
config += " coupling: ac_1M\n";
break;
case OscilloscopeChannel::COUPLE_DC_50:
config += " coupling: dc_50\n";
break;
case OscilloscopeChannel::COUPLE_GND:
config += " coupling: gnd\n";
break;

//should never get synthetic coupling on a scope channel
default:
break;
}
}
}

@@ -313,23 +314,23 @@ void Oscilloscope::LoadConfiguration(const YAML::Node& node, IDTable& table)
else
chan->Disable();

string coupling = cnode["coupling"].as<string>();
if(coupling == "dc_50")
chan->SetCoupling(OscilloscopeChannel::COUPLE_DC_50);
else if(coupling == "dc_1M")
chan->SetCoupling(OscilloscopeChannel::COUPLE_DC_1M);
else if(coupling == "ac_1M")
chan->SetCoupling(OscilloscopeChannel::COUPLE_AC_1M);
else if(coupling == "gnd")
chan->SetCoupling(OscilloscopeChannel::COUPLE_GND);

//only load gain/offset for actual inputs
//only load AFE config for analog inputs
if(chan->GetType() == OscilloscopeChannel::CHANNEL_TYPE_ANALOG)
{
chan->SetAttenuation(cnode["attenuation"].as<float>());
chan->SetBandwidthLimit(cnode["bwlimit"].as<int>());
chan->SetVoltageRange(cnode["vrange"].as<float>());
chan->SetOffset(cnode["offset"].as<float>());

string coupling = cnode["coupling"].as<string>();
if(coupling == "dc_50")
chan->SetCoupling(OscilloscopeChannel::COUPLE_DC_50);
else if(coupling == "dc_1M")
chan->SetCoupling(OscilloscopeChannel::COUPLE_DC_1M);
else if(coupling == "ac_1M")
chan->SetCoupling(OscilloscopeChannel::COUPLE_AC_1M);
else if(coupling == "gnd")
chan->SetCoupling(OscilloscopeChannel::COUPLE_GND);
}
}
}