]> sigrok.org Git - libsigrok.git/blobdiff - hardware/common/dmm/metex14.c
metex14: Handle a few missing cases for overflow.
[libsigrok.git] / hardware / common / dmm / metex14.c
index e529727b87e17aa68e06137c53e9c8b136e5bafa..8ba4291364d2d3b2f9cf2880992ec985c4819c49 100644 (file)
@@ -61,6 +61,10 @@ static int parse_value(const uint8_t *buf, float *result)
        is_ol += (!strcasecmp((const char *)&valstr, "O.L")) ? 1 : 0;
        is_ol += (!strcasecmp((const char *)&valstr, "OL.")) ? 1 : 0;
        is_ol += (!strcasecmp((const char *)&valstr, "OL")) ? 1 : 0;
+       is_ol += (!strcasecmp((const char *)&valstr, "-.OL")) ? 1 : 0;
+       is_ol += (!strcasecmp((const char *)&valstr, "-O.L")) ? 1 : 0;
+       is_ol += (!strcasecmp((const char *)&valstr, "-OL.")) ? 1 : 0;
+       is_ol += (!strcasecmp((const char *)&valstr, "-OL")) ? 1 : 0;
        if (is_ol != 0) {
                sr_spew("Over limit.");
                *result = INFINITY;
@@ -128,6 +132,8 @@ static void parse_flags(const char *buf, struct metex14_info *info)
                info->is_kilo = info->is_ohm = TRUE;
        else if (!strcasecmp(u, "MOhm"))
                info->is_mega = info->is_ohm = TRUE;
+       else if (!strcasecmp(u, "pF"))
+               info->is_pico = info->is_farad = TRUE;
        else if (!strcasecmp(u, "nF"))
                info->is_nano = info->is_farad = TRUE;
        else if (!strcasecmp(u, "uF"))
@@ -148,6 +154,8 @@ static void handle_flags(struct sr_datafeed_analog *analog, float *floatval,
                         const struct metex14_info *info)
 {
        /* Factors */
+       if (info->is_pico)
+               *floatval /= 1000000000000ULL;
        if (info->is_nano)
                *floatval /= 1000000000;
        if (info->is_micro)
@@ -212,6 +220,7 @@ static gboolean flags_valid(const struct metex14_info *info)
 
        /* Does the packet have more than one multiplier? */
        count = 0;
+       count += (info->is_pico) ? 1 : 0;
        count += (info->is_nano) ? 1 : 0;
        count += (info->is_micro) ? 1 : 0;
        count += (info->is_milli) ? 1 : 0;