metex14: Add power factor measurement mode
This commit is contained in:
parent
187c300b59
commit
fd8dc1db01
|
@ -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_gain = !strncmp(buf, "DB", 2) && info->is_decibel;
|
||||||
info->is_power = (!strncmp(buf, "dB", 2) && info->is_decibel_mw) ||
|
info->is_power = (!strncmp(buf, "dB", 2) && info->is_decibel_mw) ||
|
||||||
((!strncmp(buf, "WT", 2) && info->is_watt));
|
((!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) ||
|
info->is_hfe = !strncmp(buf, "HF", 2) ||
|
||||||
(!strncmp(buf, " ", 2) && !info->is_volt && !info->is_ohm &&
|
(!strncmp(buf, " ", 2) && !info->is_volt && !info->is_ohm &&
|
||||||
!info->is_logic && !info->is_farad && !info->is_hertz);
|
!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
|
else
|
||||||
analog->meaning->unit = SR_UNIT_UNITLESS;
|
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) {
|
if (info->is_gain) {
|
||||||
analog->meaning->mq = SR_MQ_GAIN;
|
analog->meaning->mq = SR_MQ_GAIN;
|
||||||
analog->meaning->unit = SR_UNIT_DECIBEL_VOLT;
|
analog->meaning->unit = SR_UNIT_DECIBEL_VOLT;
|
||||||
|
|
|
@ -1279,7 +1279,7 @@ struct metex14_info {
|
||||||
gboolean is_diode, is_frequency, is_ampere, is_volt, is_farad;
|
gboolean is_diode, is_frequency, is_ampere, is_volt, is_farad;
|
||||||
gboolean is_hertz, is_ohm, is_celsius, is_fahrenheit, is_watt;
|
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_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;
|
gboolean is_hfe, is_unitless, is_logic, is_min, is_max, is_avg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue