From: Marcus Comstedt Date: Sun, 4 Aug 2013 14:35:35 +0000 (+0200) Subject: Added property binding for SR_CONF_VOLTAGE_THRESHOLD. X-Git-Tag: pulseview-0.2.0~330 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=628749849145b9bb2efab38d70962c40b0cf9d13;p=pulseview.git Added property binding for SR_CONF_VOLTAGE_THRESHOLD. --- diff --git a/pv/prop/binding/deviceoptions.cpp b/pv/prop/binding/deviceoptions.cpp index 1ce08eb8..1b95cfe0 100644 --- a/pv/prop/binding/deviceoptions.cpp +++ b/pv/prop/binding/deviceoptions.cpp @@ -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 diff --git a/pv/prop/binding/deviceoptions.h b/pv/prop/binding/deviceoptions.h index 491acfc4..e8af8e8a 100644 --- a/pv/prop/binding/deviceoptions.h +++ b/pv/prop/binding/deviceoptions.h @@ -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;