diff --git a/openhantek/ChangeLog b/openhantek/ChangeLog index fdec2f2..fd872e2 100644 --- a/openhantek/ChangeLog +++ b/openhantek/ChangeLog @@ -130,3 +130,6 @@ 2011-11-16 Oliver Haag * Redesign of Hantek::Control to make it easier to add support for new models * Removed buggy destructor from GlGenerator, proper cleanup still missing + +2011-11-16 Oliver Haag +* Bugfix: Copy-paste in Hantek::Control::setOffset, thanks to tinosnitso diff --git a/openhantek/src/hantek/control.cpp b/openhantek/src/hantek/control.cpp index 5dca16a..3d2d886 100644 --- a/openhantek/src/hantek/control.cpp +++ b/openhantek/src/hantek/control.cpp @@ -890,7 +890,7 @@ namespace Hantek { // Calculate the offset value // The range is given by the calibration data (convert from big endian) 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); - 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); + 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); unsigned short int offsetValue = offset * (maximum - minimum) + minimum + 0.5; double offsetReal = (double) (offsetValue - minimum) / (maximum - minimum);