When a meter display 105.2 kΩ, libsigrok will return 105200 Ω
but it is really valuable to know that the last 2 digits are not
significant, so encoding.digits should be set to -2.
This would allow a sigrok client to display 105200 as 105.2 k
instead of 105.200 k.
gboolean is_signed;
gboolean is_float;
gboolean is_bigendian;
- uint8_t digits;
+ int8_t digits;
gboolean is_digits_decimal;
struct sr_rational scale;
struct sr_rational offset;
};
struct sr_analog_spec {
- uint8_t spec_digits;
+ int8_t spec_digits;
};
/** Generic option struct used by various subsystems. */
for (l = analog->meaning->channels, c = 0; l; l = l->next, c++) {
ch = l->data;
g_string_append_printf(*out, "%s: ", ch->name);
- number = g_strdup_printf("%.*f", digits,
+ number = g_strdup_printf("%.*f", MAX(digits, 0),
fdata[i * num_channels + c]);
g_string_append(*out, number);
g_free(number);