mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-13 13:32:53 +08:00
fix: The dscope captured data and stoped
change the scale, but the measure information is error.
This commit is contained in:
parent
a8b359d43f
commit
d05af104e0
@ -111,20 +111,20 @@ public:
|
||||
return _threshold;
|
||||
}
|
||||
|
||||
inline void set_measure_voltage_factor1(uint64_t v){
|
||||
_measure_voltage_factor1 = v;
|
||||
inline void set_measure_voltage_factor(uint64_t v, int index){
|
||||
index == 0 ? _measure_voltage_factor1 = v : _measure_voltage_factor2 = v;
|
||||
}
|
||||
|
||||
inline uint64_t get_measure_voltage_factor1(){
|
||||
return _measure_voltage_factor1;
|
||||
inline uint64_t get_measure_voltage_factor(int index){
|
||||
return index == 0 ? _measure_voltage_factor1 : _measure_voltage_factor2;
|
||||
}
|
||||
|
||||
inline void set_measure_voltage_factor2(uint64_t v){
|
||||
_measure_voltage_factor2 = v;
|
||||
inline void set_data_scale(float scale, int index){
|
||||
index == 0 ? _data_scale1 = scale : _data_scale2 = scale;
|
||||
}
|
||||
|
||||
inline uint64_t get_measure_voltage_factor2(){
|
||||
return _measure_voltage_factor2;
|
||||
inline float get_data_scale(int index){
|
||||
return index == 0 ? _data_scale1 : _data_scale2;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -144,6 +144,8 @@ private:
|
||||
float _threshold;
|
||||
uint64_t _measure_voltage_factor1;
|
||||
uint64_t _measure_voltage_factor2;
|
||||
float _data_scale1 = 0;
|
||||
float _data_scale2 = 0;
|
||||
|
||||
friend class DsoSnapshotTest::Basic;
|
||||
};
|
||||
|
@ -399,16 +399,13 @@ namespace pv
|
||||
_capture_data->get_dso()->set_samplerate(samplerate);
|
||||
|
||||
if (_device_agent.get_work_mode() == DSO)
|
||||
{
|
||||
{
|
||||
for(auto s : _signals){
|
||||
if (s->get_type() == SR_CHANNEL_DSO){
|
||||
view::DsoSignal *ch = (view::DsoSignal*)s;
|
||||
uint64_t k = ch->get_vDial()->get_value();
|
||||
|
||||
if (ch->get_index() == 0)
|
||||
_capture_data->get_dso()->set_measure_voltage_factor1(k);
|
||||
else
|
||||
_capture_data->get_dso()->set_measure_voltage_factor2(k);
|
||||
_capture_data->get_dso()->set_measure_voltage_factor(k, ch->get_index());
|
||||
_capture_data->get_dso()->set_data_scale(ch->get_scale(), ch->get_index());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1495,9 +1495,10 @@ double DsoSignal::get_voltage(uint64_t index)
|
||||
|
||||
const double value = *_data->get_samples(index, index, get_index());
|
||||
const int hw_offset = get_hw_offset();
|
||||
uint64_t k = get_index() == 0 ? _data->get_measure_voltage_factor1() : _data->get_measure_voltage_factor2();
|
||||
uint64_t k = _data->get_measure_voltage_factor(this->get_index());
|
||||
float data_scale = _data->get_data_scale(this->get_index());
|
||||
|
||||
return (hw_offset - value) * _scale *
|
||||
return (hw_offset - value) * data_scale *
|
||||
k *_vDial->get_factor() *
|
||||
DS_CONF_DSO_VDIVS / get_view_rect().height();
|
||||
}
|
||||
@ -1514,12 +1515,13 @@ QString DsoSignal::get_voltage(double v, int p, bool scaled)
|
||||
|
||||
assert(_data);
|
||||
|
||||
uint64_t k = get_index() == 0 ? _data->get_measure_voltage_factor1() : _data->get_measure_voltage_factor2();
|
||||
uint64_t k = _data->get_measure_voltage_factor(this->get_index());
|
||||
float data_scale = _data->get_data_scale(this->get_index());
|
||||
|
||||
if (scaled)
|
||||
v = v * k * _vDial->get_factor() * DS_CONF_DSO_VDIVS / get_view_rect().height();
|
||||
else
|
||||
v = v * _scale * k * _vDial->get_factor() * DS_CONF_DSO_VDIVS / get_view_rect().height();
|
||||
v = v * data_scale * k * _vDial->get_factor() * DS_CONF_DSO_VDIVS / get_view_rect().height();
|
||||
|
||||
return abs(v) >= 1000 ? QString::number(v/1000.0, 'f', p) + "V" : QString::number(v, 'f', p) + "mV";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user