From 90dc57b62056214ad695b15af60523dfa2eaad0c Mon Sep 17 00:00:00 2001 From: David Graeff Date: Sat, 6 Jan 2018 11:26:02 +0100 Subject: [PATCH] Use enum for scope.horizontal.samplerateSource. Remove softwaretriggersettings, use dsotriggersettings. Move more comments from cpp to header --- openhantek/src/docks/HorizontalDock.cpp | 4 ++-- openhantek/src/dsowidget.cpp | 1 - openhantek/src/hantekdso/controlsettings.h | 13 ++++++------- openhantek/src/hantekdso/hantekdsocontrol.cpp | 50 +++----------------------------------------------- openhantek/src/hantekdso/hantekdsocontrol.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ openhantek/src/hantekdso/softwaretrigger.cpp | 8 +++----- openhantek/src/hantekdso/softwaretrigger.h | 1 - openhantek/src/hantekdso/softwaretriggersettings.h | 5 ----- openhantek/src/main.cpp | 2 +- openhantek/src/mainwindow.cpp | 8 +++++--- openhantek/src/scopesettings.h | 37 +++++++++++++++++++------------------ openhantek/src/settings.cpp | 6 ++---- 12 files changed, 85 insertions(+), 94 deletions(-) delete mode 100644 openhantek/src/hantekdso/softwaretriggersettings.h diff --git a/openhantek/src/docks/HorizontalDock.cpp b/openhantek/src/docks/HorizontalDock.cpp index 4144d32..6022c04 100644 --- a/openhantek/src/docks/HorizontalDock.cpp +++ b/openhantek/src/docks/HorizontalDock.cpp @@ -181,7 +181,7 @@ void HorizontalDock::frequencybaseSelected(double frequencybase) { /// \param samplerate The samplerate in samples/second. void HorizontalDock::samplerateSelected(double samplerate) { scope->horizontal.samplerate = samplerate; - scope->horizontal.samplerateSet = true; + scope->horizontal.samplerateSource = DsoSettingsScopeHorizontal::Samplerrate; emit samplerateChanged(samplerate); } @@ -189,7 +189,7 @@ void HorizontalDock::samplerateSelected(double samplerate) { /// \param timebase The timebase in seconds. void HorizontalDock::timebaseSelected(double timebase) { scope->horizontal.timebase = timebase; - scope->horizontal.samplerateSet = false; + scope->horizontal.samplerateSource = DsoSettingsScopeHorizontal::Duration; emit timebaseChanged(timebase); } diff --git a/openhantek/src/dsowidget.cpp b/openhantek/src/dsowidget.cpp index ec14e4c..e36dce2 100644 --- a/openhantek/src/dsowidget.cpp +++ b/openhantek/src/dsowidget.cpp @@ -78,7 +78,6 @@ DsoWidget::DsoWidget(DsoSettingsScope *scope, DsoSettingsView *view, const Dso:: markerSlider->setStep(marker, 0.2); markerSlider->setValue(marker, scope->horizontal.marker[marker]); markerSlider->setIndexVisible(marker, true); - scope->horizontal.marker_visible[marker] = true; } // The table for the settings diff --git a/openhantek/src/hantekdso/controlsettings.h b/openhantek/src/hantekdso/controlsettings.h index 519ab11..8744f3e 100644 --- a/openhantek/src/hantekdso/controlsettings.h +++ b/openhantek/src/hantekdso/controlsettings.h @@ -2,7 +2,6 @@ #include "controlspecification.h" #include "enums.h" -#include "softwaretriggersettings.h" namespace Dso { @@ -31,13 +30,13 @@ struct ControlSettingsSamplerate { /// \struct ControlSettingsTrigger hantek/control.h /// \brief Stores the current trigger settings of the device. struct ControlSettingsTrigger { - std::vector level; ///< The trigger level for each channel in V - double position = 0.0; ///< The current pretrigger position - unsigned int point = 0; ///< The trigger position in Hantek coding + std::vector level; ///< The trigger level for each channel in V + double position = 0.0; ///< The current pretrigger position + unsigned int point = 0; ///< The trigger position in Hantek coding Dso::TriggerMode mode = Dso::TriggerMode::NORMAL; ///< The trigger mode Dso::Slope slope = Dso::Slope::Positive; ///< The trigger slope - bool special = false; ///< true, if the trigger source is special - unsigned int source = 0; ///< The trigger source + bool special = false; ///< true, if the trigger source is special + unsigned int source = 0; ///< The trigger source }; ////////////////////////////////////////////////////////////////////////////// @@ -60,6 +59,6 @@ struct ControlSettings { ControlSettingsTrigger trigger; ///< The trigger settings RecordLengthID recordLengthId = 1; ///< The id in the record length array unsigned usedChannels = 0; ///< Number of activated channels - SoftwareTriggerSettings swTrigger; + unsigned swSampleMargin = 2000; ///< Software trigger, sample margin }; } diff --git a/openhantek/src/hantekdso/hantekdsocontrol.cpp b/openhantek/src/hantekdso/hantekdsocontrol.cpp index b2bc546..e4771a6 100644 --- a/openhantek/src/hantekdso/hantekdsocontrol.cpp +++ b/openhantek/src/hantekdso/hantekdsocontrol.cpp @@ -603,9 +603,6 @@ void HantekDsoControl::updateSamplerateLimits() { limits->max / specification.bufferDividers[controlsettings.recordLengthId]); } -/// \brief Sets the size of the oscilloscopes sample buffer. -/// \param index The record length index that should be set. -/// \return The record length that has been set, 0 on error. Dso::ErrorCode HantekDsoControl::setRecordLength(unsigned index) { if (!device->isConnected()) return Dso::ErrorCode::CONNECTION; @@ -618,10 +615,6 @@ Dso::ErrorCode HantekDsoControl::setRecordLength(unsigned index) { return Dso::ErrorCode::NONE; } -/// \brief Sets the samplerate of the oscilloscope. -/// \param samplerate The samplerate that should be met (S/s), 0.0 to restore -/// current samplerate. -/// \return The samplerate that has been set, 0.0 on error. Dso::ErrorCode HantekDsoControl::setSamplerate(double samplerate) { if (!device->isConnected()) return Dso::ErrorCode::CONNECTION; @@ -659,7 +652,7 @@ Dso::ErrorCode HantekDsoControl::setSamplerate(double samplerate) { // Check for Roll mode if (!isRollMode()) - emit recordTimeChanged((double)(getRecordLength() - controlsettings.swTrigger.sampleMargin) / + emit recordTimeChanged((double)(getRecordLength() - controlsettings.swSampleMargin) / controlsettings.samplerate.current); emit samplerateChanged(controlsettings.samplerate.current); @@ -667,10 +660,6 @@ Dso::ErrorCode HantekDsoControl::setSamplerate(double samplerate) { } } -/// \brief Sets the time duration of one aquisition by adapting the samplerate. -/// \param duration The record time duration that should be met (s), 0.0 to -/// restore current record time. -/// \return The record time duration that has been set, 0.0 on error. Dso::ErrorCode HantekDsoControl::setRecordTime(double duration) { if (!device->isConnected()) return Dso::ErrorCode::CONNECTION; @@ -706,10 +695,10 @@ Dso::ErrorCode HantekDsoControl::setRecordTime(double duration) { // For now - we go for the 10240 size sampling - the other seems not to be supported // Find highest samplerate using less than 10240 samples to obtain our duration. unsigned sampleCount = 10240; + if (specification.isSoftwareTriggerDevice) sampleCount -= controlsettings.swSampleMargin; unsigned sampleId; for (sampleId = 0; sampleId < specification.fixedSampleRates.size(); ++sampleId) { - if (specification.fixedSampleRates[sampleId].samplerate * duration < - (sampleCount - controlsettings.swTrigger.sampleMargin)) + if (specification.fixedSampleRates[sampleId].samplerate * duration < sampleCount) break; } // Usable sample value @@ -722,10 +711,6 @@ Dso::ErrorCode HantekDsoControl::setRecordTime(double duration) { } } -/// \brief Enables/disables filtering of the given channel. -/// \param channel The channel that should be set. -/// \param used true if the channel should be sampled. -/// \return See ::Dso::ErrorCode. Dso::ErrorCode HantekDsoControl::setChannelUsed(ChannelID channel, bool used) { if (!device->isConnected()) return Dso::ErrorCode::CONNECTION; @@ -783,10 +768,6 @@ Dso::ErrorCode HantekDsoControl::setChannelUsed(ChannelID channel, bool used) { return Dso::ErrorCode::NONE; } -/// \brief Set the coupling for the given channel. -/// \param channel The channel that should be set. -/// \param coupling The new coupling for the channel. -/// \return See ::Dso::ErrorCode. Dso::ErrorCode HantekDsoControl::setCoupling(ChannelID channel, Dso::Coupling coupling) { if (!device->isConnected()) return Dso::ErrorCode::CONNECTION; @@ -801,11 +782,6 @@ Dso::ErrorCode HantekDsoControl::setCoupling(ChannelID channel, Dso::Coupling co return Dso::ErrorCode::NONE; } -/// \brief Sets the gain for the given channel. -/// Get the actual gain by specification.gainSteps[gainId] -/// \param channel The channel that should be set. -/// \param gain The gain that should be met (V/div). -/// \return The gain that has been set, ::Dso::ErrorCode on error. Dso::ErrorCode HantekDsoControl::setGain(ChannelID channel, double gain) { if (!device->isConnected()) return Dso::ErrorCode::CONNECTION; @@ -842,10 +818,6 @@ Dso::ErrorCode HantekDsoControl::setGain(ChannelID channel, double gain) { return Dso::ErrorCode::NONE; } -/// \brief Set the offset for the given channel. -/// Get the actual offset for the channel from controlsettings.voltage[channel].offsetReal -/// \param channel The channel that should be set. -/// \param offset The new offset value (0.0 - 1.0). Dso::ErrorCode HantekDsoControl::setOffset(ChannelID channel, const double offset) { if (!device->isConnected()) return Dso::ErrorCode::CONNECTION; @@ -873,8 +845,6 @@ Dso::ErrorCode HantekDsoControl::setOffset(ChannelID channel, const double offse return Dso::ErrorCode::NONE; } -/// \brief Set the trigger mode. -/// \return See ::Dso::ErrorCode. Dso::ErrorCode HantekDsoControl::setTriggerMode(Dso::TriggerMode mode) { if (!device->isConnected()) return Dso::ErrorCode::CONNECTION; @@ -882,10 +852,6 @@ Dso::ErrorCode HantekDsoControl::setTriggerMode(Dso::TriggerMode mode) { return Dso::ErrorCode::NONE; } -/// \brief Set the trigger source. -/// \param special true for a special channel (EXT, ...) as trigger source. -/// \param id The number of the channel, that should be used as trigger. -/// \return See ::Dso::ErrorCode. Dso::ErrorCode HantekDsoControl::setTriggerSource(bool special, unsigned id) { if (!device->isConnected()) return Dso::ErrorCode::CONNECTION; if (specification.isSoftwareTriggerDevice) return Dso::ErrorCode::UNSUPPORTED; @@ -932,10 +898,6 @@ Dso::ErrorCode HantekDsoControl::setTriggerSource(bool special, unsigned id) { return Dso::ErrorCode::NONE; } -/// \brief Set the trigger level. -/// \param channel The channel that should be set. -/// \param level The new trigger level (V). -/// \return The trigger level that has been set, ::Dso::ErrorCode on error. Dso::ErrorCode HantekDsoControl::setTriggerLevel(ChannelID channel, double level) { if (!device->isConnected()) return Dso::ErrorCode::CONNECTION; @@ -977,9 +939,6 @@ Dso::ErrorCode HantekDsoControl::setTriggerLevel(ChannelID channel, double level return Dso::ErrorCode::NONE; } -/// \brief Set the trigger slope. -/// \param slope The Slope that should cause a trigger. -/// \return See ::Dso::ErrorCode. Dso::ErrorCode HantekDsoControl::setTriggerSlope(Dso::Slope slope) { if (!device->isConnected()) return Dso::ErrorCode::CONNECTION; @@ -1009,9 +968,6 @@ Dso::ErrorCode HantekDsoControl::setTriggerSlope(Dso::Slope slope) { void HantekDsoControl::forceTrigger() { modifyCommand(BulkCode::FORCETRIGGER); } -/// \brief Set the trigger position. -/// \param position The new trigger position (in s). -/// \return The trigger position that has been set. Dso::ErrorCode HantekDsoControl::setPretriggerPosition(double position) { if (!device->isConnected()) return Dso::ErrorCode::CONNECTION; diff --git a/openhantek/src/hantekdso/hantekdsocontrol.h b/openhantek/src/hantekdso/hantekdsocontrol.h index 54b805e..3fd3bf1 100644 --- a/openhantek/src/hantekdso/hantekdsocontrol.h +++ b/openhantek/src/hantekdso/hantekdsocontrol.h @@ -201,19 +201,63 @@ class HantekDsoControl : public QObject { void startSampling(); void stopSampling(); + /// \brief Sets the size of the oscilloscopes sample buffer. + /// \param index The record length index that should be set. + /// \return The record length that has been set, 0 on error. Dso::ErrorCode setRecordLength(unsigned size); + /// \brief Sets the samplerate of the oscilloscope. + /// \param samplerate The samplerate that should be met (S/s), 0.0 to restore + /// current samplerate. + /// \return The samplerate that has been set, 0.0 on error. Dso::ErrorCode setSamplerate(double samplerate = 0.0); + /// \brief Sets the time duration of one aquisition by adapting the samplerate. + /// \param duration The record time duration that should be met (s), 0.0 to + /// restore current record time. + /// \return The record time duration that has been set, 0.0 on error. Dso::ErrorCode setRecordTime(double duration = 0.0); + /// \brief Enables/disables filtering of the given channel. + /// \param channel The channel that should be set. + /// \param used true if the channel should be sampled. + /// \return See ::Dso::ErrorCode. Dso::ErrorCode setChannelUsed(ChannelID channel, bool used); + /// \brief Set the coupling for the given channel. + /// \param channel The channel that should be set. + /// \param coupling The new coupling for the channel. + /// \return See ::Dso::ErrorCode. Dso::ErrorCode setCoupling(ChannelID channel, Dso::Coupling coupling); + /// \brief Sets the gain for the given channel. + /// Get the actual gain by specification.gainSteps[gainId] + /// \param channel The channel that should be set. + /// \param gain The gain that should be met (V/div). + /// \return The gain that has been set, ::Dso::ErrorCode on error. Dso::ErrorCode setGain(ChannelID channel, double gain); + /// \brief Set the offset for the given channel. + /// Get the actual offset for the channel from controlsettings.voltage[channel].offsetReal + /// \param channel The channel that should be set. + /// \param offset The new offset value (0.0 - 1.0). Dso::ErrorCode setOffset(ChannelID channel, const double offset); + /// \brief Set the trigger mode. + /// \return See ::Dso::ErrorCode. Dso::ErrorCode setTriggerMode(Dso::TriggerMode mode); + /// \brief Set the trigger source. + /// \param special true for a special channel (EXT, ...) as trigger source. + /// \param id The number of the channel, that should be used as trigger. + /// \return See ::Dso::ErrorCode. Dso::ErrorCode setTriggerSource(bool special, unsigned id); + /// \brief Set the trigger level. + /// \param channel The channel that should be set. + /// \param level The new trigger level (V). + /// \return The trigger level that has been set, ::Dso::ErrorCode on error. Dso::ErrorCode setTriggerLevel(ChannelID channel, double level); + /// \brief Set the trigger slope. + /// \param slope The Slope that should cause a trigger. + /// \return See ::Dso::ErrorCode. Dso::ErrorCode setTriggerSlope(Dso::Slope slope); + /// \brief Set the trigger position. + /// \param position The new trigger position (in s). + /// \return The trigger position that has been set. Dso::ErrorCode setPretriggerPosition(double position); void forceTrigger(); diff --git a/openhantek/src/hantekdso/softwaretrigger.cpp b/openhantek/src/hantekdso/softwaretrigger.cpp index 214911f..bdf78e1 100644 --- a/openhantek/src/hantekdso/softwaretrigger.cpp +++ b/openhantek/src/hantekdso/softwaretrigger.cpp @@ -42,8 +42,6 @@ SoftwareTrigger::PrePostStartTriggerSamples SoftwareTrigger::computeTY(const Dat preTrigSamples = (unsigned)(scope->trigger.position * samplesDisplay); postTrigSamples = (unsigned)sampleCount - ((unsigned)samplesDisplay - preTrigSamples); - const int swTriggerThreshold = 7; - const int swTriggerSampleSet = 11; double prev; bool (*opcmp)(double,double,double); bool (*smplcmp)(double,double); @@ -60,11 +58,11 @@ SoftwareTrigger::PrePostStartTriggerSamples SoftwareTrigger::computeTY(const Dat for (unsigned int i = preTrigSamples; i < postTrigSamples; i++) { double value = samples[i]; if (opcmp(value, level, prev)) { - int rising = 0; - for (unsigned int k = i + 1; k < i + swTriggerSampleSet && k < sampleCount; k++) { + unsigned rising = 0; + for (unsigned int k = i + 1; k < i + scope->trigger.swTriggerSampleSet && k < sampleCount; k++) { if (smplcmp(samples[k], value)) { rising++; } } - if (rising > swTriggerThreshold) { + if (rising > scope->trigger.swTriggerThreshold) { swTriggerStart = i; break; } diff --git a/openhantek/src/hantekdso/softwaretrigger.h b/openhantek/src/hantekdso/softwaretrigger.h index 8e434b5..de9db8b 100644 --- a/openhantek/src/hantekdso/softwaretrigger.h +++ b/openhantek/src/hantekdso/softwaretrigger.h @@ -1,6 +1,5 @@ #pragma once #include -#include "softwaretriggersettings.h" struct DsoSettingsScope; class DataAnalyzerResult; diff --git a/openhantek/src/hantekdso/softwaretriggersettings.h b/openhantek/src/hantekdso/softwaretriggersettings.h deleted file mode 100644 index d081ae1..0000000 --- a/openhantek/src/hantekdso/softwaretriggersettings.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -struct SoftwareTriggerSettings { - const unsigned sampleMargin = 2000; -}; diff --git a/openhantek/src/main.cpp b/openhantek/src/main.cpp index 07596a4..ab9792e 100644 --- a/openhantek/src/main.cpp +++ b/openhantek/src/main.cpp @@ -33,7 +33,7 @@ void applySettingsToDevice(HantekDsoControl* dsoControl, DsoSettingsScope* scope dsoControl->setChannelUsed(channel, mathUsed | scope->anyUsed(channel)); } - if (scope->horizontal.samplerateSet) + if (scope->horizontal.samplerateSource == DsoSettingsScopeHorizontal::Samplerrate) dsoControl->setSamplerate(scope->horizontal.samplerate); else dsoControl->setRecordTime(scope->horizontal.timebase * DIVS_TIME); diff --git a/openhantek/src/mainwindow.cpp b/openhantek/src/mainwindow.cpp index 7dee534..a4dae4a 100644 --- a/openhantek/src/mainwindow.cpp +++ b/openhantek/src/mainwindow.cpp @@ -93,7 +93,8 @@ MainWindow::MainWindow(HantekDsoControl *dsoControl, DataAnalyzer *dataAnalyser, }); connect(dsoControl, &HantekDsoControl::recordTimeChanged, [this](double duration) { - if (this->settings->scope.horizontal.samplerateSet && this->settings->scope.horizontal.recordLength != UINT_MAX) { + if (this->settings->scope.horizontal.samplerateSource == DsoSettingsScopeHorizontal::Samplerrate && + this->settings->scope.horizontal.recordLength != UINT_MAX) { // The samplerate was set, let's adapt the timebase accordingly this->settings->scope.horizontal.timebase = horizontalDock->setTimebase(duration / DIVS_TIME); } @@ -106,7 +107,8 @@ MainWindow::MainWindow(HantekDsoControl *dsoControl, DataAnalyzer *dataAnalyser, dsoWidget->updateTimebase(this->settings->scope.horizontal.timebase); }); connect(dsoControl, &HantekDsoControl::samplerateChanged, [this](double samplerate) { - if (!this->settings->scope.horizontal.samplerateSet && this->settings->scope.horizontal.recordLength != UINT_MAX) { + if (this->settings->scope.horizontal.samplerateSource == DsoSettingsScopeHorizontal::Duration && + this->settings->scope.horizontal.recordLength != UINT_MAX) { // The timebase was set, let's adapt the samplerate accordingly this->settings->scope.horizontal.samplerate = samplerate; horizontalDock->setSamplerate(samplerate); @@ -259,7 +261,7 @@ MainWindow::MainWindow(HantekDsoControl *dsoControl, DataAnalyzer *dataAnalyser, }); - if (settings->scope.horizontal.samplerateSet) + if (settings->scope.horizontal.samplerateSource == DsoSettingsScopeHorizontal::Samplerrate) dsoWidget->updateSamplerate(settings->scope.horizontal.samplerate); else dsoWidget->updateTimebase(settings->scope.horizontal.timebase); diff --git a/openhantek/src/scopesettings.h b/openhantek/src/scopesettings.h index ed0f29a..6af8a19 100644 --- a/openhantek/src/scopesettings.h +++ b/openhantek/src/scopesettings.h @@ -5,9 +5,9 @@ #include #include "analyse/enums.h" +#include "hantekdso/controlspecification.h" #include "hantekdso/enums.h" #include "hantekprotocol/definitions.h" -#include "hantekdso/controlspecification.h" #include #define MARKER_COUNT 2 ///< Number of markers @@ -15,23 +15,28 @@ /// \brief Holds the settings for the horizontal axis. struct DsoSettingsScopeHorizontal { Dso::GraphFormat format = Dso::GraphFormat::TY; ///< Graph drawing mode of the scope - double frequencybase = 1e3; ///< Frequencybase in Hz/div - double marker[MARKER_COUNT] = {-1.0, 1.0}; ///< Marker positions in div - bool marker_visible[MARKER_COUNT]; - double timebase = 1e-3; ///< Timebase in s/div + double frequencybase = 1e3; ///< Frequencybase in Hz/div + double marker[MARKER_COUNT] = {-1.0, 1.0}; ///< Marker positions in div + bool marker_visible[MARKER_COUNT] = {true, true}; + unsigned int recordLength = 0; ///< Sample count + + ///TODO Use ControlSettingsSamplerateTarget + double timebase = 1e-3; ///< Timebase in s/div double samplerate = 1e6; ///< The samplerate of the oscilloscope in S - bool samplerateSet = false; ///< The samplerate was set by the user, not the timebase + enum SamplerateSource { Samplerrate, Duration } samplerateSource = Samplerrate; }; /// \brief Holds the settings for the trigger. +/// TODO Use ControlSettingsTrigger struct DsoSettingsScopeTrigger { - bool filter = true; ///< Not sure what this is good for... Dso::TriggerMode mode = Dso::TriggerMode::NORMAL; ///< Automatic, normal or single trigger - double position = 0.0; ///< Horizontal position for pretrigger + double position = 0.0; ///< Horizontal position for pretrigger Dso::Slope slope = Dso::Slope::Positive; ///< Rising or falling edge causes trigger - unsigned int source = 0; ///< Channel that is used as trigger source - bool special = false; ///< true if the trigger source is not a standard channel + unsigned int source = 0; ///< Channel that is used as trigger source + bool special = false; ///< true if the trigger source is not a standard channel + unsigned swTriggerThreshold = 7; ///< Software trigger, threshold + unsigned swTriggerSampleSet = 11; ///< Software trigger, sample set }; /// \brief Holds the settings for the spectrum analysis. @@ -44,6 +49,7 @@ struct DsoSettingsScopeSpectrum { }; /// \brief Holds the settings for the normal voltage graphs. +/// TODO Use ControlSettingsVoltage struct DsoSettingsScopeVoltage { unsigned gainStepIndex = 6; ///< The vertical resolution in V/div (default = 1.0) bool inverted = false; ///< true if the channel is inverted (mirrored on cross-axis) @@ -70,15 +76,10 @@ struct DsoSettingsScope { double spectrumReference = 0.0; ///< Reference level for spectrum in dBm double spectrumLimit = -20.0; ///< Minimum magnitude of the spectrum (Avoids peaks) - double gain(unsigned channel) const { - return gainSteps[voltage[channel].gainStepIndex]; - } - bool anyUsed(ChannelID channel) { - return voltage[channel].used | spectrum[channel].used; - } + double gain(unsigned channel) const { return gainSteps[voltage[channel].gainStepIndex]; } + bool anyUsed(ChannelID channel) { return voltage[channel].used | spectrum[channel].used; } - Dso::Coupling coupling(ChannelID channel, const Dso::ControlSpecification* deviceSpecification) { + Dso::Coupling coupling(ChannelID channel, const Dso::ControlSpecification *deviceSpecification) { return deviceSpecification->couplings[voltage[channel].couplingIndex]; } - }; diff --git a/openhantek/src/settings.cpp b/openhantek/src/settings.cpp index dfdc2a6..1361189 100644 --- a/openhantek/src/settings.cpp +++ b/openhantek/src/settings.cpp @@ -84,11 +84,10 @@ void DsoSettings::load() { if (store->contains("timebase")) scope.horizontal.timebase = store->value("timebase").toDouble(); if (store->contains("recordLength")) scope.horizontal.recordLength = store->value("recordLength").toUInt(); if (store->contains("samplerate")) scope.horizontal.samplerate = store->value("samplerate").toDouble(); - if (store->contains("samplerateSet")) scope.horizontal.samplerateSet = store->value("samplerateSet").toBool(); + if (store->contains("samplerateSet")) scope.horizontal.samplerateSource = (DsoSettingsScopeHorizontal::SamplerateSource)store->value("samplerateSet").toInt(); store->endGroup(); // Trigger store->beginGroup("trigger"); - if (store->contains("filter")) scope.trigger.filter = store->value("filter").toBool(); if (store->contains("mode")) scope.trigger.mode = (Dso::TriggerMode)store->value("mode").toUInt(); if (store->contains("position")) scope.trigger.position = store->value("position").toDouble(); if (store->contains("slope")) scope.trigger.slope = (Dso::Slope)store->value("slope").toUInt(); @@ -186,11 +185,10 @@ void DsoSettings::save() { store->setValue("timebase", scope.horizontal.timebase); store->setValue("recordLength", scope.horizontal.recordLength); store->setValue("samplerate", scope.horizontal.samplerate); - store->setValue("samplerateSet", scope.horizontal.samplerateSet); + store->setValue("samplerateSet", (int)scope.horizontal.samplerateSource); store->endGroup(); // Trigger store->beginGroup("trigger"); - store->setValue("filter", scope.trigger.filter); store->setValue("mode", (unsigned)scope.trigger.mode); store->setValue("position", scope.trigger.position); store->setValue("slope", (unsigned)scope.trigger.slope); -- libgit2 0.21.4