From: Aurelien Jacobs Date: Fri, 19 Aug 2016 22:56:23 +0000 (+0200) Subject: rigol-ds: properly set encoding digits X-Git-Tag: libsigrok-0.5.0~260 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=b8f07f42216dd9b07d433d12cb660a617a0c3757;p=libsigrok.git rigol-ds: properly set encoding digits --- diff --git a/src/hardware/rigol-ds/protocol.c b/src/hardware/rigol-ds/protocol.c index 98570ff0..df72307d 100644 --- a/src/hardware/rigol-ds/protocol.c +++ b/src/hardware/rigol-ds/protocol.c @@ -672,7 +672,9 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data) else for (i = 0; i < len; i++) devc->data[i] = (128 - devc->buffer[i]) * vdiv - offset; - sr_analog_init(&analog, &encoding, &meaning, &spec, 0); + float vdivlog = log10f(vdiv); + int digits = -(int)vdivlog + (vdivlog < 0.0); + sr_analog_init(&analog, &encoding, &meaning, &spec, digits); analog.meaning->channels = g_slist_append(NULL, ch); analog.num_samples = len; analog.data = devc->data;