You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/readme.md
+35-8
Original file line number
Diff line number
Diff line change
@@ -127,7 +127,7 @@ The firmware command parser:
127
127
}
128
128
129
129
switch (cmd) {
130
-
case 0xa2:
130
+
case 0xa2:
131
131
return eeprom();
132
132
133
133
case 0xe0:
@@ -165,18 +165,43 @@ The firmware command parser:
165
165
166
166
167
167
## Data flow
168
+
* The procedure `void HantekDsoControl::stateMachine()` controls the raw data capturing, conversion to real world physical values, trigger detection and timing of screen refresh. The `struct Raw` holds all important values of one sampled data block:
169
+
170
+
171
+
struct Raw {
172
+
unsigned channels = 0;
173
+
double samplerate = 0;
174
+
unsigned oversampling = 0;
175
+
unsigned gainValue[ 2 ] = {1, 1}; // 1,2,5,10,..
176
+
unsigned gainIndex[ 2 ] = {7, 7}; // index 0..7
177
+
unsigned tag = 0;
178
+
bool freeRun = false; // small buffer, no trigger
179
+
bool valid = false; // samples can be processed
180
+
bool rollMode = false; // one complete buffer received, start to roll
181
+
unsigned size = 0;
182
+
unsigned received = 0;
183
+
std::vector< unsigned char > data;
184
+
mutable QReadWriteLock lock;
185
+
};
168
186
169
-
* Raw 8-bit ADC values are collected via call to `HantekDsoControl::getSamples(..)` (or ...getDemoSamples(..) for the demo device) in `HantekDsoControl::stateMachine()` and converted in `HantekDsoControl::convertRawDataToSamples()` to real-world double samples (scaled with voltage and sample rate).
170
-
The 10X..100X oversampling for slower sample rates is done here. Also overdriving of the inputs is detected.
187
+
188
+
* Raw 8-bit ADC values are collected permanently via call to `HantekDsoControl::getSamples(..)` (or `...getDemoSamples(..)` for the demo device) in an own thread `Capturing::Capturing()`.
189
+
At fast sample rates (>= 10 kS/s) one big block is requested via USB command to make the transfer more robust against USB interruptions by other traffic,
190
+
while at slow sample rates it requests the data in small chunks to allow a permanent screen update in roll mode.
191
+
* Raw values are converted in `HantekDsoControl::convertRawDataToSamples()` to real-world double samples (scaled with voltage and sample rate).
192
+
The 2X..200X oversampling for slower sample rates is done here. Also overdriving of the inputs is detected.
193
+
In `Roll` mode the latest sample values are always put at the end of the result buffer while older samples move toward the beginning of the buffer,
194
+
this rolls the displayed trace permanently to the left.
171
195
The conversion uses either the factory calibration values from EEPROM or from a user supplied config file.
172
196
Read more about [calibration](https://github.com/Ho-Ro/Hantek6022API/blob/master/README.md#create-calibration-values-for-openhantek).
173
-
*`searchTriggerPosition()`
174
-
*which checks if the signal is triggered and calculates the starting point for a stable display.
197
+
*`searchTriggerPosition()`
198
+
*Checks if the signal is triggered and calculates the starting point for a stable display.
175
199
The time distance to the following opposite slope is measured and displayed as pulse width in the top row.
176
-
*`provideTriggeredData()` handles the trigger mode:
200
+
*`provideTriggeredData()` handles the trigger mode:
177
201
* If the **trigger condition is false** and the **trigger mode is Normal** then we reuse the last triggered samples so that voltage and spectrum traces as well as the measurement at the scope's bottom lines are frozen until the trigger condition becomes true again.
178
202
* If the **trigger condition is false** and the **trigger mode is not Normal** then we display a free running trace and discard the last saved samples.
179
-
* The converted samples are emitted to PostProcessing::input() via signal/slot:
203
+
* The converted `DSOsamples` are emitted to PostProcessing::input() via signal/slot:
0 commit comments