]> sigrok.org Git - libsigrok.git/commitdiff
metex14: Add power factor measurement mode
authorFrank Stettner <redacted>
Thu, 22 Feb 2018 14:16:15 +0000 (15:16 +0100)
committerFrank Stettner <redacted>
Mon, 5 Mar 2018 19:23:26 +0000 (20:23 +0100)
src/dmm/metex14.c
src/libsigrok-internal.h

index f15dd4a087e603772b7c448d422744dcf0ed8aae..f7d05b638b5dccf911c29a56c9268ce03db6b9ed 100644 (file)
@@ -171,6 +171,7 @@ static void parse_flags(const char *buf, struct metex14_info *info)
        info->is_gain = !strncmp(buf, "DB", 2) && info->is_decibel;
        info->is_power = (!strncmp(buf, "dB", 2) && info->is_decibel_mw) ||
                ((!strncmp(buf, "WT", 2) && info->is_watt));
+       info->is_power_factor = !strncmp(buf, "CO", 2) && info->is_unitless;
        info->is_hfe = !strncmp(buf, "HF", 2) ||
                (!strncmp(buf, "  ", 2) && !info->is_volt && !info->is_ohm &&
                 !info->is_logic && !info->is_farad && !info->is_hertz);
@@ -254,6 +255,10 @@ static void handle_flags(struct sr_datafeed_analog *analog, float *floatval,
                else
                        analog->meaning->unit = SR_UNIT_UNITLESS;
        }
+       if (info->is_power_factor) {
+               analog->meaning->mq = SR_MQ_POWER_FACTOR;
+               analog->meaning->unit = SR_UNIT_UNITLESS;
+       }
        if (info->is_gain) {
                analog->meaning->mq = SR_MQ_GAIN;
                analog->meaning->unit = SR_UNIT_DECIBEL_VOLT;
index 0a8032b3d5999828f5081f2d2e5fa39660f3300f..06432b2db3de4fdf65cf4edb22e117c0618a0ae0 100644 (file)
@@ -1279,7 +1279,7 @@ struct metex14_info {
        gboolean is_diode, is_frequency, is_ampere, is_volt, is_farad;
        gboolean is_hertz, is_ohm, is_celsius, is_fahrenheit, is_watt;
        gboolean is_pico, is_nano, is_micro, is_milli, is_kilo, is_mega;
-       gboolean is_gain, is_decibel, is_power, is_decibel_mw;
+       gboolean is_gain, is_decibel, is_power, is_decibel_mw, is_power_factor;
        gboolean is_hfe, is_unitless, is_logic, is_min, is_max, is_avg;
 };