this, SLOT(on_samples_cleared()));
disconnect(data.get(), SIGNAL(samples_added(QObject*, uint64_t, uint64_t)),
this, SLOT(on_samples_added(QObject*, uint64_t, uint64_t)));
this, SLOT(on_samples_cleared()));
disconnect(data.get(), SIGNAL(samples_added(QObject*, uint64_t, uint64_t)),
this, SLOT(on_samples_added(QObject*, uint64_t, uint64_t)));
+
+ if (channel_type_ == AnalogChannel) {
+ shared_ptr<Analog> analog = analog_data();
+ assert(analog);
+
+ disconnect(analog.get(), SIGNAL(min_max_changed(float, float)),
+ this, SLOT(on_min_max_changed(float, float)));
+ }
this, SLOT(on_samples_cleared()));
connect(data.get(), SIGNAL(samples_added(QObject*, uint64_t, uint64_t)),
this, SLOT(on_samples_added(QObject*, uint64_t, uint64_t)));
this, SLOT(on_samples_cleared()));
connect(data.get(), SIGNAL(samples_added(QObject*, uint64_t, uint64_t)),
this, SLOT(on_samples_added(QObject*, uint64_t, uint64_t)));
+
+ if (channel_type_ == AnalogChannel) {
+ shared_ptr<Analog> analog = analog_data();
+ assert(analog);
+
+ connect(analog.get(), SIGNAL(min_max_changed(float, float)),
+ this, SLOT(on_min_max_changed(float, float)));
+ }
(conversion_type_ == A2LConversionBySchmittTrigger)))
result = dynamic_pointer_cast<Logic>(converted_data_);
(conversion_type_ == A2LConversionBySchmittTrigger)))
result = dynamic_pointer_cast<Logic>(converted_data_);
// Use currently active conversion if no conversion type was supplied
if (conv_type == NoConversion)
conv_type = conversion_type_;
if (always_custom)
// Use currently active conversion if no conversion type was supplied
if (conv_type == NoConversion)
conv_type = conversion_type_;
if (always_custom)
auto thr_iter = conversion_options_.find("threshold_value");
if (thr_iter != conversion_options_.end())
thr = (thr_iter->second).toDouble();
}
auto thr_iter = conversion_options_.find("threshold_value");
if (thr_iter != conversion_options_.end())
thr = (thr_iter->second).toDouble();
}
- if (preset == 1) thr = 0.9;
- if (preset == 2) thr = 1.8;
- if (preset == 3) thr = 2.5;
- if (preset == 4) thr = 1.5;
+ if ((int)preset == 1) thr = 0.9;
+ if ((int)preset == 2) thr = 1.8;
+ if ((int)preset == 3) thr = 2.5;
+ if ((int)preset == 4) thr = 1.5;
if (conv_type == A2LConversionBySchmittTrigger) {
double thr_lo = 0, thr_hi = 0;
if (conv_type == A2LConversionBySchmittTrigger) {
double thr_lo = 0, thr_hi = 0;
auto thr_lo_iter = conversion_options_.find("threshold_value_low");
if (thr_lo_iter != conversion_options_.end())
thr_lo = (thr_lo_iter->second).toDouble();
auto thr_lo_iter = conversion_options_.find("threshold_value_low");
if (thr_lo_iter != conversion_options_.end())
thr_lo = (thr_lo_iter->second).toDouble();
const double amplitude = max_value_ - min_value_;
const double center = min_value_ + (amplitude / 2);
thr_lo = center - (amplitude * 0.15); // 15% margin
thr_hi = center + (amplitude * 0.15); // 15% margin
}
const double amplitude = max_value_ - min_value_;
const double center = min_value_ + (amplitude / 2);
thr_lo = center - (amplitude * 0.15); // 15% margin
thr_hi = center + (amplitude * 0.15); // 15% margin
}
- if (preset == 1) { thr_lo = 0.3; thr_hi = 1.2; }
- if (preset == 2) { thr_lo = 0.7; thr_hi = 2.5; }
- if (preset == 3) { thr_lo = 1.3; thr_hi = 3.7; }
- if (preset == 4) { thr_lo = 0.8; thr_hi = 2.0; }
+ if ((int)preset == 1) { thr_lo = 0.3; thr_hi = 1.2; }
+ if ((int)preset == 2) { thr_lo = 0.7; thr_hi = 2.5; }
+ if ((int)preset == 3) { thr_lo = 1.3; thr_hi = 3.7; }
+ if ((int)preset == 4) { thr_lo = 0.8; thr_hi = 2.0; }
// Source: http://www.interfacebus.com/voltage_threshold.html
presets.emplace_back(tr("Signal average"), 0);
presets.emplace_back(tr("0.9V (for 1.8V CMOS)"), 1);
// Source: http://www.interfacebus.com/voltage_threshold.html
presets.emplace_back(tr("Signal average"), 0);
presets.emplace_back(tr("0.9V (for 1.8V CMOS)"), 1);
+void SignalBase::on_min_max_changed(float min, float max)
+{
+ (void)min;
+ (void)max;
+
+ // Restart conversion if one is enabled and uses a calculated threshold
+ if ((conversion_type_ != NoConversion) &&
+ (get_current_conversion_preset() == DynamicPreset))
+ start_conversion();
+}
+