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 <wsa@the-dreams.de>
This commit is contained in:
Wolfram Sang 2016-01-03 22:27:44 +01:00 committed by Uwe Hermann
parent 2e1c4817c7
commit ee2e9be21b
2 changed files with 11 additions and 3 deletions

View File

@ -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)

View File

@ -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;