From: Frank Stettner Date: Thu, 22 Feb 2018 14:16:15 +0000 (+0100) Subject: metex14: Add power factor measurement mode X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=fd8dc1db01ba1d0ec6a993cf6db6a2a83ec59e33;p=libsigrok.git metex14: Add power factor measurement mode --- diff --git a/src/dmm/metex14.c b/src/dmm/metex14.c index f15dd4a0..f7d05b63 100644 --- a/src/dmm/metex14.c +++ b/src/dmm/metex14.c @@ -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; diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 0a8032b3..06432b2d 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -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; };