OpenHantek
Loading...
Searching...
No Matches
scopesettings.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2
3#pragma once
4
5#include <QPointF>
6#include <QString>
7
9#include "hantekdso/enums.h"
11#include "viewconstants.h"
12#include <vector>
13
14
18 QPointF pos[ 2 ] = { { -1.0, -1.0 }, { 1.0, 1.0 } };
19};
20
24 double frequencybase = 1e3;
26
27 int recordLength = 0;
28 double timebase = 1e-3;
29 double maxTimebase = 1;
30#ifdef Q_PROCESSOR_ARM
31 // RPi: Not more often than every 10 ms
32 double acquireInterval = 0.010;
33#else
34 // other PC: Not more often than every 1 ms
35 double acquireInterval = 0.001;
36#endif
37 double samplerate = 1e6;
38 int dotsOnScreen = 0;
39 double calfreq = 1e3;
40};
41
51
54 QString name;
55 bool used = false;
56 bool visible = false;
58};
59
62 double offset = 0.0;
63 double magnitude = 20.0;
64};
65
68 double spectrumReference = 0.0;
69 bool calculateDummyLoad = false;
70 unsigned dummyLoad = 50;
71 QString dBsuffix = "V"; // dBV is default
72 bool calculateTHD = false;
73 bool showNoteValue = false;
74};
75
79 double offset = 0.0;
80 double trigger = 0.0;
81 unsigned gainStepIndex = 6;
82 unsigned couplingOrMathIndex = 0;
83 bool inverted = false;
84 double probeAttn = 1.0;
85};
86
89 std::vector< double > gainSteps = { 2e-2, 5e-2, 1e-1, 2e-1,
90 5e-1, 1e0, 2e0, 5e0 };
91 std::vector< DsoSettingsScopeSpectrum > spectrum;
92 std::vector< DsoSettingsScopeVoltage > voltage;
96
97 int verboseLevel = 0;
98 int toolTipVisible = 1; // show hints for beginners, can be disabled in settings dialog
99 bool histogram = false;
100 bool hasACcoupling = false;
101 bool hasACmodification = false;
103
104 double gain( unsigned channel ) const { return gainSteps[ voltage[ channel ].gainStepIndex ] * voltage[ channel ].probeAttn; }
105
106 bool anyUsed( ChannelID channel ) const { return voltage[ channel ].used || spectrum[ channel ].used; }
107
108 Dso::Coupling coupling( ChannelID channel, const Dso::ControlSpecification *deviceSpecification ) const {
109 return deviceSpecification->couplings[ voltage[ channel ].couplingOrMathIndex ];
110 }
111 // Channels, including math channels
112 ChannelID countChannels() const { return ChannelID( voltage.size() ); }
113
114 double getMarker( int marker ) const {
115 double x = qBound( MARGIN_LEFT, marker < 2 ? horizontal.cursor.pos[ marker ].x() : 0.0, MARGIN_RIGHT );
116 return x;
117 }
118
119 void setMarker( unsigned int marker, double value ) {
120 if ( marker < 2 )
121 horizontal.cursor.pos[ marker ].setX( value );
122 }
123};
Coupling
The coupling modes for the channels.
Definition enums.h:27
TriggerMode
The different triggering modes.
Definition enums.h:35
@ AUTO
Automatic without trigger event.
Definition enums.h:36
Slope
The slope that causes a trigger.
Definition enums.h:45
@ Positive
From lower to higher voltage.
Definition enums.h:46
GraphFormat
The possible viewing formats for the graphs on the scope.
Definition enums.h:18
@ TY
The standard mode.
Definition enums.h:19
Holds the settings for the power and frequency analysis.
Definition scopesettings.h:67
bool calculateTHD
Definition scopesettings.h:72
double spectrumReference
Reference level for spectrum in dBV.
Definition scopesettings.h:68
unsigned dummyLoad
Dummy load in Ohms.
Definition scopesettings.h:70
QString dBsuffix
Definition scopesettings.h:71
bool calculateDummyLoad
Definition scopesettings.h:69
bool showNoteValue
Definition scopesettings.h:73
Base for DsoSettingsScopeSpectrum and DsoSettingsScopeVoltage.
Definition scopesettings.h:53
bool visible
true if the channel is turned on
Definition scopesettings.h:56
DsoSettingsScopeCursor cursor
Definition scopesettings.h:57
bool used
true if the channel is used (either visible or input for math etc.)
Definition scopesettings.h:55
QString name
Name of this channel.
Definition scopesettings.h:54
Holds the cursor parameters.
Definition scopesettings.h:16
enum DsoSettingsScopeCursor::CursorShape shape
QPointF pos[2]
Position in div.
Definition scopesettings.h:18
CursorShape
Definition scopesettings.h:17
@ NONE
Definition scopesettings.h:17
@ VERTICAL
Definition scopesettings.h:17
@ RECTANGULAR
Definition scopesettings.h:17
@ HORIZONTAL
Definition scopesettings.h:17
Holds the settings for the horizontal axis.
Definition scopesettings.h:22
int dotsOnScreen
Definition scopesettings.h:38
double maxTimebase
Allow very slow timebases 0.1 ... 10.0 s/div.
Definition scopesettings.h:29
double calfreq
The frequency of the calibration output.
Definition scopesettings.h:39
int recordLength
Sample count.
Definition scopesettings.h:27
Dso::GraphFormat format
Graph drawing mode of the scope.
Definition scopesettings.h:23
double acquireInterval
Minimal time between captured frames.
Definition scopesettings.h:35
DsoSettingsScopeCursor cursor
Definition scopesettings.h:25
double frequencybase
Frequencybase in Hz/div.
Definition scopesettings.h:24
double samplerate
The samplerate of the oscilloscope in S.
Definition scopesettings.h:37
double timebase
Timebase in s/div.
Definition scopesettings.h:28
Holds the settings for the spectrum analysis.
Definition scopesettings.h:61
double magnitude
The vertical resolution in dB/div.
Definition scopesettings.h:63
double offset
Vertical offset in divs.
Definition scopesettings.h:62
Holds the settings for the trigger. TODO Use ControlSettingsTrigger.
Definition scopesettings.h:44
Dso::Slope slope
Rising or falling edge causes trigger.
Definition scopesettings.h:47
int smooth
Don't trigger on glitches.
Definition scopesettings.h:49
double position
Horizontal position for pretrigger (middle of screen)
Definition scopesettings.h:46
int source
Channel that is used as trigger source.
Definition scopesettings.h:48
Dso::TriggerMode mode
Automatic, normal or single trigger.
Definition scopesettings.h:45
Holds the settings for the normal voltage graphs. TODO Use ControlSettingsVoltage.
Definition scopesettings.h:78
double trigger
Trigger level in V.
Definition scopesettings.h:80
unsigned gainStepIndex
The vertical resolution in V/div (default = 1.0)
Definition scopesettings.h:81
bool inverted
true if the channel is inverted (mirrored on cross-axis)
Definition scopesettings.h:83
double probeAttn
attenuation of probe
Definition scopesettings.h:84
unsigned couplingOrMathIndex
Different index: coupling for real- and mode for math-channels.
Definition scopesettings.h:82
double offset
Vertical offset in divs.
Definition scopesettings.h:79
Holds the settings for the oscilloscope.
Definition scopesettings.h:88
Dso::Coupling coupling(ChannelID channel, const Dso::ControlSpecification *deviceSpecification) const
Definition scopesettings.h:108
void setMarker(unsigned int marker, double value)
Definition scopesettings.h:119
DsoSettingsScopeHorizontal horizontal
Settings for the horizontal axis.
Definition scopesettings.h:93
bool histogram
Definition scopesettings.h:99
DsoSettingsScopeAnalysis analysis
Settings for the analysis.
Definition scopesettings.h:95
bool hasACcoupling
Definition scopesettings.h:100
DsoSettingsScopeTrigger trigger
Settings for the trigger.
Definition scopesettings.h:94
bool hasACmodification
Definition scopesettings.h:101
ChannelID countChannels() const
Definition scopesettings.h:112
std::vector< DsoSettingsScopeSpectrum > spectrum
Spectrum analysis settings.
Definition scopesettings.h:91
int verboseLevel
Definition scopesettings.h:97
int toolTipVisible
Definition scopesettings.h:98
bool liveCalibrationActive
Definition scopesettings.h:102
bool anyUsed(ChannelID channel) const
Definition scopesettings.h:106
double getMarker(int marker) const
Definition scopesettings.h:114
double gain(unsigned channel) const
Definition scopesettings.h:104
std::vector< DsoSettingsScopeVoltage > voltage
Settings for the normal graphs.
Definition scopesettings.h:92
std::vector< double > gainSteps
The selectable voltage gain steps in V/div.
Definition scopesettings.h:89
Stores the specifications of the currently connected device.
Definition controlspecification.h:42
std::vector< Coupling > couplings
Definition controlspecification.h:64
unsigned ChannelID
Definition types.h:6
#define MARGIN_RIGHT
Definition viewconstants.h:10
#define MARGIN_LEFT
Definition viewconstants.h:9