Commit 86d3b6e9da09e5d8838f200024baf69f217e0d99
Committed by
David Gräff
1 parent
792ab9cd
Rename trigger modes. 'Auto' is 'Wait/Force' now. 'Normal' is 'Hard-/Software'. …
… Only show supported trigger modes. 6022 do not support 'Wait/Force' for example.
Showing
17 changed files
with
86 additions
and
81 deletions
openhantek/src/docks/TriggerDock.cpp
| ... | ... | @@ -16,21 +16,22 @@ |
| 16 | 16 | #include "sispinbox.h" |
| 17 | 17 | #include "utils/dsoStrings.h" |
| 18 | 18 | #include "utils/printutils.h" |
| 19 | +#include "hantekdso/controlspecification.h" | |
| 19 | 20 | |
| 20 | -TriggerDock::TriggerDock(DsoSettings *settings, const std::vector<std::string> &specialTriggers, QWidget *parent, | |
| 21 | +TriggerDock::TriggerDock(DsoSettingsScope *scope, const Dso::ControlSpecification* spec, QWidget *parent, | |
| 21 | 22 | Qt::WindowFlags flags) |
| 22 | - : QDockWidget(tr("Trigger"), parent, flags), settings(settings) { | |
| 23 | + : QDockWidget(tr("Trigger"), parent, flags), scope(scope), spec(spec) { | |
| 23 | 24 | |
| 24 | 25 | // Initialize lists for comboboxes |
| 25 | - for (ChannelID channel = 0; channel < settings->deviceSpecification->channels; ++channel) | |
| 26 | + for (ChannelID channel = 0; channel < spec->channels; ++channel) | |
| 26 | 27 | this->sourceStandardStrings << tr("CH%1").arg(channel + 1); |
| 27 | - for(const std::string& name: specialTriggers) | |
| 28 | - this->sourceSpecialStrings.append(QString::fromStdString(name)); | |
| 28 | + for(const Dso::SpecialTriggerChannel& specialTrigger: spec->specialTriggerChannels) | |
| 29 | + this->sourceSpecialStrings.append(QString::fromStdString(specialTrigger.name)); | |
| 29 | 30 | |
| 30 | 31 | // Initialize elements |
| 31 | 32 | this->modeLabel = new QLabel(tr("Mode")); |
| 32 | 33 | this->modeComboBox = new QComboBox(); |
| 33 | - for (Dso::TriggerMode mode: Dso::TriggerModeEnum) | |
| 34 | + for (Dso::TriggerMode mode: spec->triggerModes) | |
| 34 | 35 | this->modeComboBox->addItem(Dso::triggerModeString(mode)); |
| 35 | 36 | |
| 36 | 37 | this->slopeLabel = new QLabel(tr("Slope")); |
| ... | ... | @@ -56,14 +57,19 @@ TriggerDock::TriggerDock(DsoSettings *settings, const std::vector<std::string> & |
| 56 | 57 | this->dockWidget = new QWidget(); |
| 57 | 58 | SetupDockWidget(this, dockWidget, dockLayout); |
| 58 | 59 | |
| 60 | + // Set values | |
| 61 | + setMode(scope->trigger.mode); | |
| 62 | + setSlope(scope->trigger.slope); | |
| 63 | + setSource(scope->trigger.special, scope->trigger.source); | |
| 64 | + | |
| 59 | 65 | // Connect signals and slots |
| 60 | - connect(this->modeComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [this](int index) { | |
| 61 | - this->settings->scope.trigger.mode = (Dso::TriggerMode)index; | |
| 62 | - emit modeChanged(this->settings->scope.trigger.mode); | |
| 66 | + connect(this->modeComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [this,spec](int index) { | |
| 67 | + this->scope->trigger.mode = spec->triggerModes[(unsigned)index]; | |
| 68 | + emit modeChanged(this->scope->trigger.mode); | |
| 63 | 69 | }); |
| 64 | 70 | connect(this->slopeComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [this](int index) { |
| 65 | - this->settings->scope.trigger.slope = (Dso::Slope)index; | |
| 66 | - emit slopeChanged(this->settings->scope.trigger.slope); | |
| 71 | + this->scope->trigger.slope = (Dso::Slope)index; | |
| 72 | + emit slopeChanged(this->scope->trigger.slope); | |
| 67 | 73 | }); |
| 68 | 74 | connect(this->sourceComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [this](int index) { |
| 69 | 75 | bool special = false; |
| ... | ... | @@ -73,15 +79,10 @@ TriggerDock::TriggerDock(DsoSettings *settings, const std::vector<std::string> & |
| 73 | 79 | special = true; |
| 74 | 80 | } |
| 75 | 81 | |
| 76 | - this->settings->scope.trigger.source = (unsigned) index; | |
| 77 | - this->settings->scope.trigger.special = special; | |
| 82 | + this->scope->trigger.source = (unsigned) index; | |
| 83 | + this->scope->trigger.special = special; | |
| 78 | 84 | emit sourceChanged(special, (unsigned)index); |
| 79 | 85 | }); |
| 80 | - | |
| 81 | - // Set values | |
| 82 | - this->setMode(settings->scope.trigger.mode); | |
| 83 | - this->setSlope(settings->scope.trigger.slope); | |
| 84 | - this->setSource(settings->scope.trigger.special, settings->scope.trigger.source); | |
| 85 | 86 | } |
| 86 | 87 | |
| 87 | 88 | /// \brief Don't close the dock, just hide it |
| ... | ... | @@ -93,8 +94,9 @@ void TriggerDock::closeEvent(QCloseEvent *event) { |
| 93 | 94 | } |
| 94 | 95 | |
| 95 | 96 | void TriggerDock::setMode(Dso::TriggerMode mode) { |
| 97 | + int index = std::find(spec->triggerModes.begin(),spec->triggerModes.end(), mode) - spec->triggerModes.begin(); | |
| 96 | 98 | QSignalBlocker blocker(modeComboBox); |
| 97 | - modeComboBox->setCurrentIndex((int)mode); | |
| 99 | + modeComboBox->setCurrentIndex(index); | |
| 98 | 100 | } |
| 99 | 101 | |
| 100 | 102 | void TriggerDock::setSlope(Dso::Slope slope) { | ... | ... |
openhantek/src/docks/TriggerDock.h
| ... | ... | @@ -4,14 +4,17 @@ |
| 4 | 4 | |
| 5 | 5 | #include <QDockWidget> |
| 6 | 6 | #include <QGridLayout> |
| 7 | +#include <QLabel> | |
| 8 | +#include <QCheckBox> | |
| 9 | +#include <QComboBox> | |
| 7 | 10 | |
| 8 | -#include "settings.h" | |
| 9 | - | |
| 10 | -class QLabel; | |
| 11 | -class QCheckBox; | |
| 12 | -class QComboBox; | |
| 11 | +#include "hantekdso/enums.h" | |
| 13 | 12 | |
| 14 | 13 | class SiSpinBox; |
| 14 | +class DsoSettingsScope; | |
| 15 | +namespace Dso { | |
| 16 | +struct ControlSpecification; | |
| 17 | +} | |
| 15 | 18 | |
| 16 | 19 | /// \brief Dock window for the trigger settings. |
| 17 | 20 | /// It contains the settings for the trigger mode, source and slope. |
| ... | ... | @@ -21,10 +24,10 @@ class TriggerDock : public QDockWidget { |
| 21 | 24 | public: |
| 22 | 25 | /// \brief Initializes the trigger settings docking window. |
| 23 | 26 | /// \param settings The target settings object. |
| 24 | - /// \param specialTriggers The names of the special trigger sources. | |
| 27 | + /// \param spec | |
| 25 | 28 | /// \param parent The parent widget. |
| 26 | 29 | /// \param flags Flags for the window manager. |
| 27 | - TriggerDock(DsoSettings *settings, const std::vector<std::string>& specialTriggers, QWidget *parent, Qt::WindowFlags flags = 0); | |
| 30 | + TriggerDock(DsoSettingsScope *scope, const Dso::ControlSpecification* spec, QWidget *parent, Qt::WindowFlags flags = 0); | |
| 28 | 31 | |
| 29 | 32 | /// \brief Changes the trigger mode if the new mode is supported. |
| 30 | 33 | /// \param mode The trigger mode. |
| ... | ... | @@ -51,13 +54,11 @@ class TriggerDock : public QDockWidget { |
| 51 | 54 | QComboBox *sourceComboBox; ///< Select the source for triggering |
| 52 | 55 | QComboBox *slopeComboBox; ///< Select the slope that causes triggering |
| 53 | 56 | |
| 54 | - DsoSettings *settings; ///< The settings provided by the parent class | |
| 57 | + DsoSettingsScope *scope; ///< The settings provided by the parent class | |
| 58 | + const Dso::ControlSpecification* spec; | |
| 55 | 59 | |
| 56 | - QStringList modeStrings; ///< Strings for the trigger modes | |
| 57 | 60 | QStringList sourceStandardStrings; ///< Strings for the standard trigger sources |
| 58 | 61 | QStringList sourceSpecialStrings; ///< Strings for the special trigger sources |
| 59 | - QStringList slopeStrings; ///< Strings for the trigger slopes | |
| 60 | - | |
| 61 | 62 | signals: |
| 62 | 63 | void modeChanged(Dso::TriggerMode); ///< The trigger mode has been changed |
| 63 | 64 | void sourceChanged(bool special, unsigned int id); ///< The trigger source has been changed | ... | ... |
openhantek/src/dsowidget.cpp
| ... | ... | @@ -441,7 +441,7 @@ void DsoWidget::doShowNewData() { |
| 441 | 441 | exportNextFrame.reset(nullptr); |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - bool triggered = generator->generateGraphs(data.get(), view->digitalPhosphorDraws(),scope,spec->channels); | |
| 444 | + bool triggered = generator->generateGraphs(data.get(), view->digitalPhosphorDraws(), scope, spec); | |
| 445 | 445 | |
| 446 | 446 | QPalette triggerLabelPalette = palette(); |
| 447 | 447 | triggerLabelPalette.setColor(QPalette::WindowText, Qt::black); | ... | ... |
openhantek/src/glgenerator.cpp
| ... | ... | @@ -9,6 +9,7 @@ |
| 9 | 9 | #include "analyse/dataanalyzerresult.h" |
| 10 | 10 | #include "viewconstants.h" |
| 11 | 11 | #include "hantekdso/softwaretrigger.h" |
| 12 | +#include "hantekdso/controlspecification.h" | |
| 12 | 13 | |
| 13 | 14 | static const SampleValues& useSamplesOf(Dso::ChannelMode mode, ChannelID channel, const DataAnalyzerResult *result, const DsoSettingsScope *scope) { |
| 14 | 15 | static SampleValues emptyDefault; |
| ... | ... | @@ -121,7 +122,7 @@ const std::vector<GLfloat> &GlGenerator::grid(int a) const { return vaGrid[a]; } |
| 121 | 122 | bool GlGenerator::isReady() const { return ready; } |
| 122 | 123 | |
| 123 | 124 | bool GlGenerator::generateGraphs(const DataAnalyzerResult *result, unsigned digitalPhosphorDepth, |
| 124 | - const DsoSettingsScope *scope, unsigned physicalChannels) { | |
| 125 | + const DsoSettingsScope *scope, const Dso::ControlSpecification* spec) { | |
| 125 | 126 | |
| 126 | 127 | // Handle all digital phosphor related list manipulations |
| 127 | 128 | for (Dso::ChannelMode mode: Dso::ChannelModeEnum) { |
| ... | ... | @@ -149,7 +150,9 @@ bool GlGenerator::generateGraphs(const DataAnalyzerResult *result, unsigned digi |
| 149 | 150 | |
| 150 | 151 | switch (scope->horizontal.format) { |
| 151 | 152 | case Dso::GraphFormat::TY: |
| 152 | - std::tie(preTrigSamples, postTrigSamples, swTriggerStart) = SoftwareTrigger::computeTY(result, scope, physicalChannels); | |
| 153 | + // check trigger point for software trigger | |
| 154 | + if (spec->isSoftwareTriggerDevice && scope->trigger.source < spec->channels) | |
| 155 | + std::tie(preTrigSamples, postTrigSamples, swTriggerStart) = SoftwareTrigger::compute(result, scope); | |
| 153 | 156 | triggered = postTrigSamples > preTrigSamples; |
| 154 | 157 | |
| 155 | 158 | // Add graphs for channels | ... | ... |
openhantek/src/glgenerator.h
| ... | ... | @@ -12,6 +12,9 @@ |
| 12 | 12 | |
| 13 | 13 | struct DsoSettingsScope; |
| 14 | 14 | class DataAnalyzerResult; |
| 15 | +namespace Dso { | |
| 16 | +struct ControlSpecification; | |
| 17 | +} | |
| 15 | 18 | |
| 16 | 19 | //////////////////////////////////////////////////////////////////////////////// |
| 17 | 20 | /// \class GlGenerator |
| ... | ... | @@ -26,7 +29,7 @@ class GlGenerator : public QObject { |
| 26 | 29 | |
| 27 | 30 | GlGenerator(); |
| 28 | 31 | bool generateGraphs(const DataAnalyzerResult *result, unsigned digitalPhosphorDepth, const DsoSettingsScope *scope, |
| 29 | - unsigned physicalChannels); | |
| 32 | + const Dso::ControlSpecification *spec); | |
| 30 | 33 | const std::vector<GLfloat> &channel(Dso::ChannelMode mode, ChannelID channel, unsigned index) const; |
| 31 | 34 | |
| 32 | 35 | const std::vector<GLfloat> &grid(int a) const; | ... | ... |
openhantek/src/hantekdso/controlsettings.h
| ... | ... | @@ -33,7 +33,7 @@ struct ControlSettingsTrigger { |
| 33 | 33 | std::vector<double> level; ///< The trigger level for each channel in V |
| 34 | 34 | double position = 0.0; ///< The current pretrigger position |
| 35 | 35 | unsigned int point = 0; ///< The trigger position in Hantek coding |
| 36 | - Dso::TriggerMode mode = Dso::TriggerMode::NORMAL; ///< The trigger mode | |
| 36 | + Dso::TriggerMode mode = Dso::TriggerMode::HARDWARE_SOFTWARE; ///< The trigger mode | |
| 37 | 37 | Dso::Slope slope = Dso::Slope::Positive; ///< The trigger slope |
| 38 | 38 | bool special = false; ///< true, if the trigger source is special |
| 39 | 39 | unsigned int source = 0; ///< The trigger source | ... | ... |
openhantek/src/hantekdso/controlspecification.h
| ... | ... | @@ -86,6 +86,7 @@ struct ControlSpecification { |
| 86 | 86 | |
| 87 | 87 | std::vector<SpecialTriggerChannel> specialTriggerChannels; |
| 88 | 88 | std::vector<Coupling> couplings = {Dso::Coupling::DC, Dso::Coupling::AC}; |
| 89 | + std::vector<TriggerMode> triggerModes = {TriggerMode::HARDWARE_SOFTWARE, TriggerMode::WAIT_FORCE, TriggerMode::SINGLE}; | |
| 89 | 90 | |
| 90 | 91 | bool isFixedSamplerateDevice = false; |
| 91 | 92 | bool isSoftwareTriggerDevice = false; | ... | ... |
openhantek/src/hantekdso/enums.cpp
| 1 | 1 | #include "enums.h" |
| 2 | 2 | |
| 3 | 3 | namespace Dso { |
| 4 | - Enum<Dso::TriggerMode, Dso::TriggerMode::AUTO, Dso::TriggerMode::SOFTWARE> TriggerModeEnum; | |
| 4 | + Enum<Dso::TriggerMode, Dso::TriggerMode::HARDWARE_SOFTWARE, Dso::TriggerMode::SINGLE> TriggerModeEnum; | |
| 5 | 5 | Enum<Dso::Slope, Dso::Slope::Positive, Dso::Slope::Negative> SlopeEnum; |
| 6 | 6 | Enum<Dso::GraphFormat, Dso::GraphFormat::TY, Dso::GraphFormat::XY> GraphFormatEnum; |
| 7 | 7 | Enum<Dso::ChannelMode, Dso::ChannelMode::Voltage, Dso::ChannelMode::Spectrum> ChannelModeEnum; | ... | ... |
openhantek/src/hantekdso/enums.h
| ... | ... | @@ -6,7 +6,7 @@ namespace Dso { |
| 6 | 6 | /// \enum ChannelMode |
| 7 | 7 | /// \brief The channel display modes. |
| 8 | 8 | enum class ChannelMode { |
| 9 | - Voltage, ///< Standard voltage view | |
| 9 | + Voltage, ///< Standard voltage view | |
| 10 | 10 | Spectrum ///< Spectrum view |
| 11 | 11 | }; |
| 12 | 12 | constexpr int ChannelModes = 2; |
| ... | ... | @@ -15,8 +15,8 @@ extern Enum<Dso::ChannelMode, Dso::ChannelMode::Voltage, Dso::ChannelMode::Spect |
| 15 | 15 | /// \enum GraphFormat |
| 16 | 16 | /// \brief The possible viewing formats for the graphs on the scope. |
| 17 | 17 | enum GraphFormat { |
| 18 | - TY, ///< The standard mode | |
| 19 | - XY ///< CH1 on X-axis, CH2 on Y-axis | |
| 18 | + TY, ///< The standard mode | |
| 19 | + XY ///< CH1 on X-axis, CH2 on Y-axis | |
| 20 | 20 | }; |
| 21 | 21 | |
| 22 | 22 | extern Enum<Dso::GraphFormat, Dso::GraphFormat::TY, Dso::GraphFormat::XY> GraphFormatEnum; |
| ... | ... | @@ -32,12 +32,11 @@ enum class Coupling { |
| 32 | 32 | /// \enum TriggerMode |
| 33 | 33 | /// \brief The different triggering modes. |
| 34 | 34 | enum class TriggerMode { |
| 35 | - AUTO, ///< Automatic without trigger event | |
| 36 | - NORMAL, ///< Normal mode | |
| 37 | - SINGLE, ///< Stop after the first trigger event | |
| 38 | - SOFTWARE ///< Software trigger mode | |
| 35 | + HARDWARE_SOFTWARE, ///< Normal hardware trigger (or software trigger) mode | |
| 36 | + WAIT_FORCE, ///< Automatic without trigger event | |
| 37 | + SINGLE ///< Stop after the first trigger event | |
| 39 | 38 | }; |
| 40 | -extern Enum<Dso::TriggerMode, Dso::TriggerMode::AUTO, Dso::TriggerMode::SOFTWARE> TriggerModeEnum; | |
| 39 | +extern Enum<Dso::TriggerMode, Dso::TriggerMode::HARDWARE_SOFTWARE, Dso::TriggerMode::SINGLE> TriggerModeEnum; | |
| 41 | 40 | |
| 42 | 41 | /// \enum Slope |
| 43 | 42 | /// \brief The slope that causes a trigger. | ... | ... |
openhantek/src/hantekdso/hantekdsocontrol.cpp
| ... | ... | @@ -49,12 +49,6 @@ void HantekDsoControl::stopSampling() { |
| 49 | 49 | emit samplingStopped(); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | -const std::vector<std::string> HantekDsoControl::getSpecialTriggerSources() { | |
| 53 | - std::vector<std::string> sources; | |
| 54 | - for (auto &v : specification.specialTriggerChannels) { sources.push_back(v.name); } | |
| 55 | - return sources; | |
| 56 | -} | |
| 57 | - | |
| 58 | 52 | USBDevice *HantekDsoControl::getDevice() { return device; } |
| 59 | 53 | |
| 60 | 54 | const DSOsamples &HantekDsoControl::getLastSamples() { return result; } |
| ... | ... | @@ -1236,7 +1230,7 @@ void HantekDsoControl::run() { |
| 1236 | 1230 | // Sampling hasn't started, update the expected sample count |
| 1237 | 1231 | expectedSampleCount = this->getSampleCount(); |
| 1238 | 1232 | |
| 1239 | - if (this->_samplingStarted && this->lastTriggerMode == controlsettings.trigger.mode) { | |
| 1233 | + if (_samplingStarted && lastTriggerMode == controlsettings.trigger.mode) { | |
| 1240 | 1234 | ++this->cycleCounter; |
| 1241 | 1235 | |
| 1242 | 1236 | if (this->cycleCounter == this->startCycle && !isRollMode()) { |
| ... | ... | @@ -1252,8 +1246,8 @@ void HantekDsoControl::run() { |
| 1252 | 1246 | } |
| 1253 | 1247 | |
| 1254 | 1248 | timestampDebug("Enabling trigger"); |
| 1255 | - } else if (this->cycleCounter >= 8 + this->startCycle && | |
| 1256 | - controlsettings.trigger.mode == Dso::TriggerMode::AUTO) { | |
| 1249 | + } else if (cycleCounter >= 8 + this->startCycle && | |
| 1250 | + controlsettings.trigger.mode == Dso::TriggerMode::WAIT_FORCE) { | |
| 1257 | 1251 | // Force triggering |
| 1258 | 1252 | errorCode = device->bulkCommand(getCommand(BulkCode::FORCETRIGGER)); |
| 1259 | 1253 | if (errorCode < 0) { | ... | ... |
openhantek/src/hantekdso/hantekdsocontrol.h
| ... | ... | @@ -74,9 +74,6 @@ class HantekDsoControl : public QObject { |
| 74 | 74 | /// \return The maximum samplerate for the current configuration in S/s. |
| 75 | 75 | double getMaxSamplerate(); |
| 76 | 76 | |
| 77 | - /// \brief Get a list of the names of the special trigger sources. | |
| 78 | - const std::vector<std::string> getSpecialTriggerSources(); | |
| 79 | - | |
| 80 | 77 | /// Return the associated usb device. |
| 81 | 78 | USBDevice *getDevice(); |
| 82 | 79 | ... | ... |
openhantek/src/hantekdso/models/modelDSO6022.cpp
| ... | ... | @@ -34,6 +34,7 @@ ModelDSO6022BE::ModelDSO6022BE() : DSOModel(ID, 0x04b5, 0x6022, 0x04b4, 0x6022, |
| 34 | 34 | specification.sampleSize = 8; |
| 35 | 35 | |
| 36 | 36 | specification.couplings = {Dso::Coupling::DC}; |
| 37 | + specification.triggerModes = {Dso::TriggerMode::HARDWARE_SOFTWARE, Dso::TriggerMode::SINGLE}; | |
| 37 | 38 | } |
| 38 | 39 | |
| 39 | 40 | void ModelDSO6022BE::applyRequirements(HantekDsoControl *dsoControl) const { | ... | ... |
openhantek/src/hantekdso/softwaretrigger.cpp
| 1 | 1 | #include "softwaretrigger.h" |
| 2 | 2 | #include "analyse/dataanalyzerresult.h" |
| 3 | -#include "settings.h" | |
| 3 | +#include "scopesettings.h" | |
| 4 | 4 | #include "viewconstants.h" |
| 5 | 5 | #include "utils/printutils.h" |
| 6 | 6 | |
| 7 | -SoftwareTrigger::PrePostStartTriggerSamples SoftwareTrigger::computeTY(const DataAnalyzerResult *result, | |
| 8 | - const DsoSettingsScope *scope, | |
| 9 | - unsigned physicalChannels) | |
| 7 | +SoftwareTrigger::PrePostStartTriggerSamples SoftwareTrigger::compute(const DataAnalyzerResult *data, | |
| 8 | + const DsoSettingsScope *scope) | |
| 10 | 9 | { |
| 11 | 10 | unsigned int preTrigSamples = 0; |
| 12 | 11 | unsigned int postTrigSamples = 0; |
| 13 | 12 | unsigned int swTriggerStart = 0; |
| 14 | 13 | ChannelID channel = scope->trigger.source; |
| 15 | 14 | |
| 16 | - // check trigger point for software trigger | |
| 17 | - if (scope->trigger.mode != Dso::TriggerMode::SOFTWARE || channel >= physicalChannels) | |
| 18 | - return PrePostStartTriggerSamples(preTrigSamples, postTrigSamples, swTriggerStart); | |
| 19 | - | |
| 20 | 15 | // Trigger channel not in use |
| 21 | - if (!scope->voltage[channel].used || !result->data(channel) || | |
| 22 | - result->data(channel)->voltage.sample.empty()) | |
| 16 | + if (!scope->voltage[channel].used || !data->data(channel) || | |
| 17 | + data->data(channel)->voltage.sample.empty()) | |
| 23 | 18 | return PrePostStartTriggerSamples(preTrigSamples, postTrigSamples, swTriggerStart); |
| 24 | 19 | |
| 25 | - const std::vector<double>& samples = result->data(channel)->voltage.sample; | |
| 20 | + const std::vector<double>& samples = data->data(channel)->voltage.sample; | |
| 26 | 21 | double level = scope->voltage[channel].trigger; |
| 27 | 22 | size_t sampleCount = samples.size(); |
| 28 | 23 | double timeDisplay = scope->horizontal.timebase * DIVS_TIME; | ... | ... |
openhantek/src/hantekdso/softwaretrigger.h
| ... | ... | @@ -3,11 +3,20 @@ |
| 3 | 3 | struct DsoSettingsScope; |
| 4 | 4 | class DataAnalyzerResult; |
| 5 | 5 | |
| 6 | -class SoftwareTrigger | |
| 7 | -{ | |
| 8 | -public: | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Contains software trigger algorithms. At the moment this works on the analysed data of the | |
| 9 | + * DataAnalyser class. | |
| 10 | + * TODO Should work on the raw data within HantekDsoControl | |
| 11 | + */ | |
| 12 | +class SoftwareTrigger { | |
| 13 | + public: | |
| 9 | 14 | typedef std::tuple<unsigned, unsigned, unsigned> PrePostStartTriggerSamples; |
| 10 | - static PrePostStartTriggerSamples computeTY(const DataAnalyzerResult *result, | |
| 11 | - const DsoSettingsScope *scope, | |
| 12 | - unsigned physicalChannels); | |
| 15 | + /** | |
| 16 | + * @brief Computes a software trigger point. | |
| 17 | + * @param data Analysed data from the | |
| 18 | + * @param scope Scope settings | |
| 19 | + * @return Returns a tuple of positions [preTrigger, postTrigger, startTrigger] | |
| 20 | + */ | |
| 21 | + static PrePostStartTriggerSamples compute(const DataAnalyzerResult *data, const DsoSettingsScope *scope); | |
| 13 | 22 | }; | ... | ... |
openhantek/src/mainwindow.cpp
| ... | ... | @@ -17,6 +17,8 @@ |
| 17 | 17 | #include "dsomodel.h" |
| 18 | 18 | #include "viewconstants.h" |
| 19 | 19 | |
| 20 | +#include "settings.h" | |
| 21 | + | |
| 20 | 22 | #include <QFileDialog> |
| 21 | 23 | #include <QLineEdit> |
| 22 | 24 | #include <QMessageBox> |
| ... | ... | @@ -38,7 +40,7 @@ MainWindow::MainWindow(HantekDsoControl *dsoControl, DataAnalyzer *dataAnalyser, |
| 38 | 40 | |
| 39 | 41 | registerDockMetaTypes(); |
| 40 | 42 | horizontalDock = new HorizontalDock(&settings->scope, this); |
| 41 | - triggerDock = new TriggerDock(settings, dsoControl->getSpecialTriggerSources(), this); | |
| 43 | + triggerDock = new TriggerDock(&settings->scope, settings->deviceSpecification, this); | |
| 42 | 44 | spectrumDock = new SpectrumDock(&settings->scope, this); |
| 43 | 45 | voltageDock = new VoltageDock(&settings->scope, settings->deviceSpecification, this); |
| 44 | 46 | ... | ... |
openhantek/src/scopesettings.h
| ... | ... | @@ -30,7 +30,7 @@ struct DsoSettingsScopeHorizontal { |
| 30 | 30 | /// \brief Holds the settings for the trigger. |
| 31 | 31 | /// TODO Use ControlSettingsTrigger |
| 32 | 32 | struct DsoSettingsScopeTrigger { |
| 33 | - Dso::TriggerMode mode = Dso::TriggerMode::NORMAL; ///< Automatic, normal or single trigger | |
| 33 | + Dso::TriggerMode mode = Dso::TriggerMode::HARDWARE_SOFTWARE; ///< Automatic, normal or single trigger | |
| 34 | 34 | double position = 0.0; ///< Horizontal position for pretrigger |
| 35 | 35 | Dso::Slope slope = Dso::Slope::Positive; ///< Rising or falling edge causes trigger |
| 36 | 36 | unsigned int source = 0; ///< Channel that is used as trigger source | ... | ... |
openhantek/src/utils/dsoStrings.cpp
| ... | ... | @@ -87,14 +87,12 @@ QString mathModeString(MathMode mode) { |
| 87 | 87 | /// \return The string that should be used in labels etc. |
| 88 | 88 | QString triggerModeString(TriggerMode mode) { |
| 89 | 89 | switch (mode) { |
| 90 | - case TriggerMode::AUTO: | |
| 91 | - return QApplication::tr("Auto"); | |
| 92 | - case TriggerMode::NORMAL: | |
| 93 | - return QApplication::tr("Normal"); | |
| 90 | + case TriggerMode::WAIT_FORCE: | |
| 91 | + return QApplication::tr("Wait/Force"); | |
| 92 | + case TriggerMode::HARDWARE_SOFTWARE: | |
| 93 | + return QApplication::tr("Hard-/Software"); | |
| 94 | 94 | case TriggerMode::SINGLE: |
| 95 | 95 | return QApplication::tr("Single"); |
| 96 | - case TriggerMode::SOFTWARE: | |
| 97 | - return QApplication::tr("Software"); | |
| 98 | 96 | } |
| 99 | 97 | return QString(); |
| 100 | 98 | } | ... | ... |