Commit 840e89be39c473edfd64e1a731e0d21bb7b6a3b5

Authored by oliverhaag
1 parent 8b8ee5ad

DSO-2250 uses different capture state for available data

openhantek/ChangeLog
@@ -158,3 +158,6 @@ @@ -158,3 +158,6 @@
158 2012-10-02 Oliver Haag <oliver.haag@gmail.com> 158 2012-10-02 Oliver Haag <oliver.haag@gmail.com>
159 * Bugfix: Hantek::Control redesign missing for used channels 159 * Bugfix: Hantek::Control redesign missing for used channels
160 * Bugfix: Always check DataAnalyzer::data for null pointer 160 * Bugfix: Always check DataAnalyzer::data for null pointer
  161 +
  162 +2012-10-03 Oliver Haag <oliver.haag@gmail.com>
  163 +* Bugfix: Add CAPTURE_READY2250 for the DSO-2250
openhantek/src/hantek/control.cpp
@@ -199,11 +199,16 @@ namespace Hantek { @@ -199,11 +199,16 @@ namespace Hantek {
199 #endif 199 #endif
200 switch(captureState) { 200 switch(captureState) {
201 case CAPTURE_READY: 201 case CAPTURE_READY:
  202 + case CAPTURE_READY2250:
202 case CAPTURE_READY5200: 203 case CAPTURE_READY5200:
203 // Get data and process it, if we're still sampling 204 // Get data and process it, if we're still sampling
204 errorCode = this->getSamples(samplingStarted); 205 errorCode = this->getSamples(samplingStarted);
205 if(errorCode < 0) 206 if(errorCode < 0)
206 qWarning("Getting sample data failed: %s", Helper::libUsbErrorString(errorCode).toLocal8Bit().data()); 207 qWarning("Getting sample data failed: %s", Helper::libUsbErrorString(errorCode).toLocal8Bit().data());
  208 +#ifdef DEBUG
  209 + else
  210 + qDebug("Received %d B of sampling data", errorCode);
  211 +#endif
207 212
208 // Check if we're in single trigger mode 213 // Check if we're in single trigger mode
209 if(this->settings.trigger.mode == Dso::TRIGGERMODE_SINGLE && samplingStarted) 214 if(this->settings.trigger.mode == Dso::TRIGGERMODE_SINGLE && samplingStarted)
@@ -310,7 +315,7 @@ namespace Hantek { @@ -310,7 +315,7 @@ namespace Hantek {
310 } 315 }
311 316
312 /// \brief Gets sample data from the oscilloscope and converts it. 317 /// \brief Gets sample data from the oscilloscope and converts it.
313 - /// \return 0 on success, libusb error code on error. 318 + /// \return sample count on success, libusb error code on error.
314 int Control::getSamples(bool process) { 319 int Control::getSamples(bool process) {
315 int errorCode; 320 int errorCode;
316 321
@@ -445,7 +450,7 @@ namespace Hantek { @@ -445,7 +450,7 @@ namespace Hantek {
445 emit samplesAvailable(&(this->samples), &(this->samplesSize), this->settings.samplerate.current, &(this->samplesMutex)); 450 emit samplesAvailable(&(this->samples), &(this->samplesSize), this->settings.samplerate.current, &(this->samplesMutex));
446 } 451 }
447 452
448 - return 0; 453 + return errorCode;
449 } 454 }
450 455
451 /// \brief Sets the size of the sample buffer without updating dependencies. 456 /// \brief Sets the size of the sample buffer without updating dependencies.
openhantek/src/hantek/types.h
@@ -674,10 +674,11 @@ namespace Hantek { @@ -674,10 +674,11 @@ namespace Hantek {
674 /// \enum CaptureState hantek/types.h 674 /// \enum CaptureState hantek/types.h
675 /// \brief The different capture states which the oscilloscope returns. 675 /// \brief The different capture states which the oscilloscope returns.
676 enum CaptureState { 676 enum CaptureState {
677 - CAPTURE_WAITING = 0,  
678 - CAPTURE_SAMPLING = 1,  
679 - CAPTURE_READY = 2,  
680 - CAPTURE_READY5200 = 7 677 + CAPTURE_WAITING = 0, ///< The scope is waiting for a trigger event
  678 + CAPTURE_SAMPLING = 1, ///< The scope is sampling data after triggering
  679 + CAPTURE_READY = 2, ///< Sampling data is available (DSO-2090/DSO-2150)
  680 + CAPTURE_READY2250 = 3, ///< Sampling data is available (DSO-2250)
  681 + CAPTURE_READY5200 = 7 ///< Sampling data is available (DSO-5200/DSO-5200A)
681 }; 682 };
682 683
683 ////////////////////////////////////////////////////////////////////////////// 684 //////////////////////////////////////////////////////////////////////////////