Commit 57e0bebcc1d4cf99d70071eae48604149332abd3

Authored by Winged Unicorn
Committed by David Gräff
1 parent 9935f0a6

Use actual data returned from the cmdGetLimits.

Fixes #158
openhantek/src/hantekdso/hantekdsocontrol.cpp
@@ -135,7 +135,7 @@ Dso::ErrorCode HantekDsoControl::retrieveChannelLevelData() { @@ -135,7 +135,7 @@ Dso::ErrorCode HantekDsoControl::retrieveChannelLevelData() {
135 return Dso::ErrorCode::CONNECTION; 135 return Dso::ErrorCode::CONNECTION;
136 } 136 }
137 137
138 - memcpy(controlsettings.offsetLimit, controlsettings.cmdGetLimits.offsetLimitData(), 138 + memcpy(controlsettings.offsetLimit, controlsettings.cmdGetLimits.data(),
139 sizeof(OffsetsPerGainStep) * specification->channels); 139 sizeof(OffsetsPerGainStep) * specification->channels);
140 140
141 return Dso::ErrorCode::NONE; 141 return Dso::ErrorCode::NONE;
openhantek/src/hantekprotocol/controlStructs.cpp
@@ -130,7 +130,7 @@ ControlAcquireHardData::ControlAcquireHardData() : ControlCommand(ControlCode::C @@ -130,7 +130,7 @@ ControlAcquireHardData::ControlAcquireHardData() : ControlCommand(ControlCode::C
130 } 130 }
131 131
132 ControlGetLimits::ControlGetLimits(size_t channels) 132 ControlGetLimits::ControlGetLimits(size_t channels)
133 - : ControlCommand(ControlCode::CONTROL_VALUE, 1), offsetLimit(new OffsetsPerGainStep[channels]) { 133 + : ControlCommand(ControlCode::CONTROL_VALUE, sizeof(OffsetsPerGainStep)*channels) {
134 value = (uint8_t)ControlValue::VALUE_OFFSETLIMITS; 134 value = (uint8_t)ControlValue::VALUE_OFFSETLIMITS;
135 data()[0] = 0x01; 135 data()[0] = 0x01;
136 } 136 }
openhantek/src/hantekprotocol/controlStructs.h
@@ -129,8 +129,6 @@ struct ControlAcquireHardData : public ControlCommand { @@ -129,8 +129,6 @@ struct ControlAcquireHardData : public ControlCommand {
129 }; 129 };
130 130
131 struct ControlGetLimits : public ControlCommand { 131 struct ControlGetLimits : public ControlCommand {
132 - std::unique_ptr<OffsetsPerGainStep[]> offsetLimit;  
133 ControlGetLimits(size_t channels); 132 ControlGetLimits(size_t channels);
134 - inline uint8_t *offsetLimitData() { return (uint8_t *)offsetLimit.get(); }  
135 }; 133 };
136 } 134 }