Skip to content

Commit

Permalink
Merge pull request #740 from fredzo/siglent-sds2000Xhd-fix
Browse files Browse the repository at this point in the history
Siglent sds2000 xhd fix
  • Loading branch information
azonenberg authored Aug 30, 2024
2 parents 409af0a + 1ecc1e9 commit d7d775b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/ngscopeclient/PreferenceSchema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,22 @@ void PreferenceManager::InitializeDefaults()
"Changes to this setting take effect the next time a connection to the instrument is opened; "
"the transfer format for active sessions is not updated."
));
auto& siglent = drivers.AddCategory("Siglent SDS HD");
siglent.AddPreference(
Preference::Enum("data_width", WIDTH_AUTO)
.Label("Data Width")
.Description(
"Data width used when downloading sample data from the instrument.\n\n"
"Even if the instrument has a 12-bit ADC, using 8 rather than 16 bit data format allows (about 10%) faster"
" waveform update rate.\n\n"
"Choose 16 bit mode if you want to privilege data accuracy over refresh rate.\n\n"
"Changes to this setting take effect the next time a connection to the instrument is opened; "
"the transfer format for active sessions is not updated."
)
.EnumValue("Auto", WIDTH_AUTO)
.EnumValue("8 bits", WIDTH_8_BITS)
.EnumValue("16 bits", WIDTH_16_BITS)
);

auto& files = this->m_treeRoot.AddCategory("Files");
files.AddPreference(
Expand Down
8 changes: 8 additions & 0 deletions src/ngscopeclient/PreferenceTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,12 @@ enum ViewportMode
VIEWPORT_DISABLE
};

enum DataWidth
{
WIDTH_AUTO,
WIDTH_8_BITS,
WIDTH_16_BITS
};


#endif
15 changes: 15 additions & 0 deletions src/ngscopeclient/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@
#include "MultimeterDialog.h"
#include "PowerSupplyDialog.h"
#include "RFGeneratorDialog.h"
#include "PreferenceTypes.h"

#include "../scopehal/LeCroyOscilloscope.h"
#include "../scopehal/SiglentSCPIOscilloscope.h"
#include "../scopehal/MockOscilloscope.h"
#include "../scopeprotocols/EyePattern.h"

Expand Down Expand Up @@ -2654,6 +2656,19 @@ void Session::ApplyPreferences(shared_ptr<Oscilloscope> scope)

//else auto resolution depending on instrument type
}
auto siglent = dynamic_pointer_cast<SiglentSCPIOscilloscope>(scope);
if(siglent)
{
auto dataWidth = m_preferences.GetEnumRaw("Drivers.Siglent SDS HD.data_width");
if(dataWidth == WIDTH_8_BITS)
{
siglent->ForceHDMode(false);
}
else if(dataWidth == WIDTH_16_BITS)
{
siglent->ForceHDMode(true);
}
}
}

/**
Expand Down

0 comments on commit d7d775b

Please sign in to comment.