]> sigrok.org Git - pulseview.git/commitdiff
Added property binding for SR_CONF_VOLTAGE_THRESHOLD.
authorMarcus Comstedt <redacted>
Sun, 4 Aug 2013 14:35:35 +0000 (16:35 +0200)
committerMarcus Comstedt <redacted>
Sun, 4 Aug 2013 14:35:35 +0000 (16:35 +0200)
pv/prop/binding/deviceoptions.cpp
pv/prop/binding/deviceoptions.h

index 1ce08eb8a14d7c9b6cc4a167625e28a5606f5051..1b95cfe0b2314b89e4f40fe7d3029d2045f59475 100644 (file)
@@ -95,6 +95,10 @@ DeviceOptions::DeviceOptions(struct sr_dev_inst *sdi) :
                case SR_CONF_VDIV:
                        bind_enum(name, key, gvar_list, print_vdiv);
                        break;
+
+               case SR_CONF_VOLTAGE_THRESHOLD:
+                       bind_enum(name, key, gvar_list, print_voltage_threshold);
+                       break;
                }
 
                if (gvar_list)
@@ -255,6 +259,15 @@ QString DeviceOptions::print_vdiv(GVariant *const gvar)
        return QString(sr_voltage_string(p, q));
 }
 
+QString DeviceOptions::print_voltage_threshold(GVariant *const gvar)
+{
+       gdouble lo, hi;
+       char buf[64];
+       g_variant_get(gvar, "(dd)", &lo, &hi);
+       snprintf(buf, sizeof(buf), "L<%.1fV H>%.1fV", lo, hi);
+       return QString(buf);
+}
+
 } // binding
 } // prop
 } // pv
index 491acfc45703a028f9c083b374713984a0d27d1d..e8af8e8a3b4678bd6e2d5c14472f698bba204a84 100644 (file)
@@ -65,6 +65,7 @@ private:
 
        static QString print_timebase(GVariant *const gvar);
        static QString print_vdiv(GVariant *const gvar);
+       static QString print_voltage_threshold(GVariant *const gvar);
 
 protected:
        struct sr_dev_inst *const _sdi;