Skip to content

Commit

Permalink
Merge branch 'stream-browser-dialog-refactoring' of github.com:fredzo…
Browse files Browse the repository at this point in the history
…/scopehal-apps
  • Loading branch information
azonenberg committed Oct 25, 2024
2 parents 9d0406c + b3bdc43 commit 0d64c1a
Show file tree
Hide file tree
Showing 8 changed files with 758 additions and 538 deletions.
3 changes: 3 additions & 0 deletions devdoc/Introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ End user documentation is located at https://www.ngscopeclient.org/manual/conten
\defgroup drivers Instrument drivers
\ingroup libscopehal

\defgroup miscdrivers Miscellaneous instrument drivers
\ingroup drivers

\defgroup scopedrivers Oscilloscope / LA drivers
\ingroup drivers

Expand Down
2 changes: 1 addition & 1 deletion doc
2 changes: 1 addition & 1 deletion lib
Submodule lib updated 52 files
+30 −76 scopehal/AlientekPowerSupply.cpp
+0 −1 scopehal/AlientekPowerSupply.h
+97 −0 scopehal/BinaryDriver.cpp
+102 −0 scopehal/BinaryDriver.h
+4 −0 scopehal/CMakeLists.txt
+15 −2 scopehal/CSVStreamInstrument.cpp
+24 −2 scopehal/CSVStreamInstrument.h
+19 −6 scopehal/DCAEdgeTrigger.cpp
+22 −7 scopehal/DCAEdgeTrigger.h
+18 −3 scopehal/DSLabsOscilloscope.cpp
+9 −2 scopehal/DSLabsOscilloscope.h
+9 −1 scopehal/DemoOscilloscope.cpp
+52 −1 scopehal/DemoOscilloscope.h
+16 −3 scopehal/DemoPowerSupply.cpp
+14 −4 scopehal/DemoPowerSupply.h
+15 −1 scopehal/DensityFunctionWaveform.cpp
+28 −14 scopehal/DensityFunctionWaveform.h
+33 −18 scopehal/DigilentOscilloscope.cpp
+11 −2 scopehal/DigilentOscilloscope.h
+16 −0 scopehal/DigitalIOChannel.cpp
+10 −1 scopehal/DigitalIOChannel.h
+15 −0 scopehal/DigitalInputChannel.cpp
+9 −0 scopehal/DigitalInputChannel.h
+15 −0 scopehal/DigitalOutputChannel.cpp
+10 −1 scopehal/DigitalOutputChannel.h
+28 −14 scopehal/DropoutTrigger.cpp
+51 −13 scopehal/DropoutTrigger.h
+12 −6 scopehal/EdgeTrigger.cpp
+24 −4 scopehal/EdgeTrigger.h
+9 −14 scopehal/HIDInstrument.cpp
+3 −42 scopehal/HIDInstrument.h
+285 −0 scopehal/KuaiquPowerSupply.cpp
+108 −0 scopehal/KuaiquPowerSupply.h
+249 −0 scopehal/ModbusInstrument.cpp
+86 −0 scopehal/ModbusInstrument.h
+7 −0 scopehal/Multimeter.cpp
+7 −0 scopehal/Multimeter.h
+18 −0 scopehal/MultimeterChannel.cpp
+14 −3 scopehal/MultimeterChannel.h
+23 −10 scopehal/NthEdgeBurstTrigger.cpp
+43 −13 scopehal/NthEdgeBurstTrigger.h
+41 −6 scopehal/PicoVNA.cpp
+14 −2 scopehal/PicoVNA.h
+165 −0 scopehal/RidenPowerSupply.cpp
+99 −0 scopehal/RidenPowerSupply.h
+4 −0 scopehal/scopehal.cpp
+2 −0 scopehal/scopehal.h
+1 −0 scopeprotocols/CMakeLists.txt
+120 −0 scopeprotocols/TwoPortShuntThroughFilter.cpp
+52 −0 scopeprotocols/TwoPortShuntThroughFilter.h
+1 −0 scopeprotocols/scopeprotocols.cpp
+1 −0 scopeprotocols/scopeprotocols.h
4 changes: 4 additions & 0 deletions src/ngscopeclient/PreferenceSchema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ void PreferenceManager::InitializeDefaults()
.Description("Color for icon captions"));

auto& stream = appearance.AddCategory("Stream Browser");
stream.AddPreference(
Preference::Real("instrument_badge_latch_duration", 0.4)
.Label("Intrument badge latch duration (seconds)")
.Description("Duration during which instrument badges are preserved (to prevent flashing)."));
stream.AddPreference(
Preference::Color("download_wait_badge_color", ColorFromString("#CC4C4C"))
.Label("Download wait badge color")
Expand Down
74 changes: 73 additions & 1 deletion src/ngscopeclient/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -964,13 +964,18 @@ bool Session::PreLoadInstruments(int version, const YAML::Node& node, bool onlin
if(!PreLoadMisc(version, inst, online))
return false;
}
else if(type == "vna")
{
if(!PreLoadVNA(version, inst, online))
return false;
}

//Unknown instrument type - too new file format?
else
{
m_mainWindow->ShowErrorPopup(
"File load error",
string("Instrument ") + nick.c_str() + " is of unknown type " + inst["type"].as<string>());
string("Instrument ") + nick.c_str() + " is of unknown type " + type.c_str());
return false;
}
}
Expand Down Expand Up @@ -1120,6 +1125,73 @@ bool Session::PreLoadOscilloscope(int version, const YAML::Node& node, bool onli
return true;
}

bool Session::PreLoadVNA(int version, const YAML::Node& node, bool online)
{
//Create the instrument
shared_ptr<Oscilloscope> scope = nullptr;

auto transtype = node["transport"].as<string>();
auto driver = node["driver"].as<string>();

if(online)
{
if( (transtype == "null") && (driver != "demo") )
{
m_mainWindow->ShowErrorPopup(
"Unable to reconnect",
"The session file does not contain any connection information.\n\n"
"Loading in offline mode.");
}

else
{
//Create the scope
auto transport = CreateTransportForNode(node);

if(transport && transport->IsConnected())
{
scope = SCPIVNA::CreateVNA(driver, transport);
if(!VerifyInstrument(node, scope))
scope = nullptr;
}
else
{
delete transport;

m_mainWindow->ShowErrorPopup(
"Unable to reconnect",
string("Failed to reconnect to oscilloscope at ") + node["args"].as<string>() + ".\n\n"
"Loading this instrument in offline mode.");
}
}
}

if(!scope)
{
//Create the mock scope
scope = make_shared<MockOscilloscope>(
node["name"].as<string>(),
node["vendor"].as<string>(),
node["serial"].as<string>(),
transtype,
driver,
node["args"].as<string>()
);
}

//Make any config settings to the instrument from our preference settings
ApplyPreferences(scope);

//All good. Add to our list of scopes etc
AddInstrument(scope, false);
m_idtable.emplace(node["id"].as<uintptr_t>(), (Instrument*)scope.get());

//Run the preload
scope->PreLoadConfiguration(version, node, m_idtable, m_warnings);

return true;
}

bool Session::PreLoadLoad(int version, const YAML::Node& node, bool online)
{
//Create the instrument
Expand Down
1 change: 1 addition & 0 deletions src/ngscopeclient/Session.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ class Session
bool PreLoadInstruments(int version, const YAML::Node& node, bool online);
SCPITransport* CreateTransportForNode(const YAML::Node& node);
bool VerifyInstrument(const YAML::Node& node, std::shared_ptr<Instrument> inst);
bool PreLoadVNA(int version, const YAML::Node& node, bool online);
bool PreLoadOscilloscope(int version, const YAML::Node& node, bool online);
bool PreLoadPowerSupply(int version, const YAML::Node& node, bool online);
bool PreLoadRFSignalGenerator(int version, const YAML::Node& node, bool online);
Expand Down
Loading

0 comments on commit 0d64c1a

Please sign in to comment.