struct sr_datafeed_analog *analog, void *info)
{
gboolean is_overload, is_bad_jack;
- int exponent;
int digits;
struct meterman_info mi;
if (meterman_38xr_decode(buf, &mi) != SR_OK)
return SR_ERR;
+ digits = 0;
+
if (mi.meas_mode != MEAS_MODE_CONTINUITY) {
is_overload = mi.reading == METERMAN_DIGITS_OVERLOAD;
is_bad_jack = mi.reading == METERMAN_DIGITS_BAD_INPUT_JACK;
if (mi.rflag_h == 0x0a || mi.peakstatus == 0x0b)
analog->meaning->mqflags |= SR_MQFLAG_AUTORANGE;
if (mi.meas_mode != MEAS_MODE_CONTINUITY) {
- digits = decimal_digits[mi.meas_mode][mi.rangecode];
- exponent = units_exponents[mi.meas_mode][mi.rangecode];
+ digits = units_exponents[mi.meas_mode][mi.rangecode] -
+ decimal_digits[mi.meas_mode][mi.rangecode];
*floatval = mi.reading;
if (meterman_38xr_is_negative(&mi)) {
*floatval *= -1.0f;
}
- *floatval *= powf(10, -digits);
- *floatval *= powf(10, exponent);
+ *floatval *= powf(10, digits);
}
- analog->encoding->digits = 4;
- analog->spec->spec_digits = 4;
+ analog->encoding->digits = -digits;
+ analog->spec->spec_digits = -digits;
return SR_OK;
}