Use getter for the conversion type instead of a local copy
[pulseview.git] / pv / data / signalbase.cpp
index ee1112d5d5260a67b745a8656590ca023fbeffdb..0e887b4c8bcd5c38ad2d10a09e3db8a2441cab2e 100644 (file)
@@ -174,6 +174,11 @@ shared_ptr<data::Logic> SignalBase::logic_data() const
        return result;
 }
 
+SignalBase::ConversionType SignalBase::get_conversion_type() const
+{
+       return conversion_type_;
+}
+
 void SignalBase::set_conversion_type(ConversionType t)
 {
        if (conversion_type_ != NoConversion) {
@@ -310,8 +315,9 @@ void SignalBase::conversion_thread_proc(QObject* segment)
 
                                if (conversion_type_ == A2LConversionBySchmittTrigger) {
                                        const float amplitude = max_v - min_v;
-                                       const float lo_thr = min_v + (amplitude * 0.1);  // 10% above min
-                                       const float hi_thr = max_v - (amplitude * 0.1);  // 10% below max
+                                       const float center = min_v + (amplitude / 2);
+                                       const float lo_thr = center - (amplitude * 0.15); // 15% margin
+                                       const float hi_thr = center + (amplitude * 0.15); // 15% margin
                                        uint8_t state = 0;  // TODO Use value of logic sample n-1 instead of 0
 
                                        // Convert as many sample blocks as we can