]> sigrok.org Git - libsigrok.git/commitdiff
metex14: Add dB mode and hFE mode support.
authorUwe Hermann <redacted>
Sat, 1 Dec 2012 23:36:37 +0000 (00:36 +0100)
committerUwe Hermann <redacted>
Sun, 2 Dec 2012 13:22:51 +0000 (14:22 +0100)
This is found e.g. on the Metex M-3640D DMM.

hardware/common/dmm/metex14.c
libsigrok-internal.h

index 7d1cc056ed21ac7920c44321247bc71c42771220..52a98c851707a9287bb267b394c706b9e4c8c418 100644 (file)
@@ -126,6 +126,13 @@ static void parse_flags(const char *buf, struct metex14_info *info)
        info->is_temperature = !strncmp(buf, "TE", 2);
        info->is_diode       = !strncmp(buf, "DI", 2);
        info->is_frequency   = !strncmp(buf, "FR", 2);
+       info->is_gain        = !strncmp(buf, "DB", 2);
+       info->is_hfe         = !strncmp(buf, "HF", 2);
+
+       /*
+        * Note: "DB" shows the logarithmic ratio of input voltage to a
+        * pre-stored (user-changeable) value in the DMM.
+        */
 
        if (info->is_dc || info->is_ac)
                info->is_volt = TRUE;
@@ -159,6 +166,10 @@ static void parse_flags(const char *buf, struct metex14_info *info)
                info->is_kilo = info->is_hertz = TRUE;
        else if (!strncmp(buf + 9, "   C", 4))
                info->is_celsius = TRUE;
+       else if (!strncmp(buf + 9, "  DB", 4))
+               info->is_decibel = TRUE;
+       else if (!strncmp(buf + 9, "    ", 4))
+               info->is_unitless = TRUE;
 
        /* Byte 13: Always '\r' (carriage return, 0x0d, 13) */
 }
@@ -207,6 +218,14 @@ static void handle_flags(struct sr_datafeed_analog *analog, float *floatval,
                analog->mq = SR_MQ_VOLTAGE;
                analog->unit = SR_UNIT_VOLT;
        }
+       if (info->is_gain) {
+               analog->mq = SR_MQ_GAIN;
+               analog->unit = SR_UNIT_DECIBEL_VOLT;
+       }
+       if (info->is_hfe) {
+               analog->mq = SR_MQ_GAIN;
+               analog->unit = SR_UNIT_UNITLESS;
+       }
 
        /* Measurement related flags */
        if (info->is_ac)
index bed792b0f6d31af8c1f71d7de88a9942a363ff1e..0b92a488bfa43b43bd0cfc94b11e5582572b50b6 100644 (file)
@@ -197,7 +197,7 @@ struct metex14_info {
        gboolean is_ac, is_dc, is_resistance, is_capacity, is_temperature;
        gboolean is_diode, is_frequency, is_ampere, is_volt, is_farad;
        gboolean is_hertz, is_ohm, is_celsius, is_nano, is_micro, is_milli;
-       gboolean is_kilo, is_mega;
+       gboolean is_kilo, is_mega, is_gain, is_decibel, is_hfe, is_unitless;
 };
 
 SR_PRIV int sr_metex14_packet_request(struct sr_serial_dev_inst *serial);