From 4081ecc90e860630583bd5b78210b789149a4fea Mon Sep 17 00:00:00 2001 From: oliverhaag Date: Sun, 28 Oct 2012 21:26:45 +0000 Subject: [PATCH] More DSO-2250 fixes --- openhantek/ChangeLog | 4 ++++ openhantek/src/hantek/control.cpp | 98 ++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------- openhantek/src/hantek/control.h | 4 ++-- openhantek/src/hantek/types.cpp | 124 +++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------- openhantek/src/hantek/types.h | 32 ++++++++++++-------------------- 5 files changed, 101 insertions(+), 161 deletions(-) diff --git a/openhantek/ChangeLog b/openhantek/ChangeLog index a907bc5..47412b4 100644 --- a/openhantek/ChangeLog +++ b/openhantek/ChangeLog @@ -169,3 +169,7 @@ * Change back workaround for Mac OS that is most probably not required anymore * Various performance improvements and small fixes * New cppcheck build target + +2012-10-28 Oliver Haag +* Bugfix: DSO-2250 support, thanks to Dmitry Kolyadintsev +* Bugfix: Remove invalid divider for large buffers diff --git a/openhantek/src/hantek/control.cpp b/openhantek/src/hantek/control.cpp index ab5f9a1..591d592 100644 --- a/openhantek/src/hantek/control.cpp +++ b/openhantek/src/hantek/control.cpp @@ -53,6 +53,8 @@ namespace Hantek { this->specification.command.values.offsetLimits = (ControlValue) -1; this->specification.command.values.voltageLimits = (ControlValue) -1; + this->specification.recordLengths << 0; + this->specification.samplerate.single.base = 50e6; this->specification.samplerate.single.max = 50e6; this->specification.samplerate.multi.base = 100e6; @@ -127,7 +129,7 @@ namespace Hantek { } /// \brief Gets the physical channel count for this oscilloscope. - /// \returns The number of physical channels. + /// \return The number of physical channels. unsigned int Control::getChannelCount() { return HANTEK_CHANNELS; } @@ -295,11 +297,11 @@ namespace Hantek { /// \brief Calculates the trigger point from the CommandGetCaptureState data. /// \param value The data value that contains the trigger point. /// \return The calculated trigger point for the given data. - unsigned short int Control::calculateTriggerPoint(unsigned short int value) { - unsigned short int result = value; + unsigned long int Control::calculateTriggerPoint(unsigned long int value) { + unsigned long int result = value; // Each set bit inverts all bits with a lower value - for(unsigned short int bitValue = 1; bitValue; bitValue <<= 1) + for(unsigned long int bitValue = 1; bitValue; bitValue <<= 1) if(result & bitValue) result ^= bitValue - 1; @@ -358,7 +360,7 @@ namespace Hantek { this->samplesMutex.lock(); // Convert channel data - if(this->settings.samplerate.limits == &this->specification.samplerate.single) { + if(this->settings.samplerate.limits == &this->specification.samplerate.multi) { // Fast rate mode, one channel is using all buffers int channel = 0; for(; channel < HANTEK_CHANNELS; ++channel) { @@ -495,25 +497,20 @@ namespace Hantek { if(this->specification.command.bulk.setPretrigger == BULK_FSETBUFFER) { // Pointers to needed commands BulkSetRecordLength2250 *commandSetRecordLength2250 = static_cast(this->command[BULK_DSETBUFFER]); - BulkSetBuffer2250 *commandSetBuffer2250 = static_cast(this->command[BULK_FSETBUFFER]); commandSetRecordLength2250->setRecordLength(bestSizeId); - commandSetBuffer2250->setUsedPre(FTRIGGERPOSITION_ON); - commandSetBuffer2250->setUsedPost(FTRIGGERPOSITION_ON); - commandSetBuffer2250->setLargeBuffer(bestSizeId == RECORDLENGTHID_LARGE); - commandSetBuffer2250->setSlowBuffer(bestSizeId != RECORDLENGTHID_SMALL); - - this->commandPending[BULK_DSETBUFFER] = true; - this->commandPending[BULK_FSETBUFFER] = true; } else { // SetBuffer5200 bulk command for record length BulkSetBuffer5200 *commandSetBuffer5200 = static_cast(this->command[BULK_DSETBUFFER]); + commandSetBuffer5200->setUsedPre(DTRIGGERPOSITION_ON); commandSetBuffer5200->setUsedPost(DTRIGGERPOSITION_ON); commandSetBuffer5200->setRecordLength(bestSizeId); - this->commandPending[BULK_DSETBUFFER] = true; } + + this->commandPending[BULK_DSETBUFFER] = true; + break; default: @@ -645,7 +642,7 @@ namespace Hantek { this->specification.samplerate.single.max = 125e6; this->specification.samplerate.multi.base = 200e6; this->specification.samplerate.multi.max = 250e6; - this->specification.bufferDividers << 1000 << 1 << 2; + this->specification.bufferDividers << 1000 << 1 << 1; this->specification.recordLengths << ULONG_MAX << 10240 << 14336; this->specification.gainSteps << 0.16 << 0.40 << 0.80 << 1.60 << 4.00 << 8.0 << 16.0 << 40.0 << 80.0; @@ -659,11 +656,11 @@ namespace Hantek { break; case MODEL_DSO2250: - this->specification.samplerate.single.base = 200e6; - this->specification.samplerate.single.max = 125e6; + this->specification.samplerate.single.base = 100e6; + this->specification.samplerate.single.max = 100e6; this->specification.samplerate.multi.base = 200e6; this->specification.samplerate.multi.max = 250e6; - this->specification.bufferDividers << 1000 << 1 << 2; + this->specification.bufferDividers << 1000 << 1 << 1; this->specification.recordLengths << ULONG_MAX << 10240 << 524288; this->specification.gainSteps << 0.08 << 0.16 << 0.40 << 0.80 << 1.60 << 4.00 << 8.0 << 16.0 << 40.0; @@ -671,7 +668,7 @@ namespace Hantek { this->specification.voltageLimit[channel] << 255 << 255 << 255 << 255 << 255 << 255 << 255 << 255 << 255; this->specification.gainIndex - << 0 << 1 << 2 << 0 << 1 << 2 << 0 << 1 << 2; + << 0 << 2 << 3 << 0 << 2 << 3 << 0 << 2 << 3; this->specification.sampleSize = 8; break; @@ -680,7 +677,7 @@ namespace Hantek { this->specification.samplerate.single.max = 75e6; this->specification.samplerate.multi.base = 100e6; this->specification.samplerate.multi.max = 150e6; - this->specification.bufferDividers << 1000 << 1 << 2; + this->specification.bufferDividers << 1000 << 1 << 1; this->specification.recordLengths << ULONG_MAX << 10240 << 32768; this->specification.gainSteps << 0.08 << 0.16 << 0.40 << 0.80 << 1.60 << 4.00 << 8.0 << 16.0 << 40.0; @@ -697,7 +694,7 @@ namespace Hantek { this->specification.samplerate.single.max = 50e6; this->specification.samplerate.multi.base = 100e6; this->specification.samplerate.multi.max = 100e6; - this->specification.bufferDividers << 1000 << 1 << 2; + this->specification.bufferDividers << 1000 << 1 << 1; this->specification.recordLengths << ULONG_MAX << 10240 << 32768; this->specification.gainSteps << 0.08 << 0.16 << 0.40 << 0.80 << 1.60 << 4.00 << 8.0 << 16.0 << 40.0; @@ -732,8 +729,8 @@ namespace Hantek { this->updateRecordLength(size); - this->setPretriggerPosition(this->settings.trigger.position); this->setSamplerate(); + this->setPretriggerPosition(this->settings.trigger.position); return this->specification.recordLengths[this->settings.recordLengthId]; } @@ -774,7 +771,7 @@ namespace Hantek { unsigned long int slowDownsampling = qMax(this->specification.samplerate.single.base / this->specification.bufferDividers[this->settings.recordLengthId] / samplerate, (long unsigned int) 1); // Use normal mode if we need valueSlow or it would meet the rate at least as exactly as fast rate mode - if(this->settings.samplerate.downsampling > 4 || (qAbs((double) this->specification.samplerate.single.base / this->specification.bufferDividers[this->settings.recordLengthId] / slowDownsampling - samplerate) <= qAbs(this->settings.samplerate.current - samplerate))) { + if(this->settings.samplerate.downsampling > 4 || (qAbs((double) this->specification.samplerate.single.base / this->specification.bufferDividers[this->settings.recordLengthId] / slowDownsampling - samplerate) <= qAbs((double) this->settings.samplerate.current - samplerate))) { fastRate = false; this->settings.samplerate.limits = &(this->specification.samplerate.single); this->settings.samplerate.downsampling = slowDownsampling; @@ -782,13 +779,13 @@ namespace Hantek { } } - // Split the resulting divider into the values understood by the device - // The fast value is kept at 4 (or 3) for slow sample rates - long int valueSlow = qMax(((long int) this->settings.samplerate.downsampling - 3) / 2, (long int) 0); - unsigned char valueFast = this->settings.samplerate.downsampling - valueSlow * 2; - switch(this->specification.command.bulk.setSamplerate) { case BULK_SETTRIGGERANDSAMPLERATE: { + // Split the resulting divider into the values understood by the device + // The fast value is kept at 4 (or 3) for slow sample rates + long int valueSlow = qMax(((long int) this->settings.samplerate.downsampling - 3) / 2, (long int) 0); + unsigned char valueFast = this->settings.samplerate.downsampling - valueSlow * 2; + // Pointers to needed commands BulkSetTriggerAndSamplerate *commandSetTriggerAndSamplerate = static_cast(this->command[BULK_SETTRIGGERANDSAMPLERATE]); @@ -804,6 +801,11 @@ namespace Hantek { break; } case BULK_CSETTRIGGERORSAMPLERATE: { + // Split the resulting divider into the values understood by the device + // The fast value is kept at 4 (or 3) for slow sample rates + long int valueSlow = qMax(((long int) this->settings.samplerate.downsampling - 3) / 2, (long int) 0); + unsigned char valueFast = this->settings.samplerate.downsampling - valueSlow * 2; + // Pointers to needed commands BulkSetSamplerate5200 *commandSetSamplerate5200 = static_cast(this->command[BULK_CSETTRIGGERORSAMPLERATE]); BulkSetTrigger5200 *commandSetTrigger5200 = static_cast(this->command[BULK_ESETTRIGGERORSAMPLERATE]); @@ -824,10 +826,11 @@ namespace Hantek { // Pointers to needed commands BulkSetSamplerate2250 *commandSetSamplerate2250 = static_cast(this->command[BULK_ESETTRIGGERORSAMPLERATE]); - // Store samplerate fast value - commandSetSamplerate2250->setSamplerateFast(4 - valueFast); - // Store samplerate slow value (two's complement) - commandSetSamplerate2250->setSamplerateSlow(valueSlow == 0 ? 0 : 0xffff - valueSlow); + bool downsampling = this->settings.samplerate.downsampling > 1; + // Store downsampler state value + commandSetSamplerate2250->setDownsampling(downsampling); + // Store samplerate value + commandSetSamplerate2250->setSamplerate(downsampling ? 0x10001 - this->settings.samplerate.downsampling : 0); // Set fast rate when used commandSetSamplerate2250->setFastRate(fastRate); @@ -1024,29 +1027,22 @@ namespace Hantek { if((!special && id >= HANTEK_CHANNELS) || (special && id >= HANTEK_SPECIAL_CHANNELS)) return Dso::ERROR_PARAMETER; - // Generate trigger source value that will be transmitted - int sourceValue; - if(special) - sourceValue = TRIGGER_EXT + id; - else - sourceValue = TRIGGER_CH1 - id; - switch(this->specification.command.bulk.setTrigger) { case BULK_SETTRIGGERANDSAMPLERATE: // SetTriggerAndSamplerate bulk command for trigger source - static_cast(this->command[BULK_SETTRIGGERANDSAMPLERATE])->setTriggerSource(sourceValue); + static_cast(this->command[BULK_SETTRIGGERANDSAMPLERATE])->setTriggerSource(special ? 3 + id : 1 - id); this->commandPending[BULK_SETTRIGGERANDSAMPLERATE] = true; break; case BULK_CSETTRIGGERORSAMPLERATE: // SetTrigger2250 bulk command for trigger source - static_cast(this->command[BULK_CSETTRIGGERORSAMPLERATE])->setTriggerSource(sourceValue); + static_cast(this->command[BULK_CSETTRIGGERORSAMPLERATE])->setTriggerSource(special ? 0 : 2 + id); this->commandPending[BULK_CSETTRIGGERORSAMPLERATE] = true; break; - + case BULK_ESETTRIGGERORSAMPLERATE: // SetTrigger5200 bulk command for trigger source - static_cast(this->command[BULK_ESETTRIGGERORSAMPLERATE])->setTriggerSource(sourceValue); + static_cast(this->command[BULK_ESETTRIGGERORSAMPLERATE])->setTriggerSource(special ? 3 + id : 1 - id); this->commandPending[BULK_ESETTRIGGERORSAMPLERATE] = true; break; @@ -1164,7 +1160,7 @@ namespace Hantek { // All trigger positions are measured in samples unsigned long int positionSamples = position * this->settings.samplerate.current; // Fast rate mode uses both channels - if(this->settings.samplerate.limits == &this->specification.samplerate.single) + if(this->settings.samplerate.limits == &this->specification.samplerate.multi) positionSamples /= HANTEK_CHANNELS; switch(this->specification.command.bulk.setPretrigger) { @@ -1179,9 +1175,9 @@ namespace Hantek { break; } case BULK_FSETBUFFER: { - // Calculate the position values (Inverse, maximum is 0xffff) - unsigned short int positionPre = 0xffff - this->specification.recordLengths[this->settings.recordLengthId] + positionSamples; - unsigned short int positionPost = 0xffff - positionSamples; + // Calculate the position values (Inverse, maximum is 0x7ffff) + unsigned short int positionPre = 0x7ffff - this->specification.recordLengths[this->settings.recordLengthId] + positionSamples; + unsigned short int positionPost = 0x7ffff - positionSamples; // SetBuffer2250 bulk command for trigger position BulkSetBuffer2250 *commandSetBuffer2250 = static_cast(this->command[BULK_FSETBUFFER]); @@ -1238,7 +1234,7 @@ namespace Hantek { unsigned char commandCode = 0; // Read command code (First byte) - Helper::hexParse(data, &commandCode, 1); + Helper::hexParse(commandParts[2], &commandCode, 1); if(commandCode > BULK_COUNT) return Dso::ERROR_UNSUPPORTED; @@ -1248,8 +1244,10 @@ namespace Hantek { return Dso::ERROR_NONE; } else if(commandParts[1] == "control") { - // Get control code from third part - unsigned char controlCode = commandParts[2].toUShort(); + unsigned char controlCode = 0; + + // Read command code (First byte) + Helper::hexParse(commandParts[2], &controlCode, 1); int control; for(control = 0; control < CONTROLINDEX_COUNT; ++control) { if(this->controlCode[control] == controlCode) diff --git a/openhantek/src/hantek/control.h b/openhantek/src/hantek/control.h index 4cf12e0..1ebfddb 100644 --- a/openhantek/src/hantek/control.h +++ b/openhantek/src/hantek/control.h @@ -134,7 +134,7 @@ namespace Hantek { struct ControlSettingsSamplerate { ControlSamplerateLimits *limits; ///< The samplerate limits unsigned long int downsampling; ///< The variable downsampling factor - double current; ///< The current samplerate + unsigned long int current; ///< The current samplerate }; ////////////////////////////////////////////////////////////////////////////// @@ -186,7 +186,7 @@ namespace Hantek { protected: void run(); - unsigned short int calculateTriggerPoint(unsigned short int value); + unsigned long int calculateTriggerPoint(unsigned long int value); int getCaptureState(); int getSamples(bool process); unsigned long int updateRecordLength(unsigned long int size); diff --git a/openhantek/src/hantek/types.cpp b/openhantek/src/hantek/types.cpp index 852527c..966a54d 100644 --- a/openhantek/src/hantek/types.cpp +++ b/openhantek/src/hantek/types.cpp @@ -282,7 +282,7 @@ namespace Hantek { /// \brief Gets the trigger point. /// \return The trigger point for the captured samples. unsigned int BulkResponseGetCaptureState::getTriggerPoint() { - return this->array[2] | (this->array[3] << 8); + return this->array[2] | (this->array[3] << 8) | (this->array[1] << 16); } @@ -650,14 +650,14 @@ namespace Hantek { /// \brief Sets the data bytes to the specified values. /// \param fastRate The fastRate state (ESamplerateBits). - /// \param samplerateFast The SamplerateFast value (ESamplerateBits). - /// \param samplerateSlow The SamplerateSlow value. - BulkSetSamplerate2250::BulkSetSamplerate2250(bool fastRate, unsigned char samplerateFast, unsigned short int samplerateSlow) : Helper::DataArray(8) { + /// \param downsampling The downsampling state (ESamplerateBits). + /// \param samplerate The Samplerate value. + BulkSetSamplerate2250::BulkSetSamplerate2250(bool fastRate, bool downsampling, unsigned short int samplerate) : Helper::DataArray(8) { this->init(); this->setFastRate(fastRate); - this->setSamplerateFast(samplerateFast); - this->setSamplerateSlow(samplerateSlow); + this->setDownsampling(downsampling); + this->setSamplerate(samplerate); } /// \brief Get the fastRate state in ESamplerateBits. @@ -672,27 +672,27 @@ namespace Hantek { ((ESamplerateBits *) &(this->array[2]))->fastRate = fastRate ? 1 : 0; } - /// \brief Get the samplerateFast value in ESamplerateBits. - /// \return The samplerateFast value in ESamplerateBits. - unsigned char BulkSetSamplerate2250::getSamplerateFast() { - return ((ESamplerateBits *) &(this->array[2]))->samplerateFast; + /// \brief Get the downsampling state in ESamplerateBits. + /// \return The samplerateFast state. + bool BulkSetSamplerate2250::getDownsampling() { + return ((ESamplerateBits *) &(this->array[2]))->downsampling == 1; } /// \brief Set the samplerateFast in ESamplerateBits to the given value. /// \param value The new samplerateFast value. - void BulkSetSamplerate2250::setSamplerateFast(unsigned char value) { - ((ESamplerateBits *) &(this->array[2]))->samplerateFast = value; + void BulkSetSamplerate2250::setDownsampling(bool downsampling) { + ((ESamplerateBits *) &(this->array[2]))->downsampling = downsampling ? 1 : 0; } - /// \brief Get the SamplerateSlow value. - /// \return The SamplerateSlow value. - unsigned short int BulkSetSamplerate2250::getSamplerateSlow() { + /// \brief Get the Samplerate value. + /// \return The Samplerate value. + unsigned short int BulkSetSamplerate2250::getSamplerate() { return (unsigned short int) this->array[4] | ((unsigned short int) this->array[5] << 8); } - /// \brief Set the SamplerateSlow to the given value. - /// \param samplerate The new SamplerateSlow value. - void BulkSetSamplerate2250::setSamplerateSlow(unsigned short int samplerate) { + /// \brief Set the Samplerate to the given value. + /// \param samplerate The new Samplerate value. + void BulkSetSamplerate2250::setSamplerate(unsigned short int samplerate) { this->array[4] = (unsigned char) samplerate; this->array[5] = (unsigned char) (samplerate >> 8); } @@ -804,93 +804,39 @@ namespace Hantek { /// \brief Sets the data bytes to the specified values. /// \param triggerPositionPre The TriggerPositionPre value. /// \param triggerPositionPost The TriggerPositionPost value. - /// \param usedPre The TriggerPositionUsedPre value. - /// \param usedPost The TriggerPositionUsedPost value. - /// \param largeBuffer The largeBuffer state. - /// \param slowBuffer The slowBuffer state. - BulkSetBuffer2250::BulkSetBuffer2250(unsigned short int triggerPositionPre, unsigned short int triggerPositionPost, unsigned char usedPre, unsigned char usedPost, bool largeBuffer, bool slowBuffer) : Helper::DataArray(10) { + BulkSetBuffer2250::BulkSetBuffer2250(unsigned long int triggerPositionPre, unsigned long int triggerPositionPost) : Helper::DataArray(12) { this->init(); this->setTriggerPositionPre(triggerPositionPre); this->setTriggerPositionPost(triggerPositionPost); - this->setUsedPre(usedPre); - this->setUsedPost(usedPost); - this->setLargeBuffer(largeBuffer); - this->setSlowBuffer(slowBuffer); - } - - /// \brief Get the TriggerPositionPre value. - /// \return The TriggerPositionPre value. - unsigned short int BulkSetBuffer2250::getTriggerPositionPre() { - return (unsigned short int) this->array[2] | ((unsigned short int) this->array[3] << 8); - } - - /// \brief Set the TriggerPositionPre to the given value. - /// \param position The new TriggerPositionPre value. - void BulkSetBuffer2250::setTriggerPositionPre(unsigned short int position) { - this->array[2] = (unsigned char) position; - this->array[3] = (unsigned char) (position >> 8); } /// \brief Get the TriggerPositionPost value. /// \return The TriggerPositionPost value. - unsigned short int BulkSetBuffer2250::getTriggerPositionPost() { - return (unsigned short int) this->array[6] | ((unsigned short int) this->array[7] << 8); + unsigned long int BulkSetBuffer2250::getTriggerPositionPost() { + return (unsigned long int) this->array[2] | ((unsigned long int) this->array[3] << 8) | ((unsigned long int) this->array[4] << 16); } /// \brief Set the TriggerPositionPost to the given value. /// \param position The new TriggerPositionPost value. - void BulkSetBuffer2250::setTriggerPositionPost(unsigned short int position) { - this->array[6] = (unsigned char) position; - this->array[7] = (unsigned char) (position >> 8); - } - - /// \brief Get the TriggerPositionUsedPre value. - /// \return The ::DTriggerPositionUsed value for the pre position. - unsigned char BulkSetBuffer2250::getUsedPre() { - return ((FBuffer1Bits *) &(this->array[4]))->triggerPositionUsed; - } - - /// \brief Set the TriggerPositionUsedPre to the given value. - /// \param value The new ::DTriggerPositionUsed value for the pre position. - void BulkSetBuffer2250::setUsedPre(unsigned char value) { - ((FBuffer1Bits *) &(this->array[4]))->triggerPositionUsed = value; - } - - /// \brief Get the TriggerPositionUsedPost value. - /// \return The ::DTriggerPositionUsed value for the post position. - unsigned char BulkSetBuffer2250::getUsedPost() { - return ((FBuffer1Bits *) &(this->array[8]))->triggerPositionUsed; - } - - /// \brief Set the TriggerPositionUsedPost to the given value. - /// \param value The new ::DTriggerPositionUsed value for the post position. - void BulkSetBuffer2250::setUsedPost(unsigned char value) { - ((FBuffer1Bits *) &(this->array[8]))->triggerPositionUsed = value; - } - - /// \brief Get the largeBuffer state in FBuffer1Bits. - /// \return The largeBuffer state. - bool BulkSetBuffer2250::getLargeBuffer() { - return ((FBuffer1Bits *) &(this->array[2]))->largeBuffer == 0; - } - - /// \brief Set the largeBuffer in FBuffer1Bits to the given state. - /// \param largeBuffer The new largeBuffer state. - void BulkSetBuffer2250::setLargeBuffer(bool largeBuffer) { - ((FBuffer1Bits *) &(this->array[2]))->largeBuffer = largeBuffer ? 0 : 1; + void BulkSetBuffer2250::setTriggerPositionPost(unsigned long int position) { + this->array[2] = (unsigned char) position; + this->array[3] = (unsigned char) (position >> 8); + this->array[4] = (unsigned char) (position >> 16); } - /// \brief Get the slowBuffer state in FBuffer2Bits. - /// \return The slowBuffer state. - bool BulkSetBuffer2250::getSlowBuffer() { - return ((FBuffer2Bits *) &(this->array[2]))->slowBuffer == 1; + /// \brief Get the TriggerPositionPre value. + /// \return The TriggerPositionPre value. + unsigned long int BulkSetBuffer2250::getTriggerPositionPre() { + return (unsigned long int) this->array[6] | ((unsigned short int) this->array[7] << 8) | ((unsigned short int) this->array[8] << 16); } - /// \brief Set the slowBuffer in FBuffer2Bits to the given state. - /// \param slowBuffer The new slowBuffer state. - void BulkSetBuffer2250::setSlowBuffer(bool slowBuffer) { - ((FBuffer2Bits *) &(this->array[2]))->slowBuffer = slowBuffer ? 1 : 0; + /// \brief Set the TriggerPositionPre to the given value. + /// \param position The new TriggerPositionPre value. + void BulkSetBuffer2250::setTriggerPositionPre(unsigned long int position) { + this->array[6] = (unsigned char) position; + this->array[7] = (unsigned char) (position >> 8); + this->array[8] = (unsigned char) (position >> 16); } /// \brief Initialize the array to the needed values. diff --git a/openhantek/src/hantek/types.h b/openhantek/src/hantek/types.h index 59785cd..08a77e7 100644 --- a/openhantek/src/hantek/types.h +++ b/openhantek/src/hantek/types.h @@ -779,7 +779,7 @@ namespace Hantek { /// \brief Samplerate bits for DSO-2250 0x0e command. struct ESamplerateBits { unsigned char fastRate:1; ///< false, if one channels uses all buffers - unsigned char samplerateFast:3; ///< samplerate value for fast sampling rates + unsigned char downsampling:1; ///< true, if the downsampler is activated unsigned char reserved:4; ///< Unused bits }; @@ -948,7 +948,7 @@ namespace Hantek { ////////////////////////////////////////////////////////////////////////////// /// \class BulkSetFilter2250 hantek/types.h - /// \brief The DSO-5200/DSO-5200A BULK_BSETFILTER builder. + /// \brief The DSO-2250 BULK_BSETFILTER builder. class BulkSetFilter2250 : public Helper::DataArray { public: BulkSetFilter2250(); @@ -1039,14 +1039,14 @@ namespace Hantek { class BulkSetSamplerate2250 : public Helper::DataArray { public: BulkSetSamplerate2250(); - BulkSetSamplerate2250(bool fastRate, unsigned char samplerateFast = 0, unsigned short int samplerateSlow = 0); + BulkSetSamplerate2250(bool fastRate, bool downsampling = false, unsigned short int samplerate = 0); bool getFastRate(); void setFastRate(bool fastRate); - unsigned char getSamplerateFast(); - void setSamplerateFast(unsigned char value); - unsigned short int getSamplerateSlow(); - void setSamplerateSlow(unsigned short int samplerate); + bool getDownsampling(); + void setDownsampling(bool downsampling); + unsigned short int getSamplerate(); + void setSamplerate(unsigned short int samplerate); private: void init(); @@ -1081,20 +1081,12 @@ namespace Hantek { class BulkSetBuffer2250 : public Helper::DataArray { public: BulkSetBuffer2250(); - BulkSetBuffer2250(unsigned short int triggerPositionPre, unsigned short int triggerPositionPost, unsigned char usedPre = 0, unsigned char usedPost = 0, bool largeBuffer = false, bool slowBuffer = false); + BulkSetBuffer2250(unsigned long int triggerPositionPre, unsigned long int triggerPositionPost); - unsigned short int getTriggerPositionPre(); - void setTriggerPositionPre(unsigned short int value); - unsigned short int getTriggerPositionPost(); - void setTriggerPositionPost(unsigned short int value); - unsigned char getUsedPre(); - void setUsedPre(unsigned char value); - unsigned char getUsedPost(); - void setUsedPost(unsigned char value); - bool getLargeBuffer(); - void setLargeBuffer(bool largeBuffer); - bool getSlowBuffer(); - void setSlowBuffer(bool slowBuffer); + unsigned long int getTriggerPositionPost(); + void setTriggerPositionPost(unsigned long int value); + unsigned long int getTriggerPositionPre(); + void setTriggerPositionPre(unsigned long int value); private: void init(); -- libgit2 0.21.4