From: Wolfram Sang Date: Sun, 3 Jan 2016 21:27:44 +0000 (+0100) Subject: dmm: vc870: support effective voltage & current X-Git-Tag: libsigrok-0.4.0~34 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=ee2e9be21be59e9455a78ce3598db49e3b38e6f6;p=libsigrok.git dmm: vc870: support effective voltage & current And rename the status variable because in sigrok the term RMS is used instead of "effective value". Signed-off-by: Wolfram Sang --- diff --git a/src/dmm/vc870.c b/src/dmm/vc870.c index 125f4712..fc795678 100644 --- a/src/dmm/vc870.c +++ b/src/dmm/vc870.c @@ -150,7 +150,7 @@ static int parse_range(uint8_t b, float *floatval, mode = 16; /* Act+apparent power */ else if (info->is_power_factor_freq) mode = 17; /* Power factor / freq */ - else if (info->is_v_a_eff_value) + else if (info->is_v_a_rms_value) mode = 18; /* V eff + A eff */ else { sr_dbg("Invalid mode, range byte was: 0x%02x.", b); @@ -225,7 +225,7 @@ static void parse_flags(const uint8_t *buf, struct vc870_info *info) info->is_power_factor_freq = TRUE; else if (buf[1] == 0x32) /* Voltage effective value + current effective value */ - info->is_v_a_eff_value = TRUE; + info->is_v_a_rms_value = TRUE; break; default: sr_dbg("Invalid function bytes: %02x %02x.", buf[0], buf[1]); @@ -351,6 +351,14 @@ static void handle_flags(struct sr_datafeed_analog_old *analog, // analog->mq = SR_MQ_FREQUENCY; // analog->unit = SR_UNIT_HERTZ; } + if (info->is_v_a_rms_value) { + analog->mqflags |= SR_MQFLAG_RMS; + analog->mq = SR_MQ_VOLTAGE; + analog->unit = SR_UNIT_VOLT; + /* TODO: Handle effective current value */ + // analog->mq = SR_MQ_CURRENT; + // analog->unit = SR_UNIT_AMPERE; + } /* Measurement related flags */ if (info->is_ac) diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 5ada5f99..09a4f5c5 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -1196,7 +1196,7 @@ struct vc870_info { gboolean is_voltage, is_dc, is_ac, is_temperature, is_resistance; gboolean is_continuity, is_capacitance, is_diode, is_loop_current; gboolean is_current, is_micro, is_milli, is_power; - gboolean is_power_factor_freq, is_power_apparent_power, is_v_a_eff_value; + gboolean is_power_factor_freq, is_power_apparent_power, is_v_a_rms_value; gboolean is_sign2, is_sign1, is_batt, is_ol1, is_max, is_min; gboolean is_maxmin, is_rel, is_ol2, is_open, is_manu, is_hold; gboolean is_light, is_usb, is_warning, is_auto_power, is_misplug_warn;