Commit 8b8ee5adafdc33b5dbd47ed98c334d84921c1519
1 parent
e0817938
Fixes for DSO-2250 problems
Showing
7 changed files
with
87 additions
and
93 deletions
openhantek/ChangeLog
| ... | ... | @@ -151,3 +151,10 @@ |
| 151 | 151 | 2012-09-21 Oliver Haag <oliver.haag@gmail.com> |
| 152 | 152 | * Bugfix: Uninitialized bulk command pointer for BULK_FSETBUFFER |
| 153 | 153 | * Bugfix: Slot setTriggerPosition wasn't renamed |
| 154 | + | |
| 155 | +2012-10-01 Oliver Haag <oliver.haag@gmail.com> | |
| 156 | +* Bugfix: Wrong bit mask for extra bits in Hantek::Control::getData | |
| 157 | + | |
| 158 | +2012-10-02 Oliver Haag <oliver.haag@gmail.com> | |
| 159 | +* Bugfix: Hantek::Control redesign missing for used channels | |
| 160 | +* Bugfix: Always check DataAnalyzer::data for null pointer | ... | ... |
openhantek/src/dsowidget.cpp
| ... | ... | @@ -482,7 +482,7 @@ void DsoWidget::updateZoom(bool enabled) { |
| 482 | 482 | /// \brief Prints analyzed data. |
| 483 | 483 | void DsoWidget::dataAnalyzed() { |
| 484 | 484 | for(int channel = 0; channel < this->settings->scope.voltage.count(); channel++) { |
| 485 | - if(this->settings->scope.voltage[channel].used) { | |
| 485 | + if(this->settings->scope.voltage[channel].used && this->dataAnalyzer->data(channel)) { | |
| 486 | 486 | // Amplitude string representation (4 significant digits) |
| 487 | 487 | this->measurementAmplitudeLabel[channel]->setText(Helper::valueToString(this->dataAnalyzer->data(channel)->amplitude, Helper::UNIT_VOLTS, 4)); |
| 488 | 488 | // Frequency string representation (5 significant digits) | ... | ... |
openhantek/src/exporter.cpp
| ... | ... | @@ -141,7 +141,7 @@ bool Exporter::doExport() { |
| 141 | 141 | stretchBase = (double) (paintDevice->width() - lineHeight * 6) / 10; |
| 142 | 142 | int channelCount = 0; |
| 143 | 143 | for(int channel = this->settings->scope.voltage.count() - 1; channel >= 0; channel--) { |
| 144 | - if(this->settings->scope.voltage[channel].used || this->settings->scope.spectrum[channel].used) { | |
| 144 | + if((this->settings->scope.voltage[channel].used || this->settings->scope.spectrum[channel].used) && this->dataAnalyzer->data(channel)) { | |
| 145 | 145 | channelCount++; |
| 146 | 146 | double top = (double) paintDevice->height() - channelCount * lineHeight; |
| 147 | 147 | |
| ... | ... | @@ -213,7 +213,7 @@ bool Exporter::doExport() { |
| 213 | 213 | case Dso::GRAPHFORMAT_TY: |
| 214 | 214 | // Add graphs for channels |
| 215 | 215 | for(int channel = 0 ; channel < this->settings->scope.voltage.count(); channel++) { |
| 216 | - if(this->settings->scope.voltage[channel].used) { | |
| 216 | + if(this->settings->scope.voltage[channel].used && this->dataAnalyzer->data(channel)) { | |
| 217 | 217 | painter.setPen(colorValues->voltage[channel]); |
| 218 | 218 | |
| 219 | 219 | // What's the horizontal distance between sampling points? |
| ... | ... | @@ -241,7 +241,7 @@ bool Exporter::doExport() { |
| 241 | 241 | |
| 242 | 242 | // Add spectrum graphs |
| 243 | 243 | for (int channel = 0; channel < this->settings->scope.spectrum.count(); channel++) { |
| 244 | - if(this->settings->scope.spectrum[channel].used) { | |
| 244 | + if(this->settings->scope.spectrum[channel].used && this->dataAnalyzer->data(channel)) { | |
| 245 | 245 | painter.setPen(colorValues->spectrum[channel]); |
| 246 | 246 | |
| 247 | 247 | // What's the horizontal distance between sampling points? |
| ... | ... | @@ -366,28 +366,30 @@ bool Exporter::doExport() { |
| 366 | 366 | QTextStream csvStream(&csvFile); |
| 367 | 367 | |
| 368 | 368 | for(int channel = 0 ; channel < this->settings->scope.voltage.count(); channel++) { |
| 369 | - if(this->settings->scope.voltage[channel].used) { | |
| 370 | - // Start with channel name and the sample interval | |
| 371 | - csvStream << "\"" << this->settings->scope.voltage[channel].name << "\"," << this->dataAnalyzer->data(channel)->samples.voltage.interval; | |
| 372 | - | |
| 373 | - // And now all sample values in volts | |
| 374 | - for(unsigned int position = 0; position < this->dataAnalyzer->data(channel)->samples.voltage.count; position++) | |
| 375 | - csvStream << "," << this->dataAnalyzer->data(channel)->samples.voltage.sample[position]; | |
| 376 | - | |
| 377 | - // Finally a newline | |
| 378 | - csvStream << '\n'; | |
| 379 | - } | |
| 380 | - | |
| 381 | - if(this->settings->scope.spectrum[channel].used) { | |
| 382 | - // Start with channel name and the sample interval | |
| 383 | - csvStream << "\"" << this->settings->scope.spectrum[channel].name << "\"," << this->dataAnalyzer->data(channel)->samples.spectrum.interval; | |
| 384 | - | |
| 385 | - // And now all magnitudes in dB | |
| 386 | - for(unsigned int position = 0; position < this->dataAnalyzer->data(channel)->samples.spectrum.count; position++) | |
| 387 | - csvStream << "," << this->dataAnalyzer->data(channel)->samples.spectrum.sample[position]; | |
| 369 | + if(this->dataAnalyzer->data(channel)) { | |
| 370 | + if(this->settings->scope.voltage[channel].used) { | |
| 371 | + // Start with channel name and the sample interval | |
| 372 | + csvStream << "\"" << this->settings->scope.voltage[channel].name << "\"," << this->dataAnalyzer->data(channel)->samples.voltage.interval; | |
| 373 | + | |
| 374 | + // And now all sample values in volts | |
| 375 | + for(unsigned int position = 0; position < this->dataAnalyzer->data(channel)->samples.voltage.count; position++) | |
| 376 | + csvStream << "," << this->dataAnalyzer->data(channel)->samples.voltage.sample[position]; | |
| 377 | + | |
| 378 | + // Finally a newline | |
| 379 | + csvStream << '\n'; | |
| 380 | + } | |
| 388 | 381 | |
| 389 | - // Finally a newline | |
| 390 | - csvStream << '\n'; | |
| 382 | + if(this->settings->scope.spectrum[channel].used) { | |
| 383 | + // Start with channel name and the sample interval | |
| 384 | + csvStream << "\"" << this->settings->scope.spectrum[channel].name << "\"," << this->dataAnalyzer->data(channel)->samples.spectrum.interval; | |
| 385 | + | |
| 386 | + // And now all magnitudes in dB | |
| 387 | + for(unsigned int position = 0; position < this->dataAnalyzer->data(channel)->samples.spectrum.count; position++) | |
| 388 | + csvStream << "," << this->dataAnalyzer->data(channel)->samples.spectrum.sample[position]; | |
| 389 | + | |
| 390 | + // Finally a newline | |
| 391 | + csvStream << '\n'; | |
| 392 | + } | |
| 391 | 393 | } |
| 392 | 394 | } |
| 393 | 395 | ... | ... |
openhantek/src/glgenerator.cpp
| ... | ... | @@ -142,7 +142,7 @@ void GlGenerator::generateGraphs() { |
| 142 | 142 | for(int mode = Dso::CHANNELMODE_VOLTAGE; mode < Dso::CHANNELMODE_COUNT; mode++) { |
| 143 | 143 | for(int channel = 0; channel < this->settings->scope.voltage.count(); channel++) { |
| 144 | 144 | // Check if this channel is used and available at the data analyzer |
| 145 | - if(((mode == Dso::CHANNELMODE_VOLTAGE) ? this->settings->scope.voltage[channel].used : this->settings->scope.spectrum[channel].used) && this->dataAnalyzer->data(channel)->samples.voltage.sample) { | |
| 145 | + if(((mode == Dso::CHANNELMODE_VOLTAGE) ? this->settings->scope.voltage[channel].used : this->settings->scope.spectrum[channel].used) && this->dataAnalyzer->data(channel) && this->dataAnalyzer->data(channel)->samples.voltage.sample) { | |
| 146 | 146 | // Check if the sample count has changed |
| 147 | 147 | unsigned int neededSize = ((mode == Dso::CHANNELMODE_VOLTAGE) ? this->dataAnalyzer->data(channel)->samples.voltage.count : this->dataAnalyzer->data(channel)->samples.spectrum.count) * 2; |
| 148 | 148 | for(int index = 0; index < this->digitalPhosphorDepth; index++) { |
| ... | ... | @@ -190,7 +190,7 @@ void GlGenerator::generateGraphs() { |
| 190 | 190 | case Dso::GRAPHFORMAT_XY: |
| 191 | 191 | for(int channel = 0; channel < this->settings->scope.voltage.count(); channel ++) { |
| 192 | 192 | // For even channel numbers check if this channel is used and this and the following channel are available at the data analyzer |
| 193 | - if(channel % 2 == 0 && channel + 1 < this->settings->scope.voltage.count() && this->settings->scope.voltage[channel].used && this->dataAnalyzer->data(channel)->samples.voltage.sample && this->dataAnalyzer->data(channel + 1)->samples.voltage.sample) { | |
| 193 | + if(channel % 2 == 0 && channel + 1 < this->settings->scope.voltage.count() && this->settings->scope.voltage[channel].used && this->dataAnalyzer->data(channel) && this->dataAnalyzer->data(channel)->samples.voltage.sample && this->dataAnalyzer->data(channel + 1) && this->dataAnalyzer->data(channel + 1)->samples.voltage.sample) { | |
| 194 | 194 | // Check if the sample count has changed |
| 195 | 195 | unsigned int neededSize = qMin(this->dataAnalyzer->data(channel)->samples.voltage.count, this->dataAnalyzer->data(channel + 1)->samples.voltage.count) * 2; |
| 196 | 196 | for(int index = 0; index < this->digitalPhosphorDepth; index++) { | ... | ... |
openhantek/src/hantek/control.cpp
| ... | ... | @@ -322,11 +322,8 @@ namespace Hantek { |
| 322 | 322 | // Save raw data to temporary buffer |
| 323 | 323 | unsigned int dataCount = this->specification.recordLengths[this->settings.recordLengthId] * HANTEK_CHANNELS; |
| 324 | 324 | unsigned int dataLength = dataCount; |
| 325 | - bool using10Bits = false; | |
| 326 | - if(this->device->getModel() == MODEL_DSO5200 || this->device->getModel() == MODEL_DSO5200A) { | |
| 327 | - using10Bits = true; | |
| 325 | + if(this->specification.sampleSize > 8) | |
| 328 | 326 | dataLength *= 2; |
| 329 | - } | |
| 330 | 327 | |
| 331 | 328 | unsigned char data[dataLength]; |
| 332 | 329 | errorCode = this->device->bulkReadMulti(data, dataLength); |
| ... | ... | @@ -337,44 +334,21 @@ namespace Hantek { |
| 337 | 334 | if(process) { |
| 338 | 335 | // How much data did we really receive? |
| 339 | 336 | dataLength = errorCode; |
| 340 | - if(using10Bits) | |
| 337 | + if(this->specification.sampleSize > 8) | |
| 341 | 338 | dataCount = dataLength / 2; |
| 342 | 339 | else |
| 343 | 340 | dataCount = dataLength; |
| 344 | 341 | |
| 345 | 342 | this->samplesMutex.lock(); |
| 346 | 343 | |
| 347 | - // Get oscilloscope settings | |
| 348 | - bool fastRate = false; | |
| 349 | - UsedChannels usedChannels = USED_NONE; | |
| 350 | - switch(this->specification.command.bulk.setTrigger) { | |
| 351 | - case BULK_SETTRIGGERANDSAMPLERATE: | |
| 352 | - fastRate = ((BulkSetTriggerAndSamplerate *) this->command[BULK_SETTRIGGERANDSAMPLERATE])->getFastRate(); | |
| 353 | - usedChannels = (UsedChannels) ((BulkSetTriggerAndSamplerate *) this->command[BULK_SETTRIGGERANDSAMPLERATE])->getUsedChannels(); | |
| 354 | - break; | |
| 355 | - | |
| 356 | - case BULK_CSETTRIGGERORSAMPLERATE: | |
| 357 | - fastRate = ((BulkSetTrigger5200 *) this->command[BULK_ESETTRIGGERORSAMPLERATE])->getFastRate(); | |
| 358 | - usedChannels = (UsedChannels) ((BulkSetTrigger5200 *) this->command[BULK_ESETTRIGGERORSAMPLERATE])->getUsedChannels(); | |
| 359 | - break; | |
| 360 | - | |
| 361 | - case BULK_ESETTRIGGERORSAMPLERATE: | |
| 362 | - fastRate = ((BulkSetTrigger5200 *) this->command[BULK_ESETTRIGGERORSAMPLERATE])->getFastRate(); | |
| 363 | - usedChannels = (UsedChannels) ((BulkSetTrigger5200 *) this->command[BULK_ESETTRIGGERORSAMPLERATE])->getUsedChannels(); | |
| 364 | - break; | |
| 365 | - | |
| 366 | - default: | |
| 367 | - break; | |
| 368 | - } | |
| 369 | - | |
| 370 | 344 | // Convert channel data |
| 371 | - if(fastRate) { | |
| 345 | + if(this->settings.samplerate.limits == &this->specification.samplerate.single) { | |
| 372 | 346 | // Fast rate mode, one channel is using all buffers |
| 373 | - int channel; | |
| 374 | - if(usedChannels == USED_CH1) | |
| 375 | - channel = 0; | |
| 376 | - else | |
| 377 | - channel = 1; | |
| 347 | + int channel = 0; | |
| 348 | + for(; channel < HANTEK_CHANNELS; ++channel) { | |
| 349 | + if(this->settings.voltage[0].used) | |
| 350 | + break; | |
| 351 | + } | |
| 378 | 352 | |
| 379 | 353 | // Clear unused channels |
| 380 | 354 | for(int channelCounter = 0; channelCounter < HANTEK_CHANNELS; channelCounter++) |
| ... | ... | @@ -395,9 +369,11 @@ namespace Hantek { |
| 395 | 369 | |
| 396 | 370 | // Convert data from the oscilloscope and write it into the sample buffer |
| 397 | 371 | unsigned int bufferPosition = (this->settings.trigger.point + 1) * 2; |
| 398 | - if(using10Bits) { | |
| 399 | - // Additional 2 most significant bits after the normal data | |
| 372 | + if(this->specification.sampleSize > 8) { | |
| 373 | + // Additional most significant bits after the normal data | |
| 400 | 374 | unsigned int extraBitsPosition; // Track the position of the extra bits in the additional byte |
| 375 | + unsigned int extraBitsSize = this->specification.sampleSize - 8; // Number of extra bits | |
| 376 | + unsigned short int extraBitsMask = (0x00ff << extraBitsSize) & 0xff00; // Mask for extra bits extraction | |
| 401 | 377 | |
| 402 | 378 | for(unsigned int realPosition = 0; realPosition < dataCount; realPosition++, bufferPosition++) { |
| 403 | 379 | if(bufferPosition >= dataCount) |
| ... | ... | @@ -405,7 +381,7 @@ namespace Hantek { |
| 405 | 381 | |
| 406 | 382 | extraBitsPosition = bufferPosition % HANTEK_CHANNELS; |
| 407 | 383 | |
| 408 | - this->samples[channel][realPosition] = ((double) ((unsigned short int) data[bufferPosition] + (((unsigned short int) data[dataCount + bufferPosition - extraBitsPosition] << (8 - (HANTEK_CHANNELS - 1 - extraBitsPosition) * 2)) & 0x0200)) / this->specification.voltageLimit[HANTEK_CHANNELS - 1 - extraBitsPosition][this->settings.voltage[channel].gain] - this->settings.voltage[channel].offsetReal) * this->specification.gainSteps[this->settings.voltage[channel].gain]; | |
| 384 | + this->samples[channel][realPosition] = ((double) ((unsigned short int) data[bufferPosition] + (((unsigned short int) data[dataCount + bufferPosition - extraBitsPosition] << (8 - (HANTEK_CHANNELS - 1 - extraBitsPosition) * extraBitsSize)) & extraBitsMask)) / this->specification.voltageLimit[channel][this->settings.voltage[channel].gain] - this->settings.voltage[channel].offsetReal) * this->specification.gainSteps[this->settings.voltage[channel].gain]; | |
| 409 | 385 | } |
| 410 | 386 | } |
| 411 | 387 | else { |
| ... | ... | @@ -423,7 +399,7 @@ namespace Hantek { |
| 423 | 399 | unsigned int channelDataCount = dataCount / HANTEK_CHANNELS; |
| 424 | 400 | |
| 425 | 401 | for(int channel = 0; channel < HANTEK_CHANNELS; channel++) { |
| 426 | - if(usedChannels == USED_CH1CH2 || channel == usedChannels) { | |
| 402 | + if(this->settings.voltage[channel].used) { | |
| 427 | 403 | // Reallocate memory for samples if the sample count has changed |
| 428 | 404 | if(!this->samples[channel] || this->samplesSize[channel] != channelDataCount) { |
| 429 | 405 | if(this->samples[channel]) |
| ... | ... | @@ -434,13 +410,17 @@ namespace Hantek { |
| 434 | 410 | |
| 435 | 411 | // Convert data from the oscilloscope and write it into the sample buffer |
| 436 | 412 | unsigned int bufferPosition = (this->settings.trigger.point + 1) * 2; |
| 437 | - if(using10Bits) { | |
| 438 | - // Additional 2 most significant bits after the normal data | |
| 413 | + if(this->specification.sampleSize > 8) { | |
| 414 | + // Additional most significant bits after the normal data | |
| 415 | + unsigned int extraBitsSize = this->specification.sampleSize - 8; // Number of extra bits | |
| 416 | + unsigned short int extraBitsMask = (0x00ff << extraBitsSize) & 0xff00; // Mask for extra bits extraction | |
| 417 | + unsigned int extraBitsIndex = 8 - channel * 2; // Bit position offset for extra bits extraction | |
| 418 | + | |
| 439 | 419 | for(unsigned int realPosition = 0; realPosition < channelDataCount; realPosition++, bufferPosition += 2) { |
| 440 | 420 | if(bufferPosition >= dataCount) |
| 441 | 421 | bufferPosition %= dataCount; |
| 442 | 422 | |
| 443 | - this->samples[channel][realPosition] = ((double) ((unsigned short int) data[bufferPosition + HANTEK_CHANNELS - 1 - channel] + (((unsigned short int) data[dataCount + bufferPosition] << (8 - channel * 2)) & 0x0200)) / this->specification.voltageLimit[channel][this->settings.voltage[channel].gain] - this->settings.voltage[channel].offsetReal) * this->specification.gainSteps[this->settings.voltage[channel].gain]; | |
| 423 | + this->samples[channel][realPosition] = ((double) ((unsigned short int) data[bufferPosition + HANTEK_CHANNELS - 1 - channel] + (((unsigned short int) data[dataCount + bufferPosition] << extraBitsIndex) & extraBitsMask)) / this->specification.voltageLimit[channel][this->settings.voltage[channel].gain] - this->settings.voltage[channel].offsetReal) * this->specification.gainSteps[this->settings.voltage[channel].gain]; | |
| 444 | 424 | } |
| 445 | 425 | } |
| 446 | 426 | else { |
| ... | ... | @@ -659,6 +639,7 @@ namespace Hantek { |
| 659 | 639 | << 368 << 454 << 908 << 368 << 454 << 908 << 368 << 454 << 908; |
| 660 | 640 | this->specification.gainIndex |
| 661 | 641 | << 1 << 0 << 0 << 1 << 0 << 0 << 1 << 0 << 0; |
| 642 | + this->specification.sampleSize = 10; | |
| 662 | 643 | break; |
| 663 | 644 | |
| 664 | 645 | case MODEL_DSO2250: |
| ... | ... | @@ -675,6 +656,7 @@ namespace Hantek { |
| 675 | 656 | << 255 << 255 << 255 << 255 << 255 << 255 << 255 << 255 << 255; |
| 676 | 657 | this->specification.gainIndex |
| 677 | 658 | << 0 << 1 << 2 << 0 << 1 << 2 << 0 << 1 << 2; |
| 659 | + this->specification.sampleSize = 8; | |
| 678 | 660 | break; |
| 679 | 661 | |
| 680 | 662 | case MODEL_DSO2150: |
| ... | ... | @@ -691,6 +673,7 @@ namespace Hantek { |
| 691 | 673 | << 255 << 255 << 255 << 255 << 255 << 255 << 255 << 255 << 255; |
| 692 | 674 | this->specification.gainIndex |
| 693 | 675 | << 0 << 1 << 2 << 0 << 1 << 2 << 0 << 1 << 2; |
| 676 | + this->specification.sampleSize = 8; | |
| 694 | 677 | break; |
| 695 | 678 | |
| 696 | 679 | default: |
| ... | ... | @@ -707,6 +690,7 @@ namespace Hantek { |
| 707 | 690 | << 255 << 255 << 255 << 255 << 255 << 255 << 255 << 255 << 255; |
| 708 | 691 | this->specification.gainIndex |
| 709 | 692 | << 0 << 1 << 2 << 0 << 1 << 2 << 0 << 1 << 2; |
| 693 | + this->specification.sampleSize = 8; | |
| 710 | 694 | break; |
| 711 | 695 | } |
| 712 | 696 | this->settings.samplerate.limits = &(this->specification.samplerate.single); |
| ... | ... | @@ -855,8 +839,7 @@ namespace Hantek { |
| 855 | 839 | if(channel >= HANTEK_CHANNELS) |
| 856 | 840 | return Dso::ERROR_PARAMETER; |
| 857 | 841 | |
| 858 | - unsigned char usedChannels = USED_CH1; | |
| 859 | - | |
| 842 | + // Channel filtering commands | |
| 860 | 843 | switch(this->specification.command.bulk.setFilter) { |
| 861 | 844 | case BULK_SETFILTER: { |
| 862 | 845 | // SetFilter bulk command for channel filter (used has to be inverted!) |
| ... | ... | @@ -864,13 +847,6 @@ namespace Hantek { |
| 864 | 847 | commandSetFilter->setChannel(channel, !used); |
| 865 | 848 | this->commandPending[BULK_SETFILTER] = true; |
| 866 | 849 | |
| 867 | - if(!commandSetFilter->getChannel(1)) { | |
| 868 | - if(commandSetFilter->getChannel(0)) | |
| 869 | - usedChannels = USED_CH2; | |
| 870 | - else | |
| 871 | - usedChannels = USED_CH1CH2; | |
| 872 | - } | |
| 873 | - | |
| 874 | 850 | break; |
| 875 | 851 | } |
| 876 | 852 | case BULK_BSETFILTER: { |
| ... | ... | @@ -885,7 +861,26 @@ namespace Hantek { |
| 885 | 861 | return Dso::ERROR_UNSUPPORTED; |
| 886 | 862 | } |
| 887 | 863 | |
| 864 | + // Update settings | |
| 865 | + this->settings.voltage[channel].used = used; | |
| 866 | + unsigned int channelCount = 0; | |
| 867 | + for(int channelCounter = 0; channelCounter < HANTEK_CHANNELS; ++channelCounter) { | |
| 868 | + if(this->settings.voltage[channelCounter].used) | |
| 869 | + ++channelCount; | |
| 870 | + } | |
| 871 | + this->settings.usedChannels = channelCount; | |
| 872 | + | |
| 873 | + // Additional UsedChannels field for all models except DSO-2250 | |
| 888 | 874 | if(this->specification.command.bulk.setTrigger == BULK_SETTRIGGERANDSAMPLERATE || this->specification.command.bulk.setTrigger == BULK_ESETTRIGGERORSAMPLERATE) { |
| 875 | + unsigned char usedChannels = USED_CH1; | |
| 876 | + | |
| 877 | + if(this->settings.voltage[1].used) { | |
| 878 | + if(this->settings.voltage[0].used) | |
| 879 | + usedChannels = USED_CH1CH2; | |
| 880 | + else | |
| 881 | + usedChannels = USED_CH2; | |
| 882 | + } | |
| 883 | + | |
| 889 | 884 | switch(this->specification.command.bulk.setTrigger) { |
| 890 | 885 | case BULK_SETTRIGGERANDSAMPLERATE: { |
| 891 | 886 | // SetTriggerAndSamplerate bulk command for trigger source |
| ... | ... | @@ -1119,9 +1114,7 @@ namespace Hantek { |
| 1119 | 1114 | switch(this->specification.command.bulk.setTrigger) { |
| 1120 | 1115 | case BULK_SETTRIGGERANDSAMPLERATE: { |
| 1121 | 1116 | // SetTriggerAndSamplerate bulk command for trigger slope |
| 1122 | - BulkSetTriggerAndSamplerate *commandSetTriggerAndSamplerate = (BulkSetTriggerAndSamplerate *) this->command[BULK_SETTRIGGERANDSAMPLERATE]; | |
| 1123 | - | |
| 1124 | - commandSetTriggerAndSamplerate->setTriggerSlope(slope); | |
| 1117 | + ((BulkSetTriggerAndSamplerate *) this->command[BULK_SETTRIGGERANDSAMPLERATE])->setTriggerSlope(slope); | |
| 1125 | 1118 | this->commandPending[BULK_SETTRIGGERANDSAMPLERATE] = true; |
| 1126 | 1119 | break; |
| 1127 | 1120 | } |
| ... | ... | @@ -1154,13 +1147,12 @@ namespace Hantek { |
| 1154 | 1147 | |
| 1155 | 1148 | // All trigger positions are measured in samples |
| 1156 | 1149 | unsigned long int positionSamples = position * this->settings.samplerate.current; |
| 1150 | + // Fast rate mode uses both channels | |
| 1151 | + if(this->settings.samplerate.limits == &this->specification.samplerate.single) | |
| 1152 | + positionSamples /= HANTEK_CHANNELS; | |
| 1157 | 1153 | |
| 1158 | 1154 | switch(this->specification.command.bulk.setPretrigger) { |
| 1159 | 1155 | case BULK_SETTRIGGERANDSAMPLERATE: { |
| 1160 | - // Fast rate mode uses both channels | |
| 1161 | - if(((BulkSetTriggerAndSamplerate *) this->command[BULK_SETTRIGGERANDSAMPLERATE])->getFastRate()) | |
| 1162 | - positionSamples /= HANTEK_CHANNELS; | |
| 1163 | - | |
| 1164 | 1156 | // Calculate the position value (Start point depending on record length) |
| 1165 | 1157 | unsigned long int position = 0x7ffff - this->specification.recordLengths[this->settings.recordLengthId] + positionSamples; |
| 1166 | 1158 | |
| ... | ... | @@ -1171,10 +1163,6 @@ namespace Hantek { |
| 1171 | 1163 | break; |
| 1172 | 1164 | } |
| 1173 | 1165 | case BULK_FSETBUFFER: { |
| 1174 | - // Fast rate mode uses both channels | |
| 1175 | - if(((BulkSetSamplerate2250 *) this->command[BULK_ESETTRIGGERORSAMPLERATE])->getFastRate()) | |
| 1176 | - positionSamples /= HANTEK_CHANNELS; | |
| 1177 | - | |
| 1178 | 1166 | // Calculate the position values (Inverse, maximum is 0xffff) |
| 1179 | 1167 | unsigned short int positionPre = 0xffff - this->specification.recordLengths[this->settings.recordLengthId] + positionSamples; |
| 1180 | 1168 | unsigned short int positionPost = 0xffff - positionSamples; |
| ... | ... | @@ -1188,10 +1176,6 @@ namespace Hantek { |
| 1188 | 1176 | break; |
| 1189 | 1177 | } |
| 1190 | 1178 | case BULK_ESETTRIGGERORSAMPLERATE: { |
| 1191 | - // Fast rate mode uses both channels | |
| 1192 | - if(((BulkSetTrigger5200 *) this->command[BULK_ESETTRIGGERORSAMPLERATE])->getFastRate()) | |
| 1193 | - positionSamples /= HANTEK_CHANNELS; | |
| 1194 | - | |
| 1195 | 1179 | // Calculate the position values (Inverse, maximum is 0xffff) |
| 1196 | 1180 | unsigned short int positionPre = 0xffff - this->specification.recordLengths[this->settings.recordLengthId] + positionSamples; |
| 1197 | 1181 | unsigned short int positionPost = 0xffff - positionSamples; | ... | ... |
openhantek/src/hantek/control.h
| ... | ... | @@ -117,6 +117,7 @@ namespace Hantek { |
| 117 | 117 | QList<unsigned long int> recordLengths; ///< Available record lengths, ULONG_MAX means rolling |
| 118 | 118 | QList<unsigned long int> bufferDividers; ///< Samplerate dividers for record lengths |
| 119 | 119 | QList<double> gainSteps; ///< Available voltage steps in V/screenheight |
| 120 | + unsigned char sampleSize; ///< Number of bits per sample | |
| 120 | 121 | |
| 121 | 122 | // Calibration |
| 122 | 123 | /// The sample values at the top of the screen | ... | ... |
openhantek/src/hantek/types.h