Commit 9ba93c8642d665205027aadd6ef656251ebe7473

Authored by oliverhaag
1 parent 15b7950a

Bugfix in Hantek::Control::setOffset, thanks to tinosnitso for reporting

openhantek/ChangeLog
@@ -130,3 +130,6 @@ @@ -130,3 +130,6 @@
130 2011-11-16 Oliver Haag <oliver.haag@gmail.com> 130 2011-11-16 Oliver Haag <oliver.haag@gmail.com>
131 * Redesign of Hantek::Control to make it easier to add support for new models 131 * Redesign of Hantek::Control to make it easier to add support for new models
132 * Removed buggy destructor from GlGenerator, proper cleanup still missing 132 * Removed buggy destructor from GlGenerator, proper cleanup still missing
  133 +
  134 +2011-11-16 Oliver Haag <oliver.haag@gmail.com>
  135 +* Bugfix: Copy-paste in Hantek::Control::setOffset, thanks to tinosnitso
openhantek/src/hantek/control.cpp
@@ -890,7 +890,7 @@ namespace Hantek { @@ -890,7 +890,7 @@ namespace Hantek {
890 // Calculate the offset value 890 // Calculate the offset value
891 // The range is given by the calibration data (convert from big endian) 891 // The range is given by the calibration data (convert from big endian)
892 unsigned short int minimum = ((unsigned short int) *((unsigned char *) &(this->specification.offsetLimit[channel][this->settings.voltage[channel].gain][OFFSET_START])) << 8) + *((unsigned char *) &(this->specification.offsetLimit[channel][this->settings.voltage[channel].gain][OFFSET_START]) + 1); 892 unsigned short int minimum = ((unsigned short int) *((unsigned char *) &(this->specification.offsetLimit[channel][this->settings.voltage[channel].gain][OFFSET_START])) << 8) + *((unsigned char *) &(this->specification.offsetLimit[channel][this->settings.voltage[channel].gain][OFFSET_START]) + 1);
893 - unsigned short int maximum = ((unsigned short int) *((unsigned char *) &(this->specification.offsetLimit[channel][this->settings.voltage[channel].gain][OFFSET_START])) << 8) + *((unsigned char *) &(this->specification.offsetLimit[channel][this->settings.voltage[channel].gain][OFFSET_END]) + 1); 893 + unsigned short int maximum = ((unsigned short int) *((unsigned char *) &(this->specification.offsetLimit[channel][this->settings.voltage[channel].gain][OFFSET_END])) << 8) + *((unsigned char *) &(this->specification.offsetLimit[channel][this->settings.voltage[channel].gain][OFFSET_END]) + 1);
894 unsigned short int offsetValue = offset * (maximum - minimum) + minimum + 0.5; 894 unsigned short int offsetValue = offset * (maximum - minimum) + minimum + 0.5;
895 double offsetReal = (double) (offsetValue - minimum) / (maximum - minimum); 895 double offsetReal = (double) (offsetValue - minimum) / (maximum - minimum);
896 896