From: Aurelien Jacobs Date: Sun, 21 Aug 2016 15:00:14 +0000 (+0200) Subject: lascar-el-usb: properly set encoding digits X-Git-Tag: libsigrok-0.5.0~251 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=fa2b19226d562f21fe36e9a73ff2beafc26c8eb6;p=libsigrok.git lascar-el-usb: properly set encoding digits --- diff --git a/src/hardware/lascar-el-usb/protocol.c b/src/hardware/lascar-el-usb/protocol.c index 901b2525..96beb5a1 100644 --- a/src/hardware/lascar-el-usb/protocol.c +++ b/src/hardware/lascar-el-usb/protocol.c @@ -434,10 +434,15 @@ static void lascar_el_usb_dispatch(struct sr_dev_inst *sdi, unsigned char *buf, if (ch->enabled) { analog.meaning->channels = g_slist_append(NULL, ch); analog.meaning->mq = SR_MQ_TEMPERATURE; - if (devc->temp_unit == 1) + if (devc->temp_unit == 1) { analog.meaning->unit = SR_UNIT_FAHRENHEIT; - else + analog.encoding->digits = 0; + analog.spec->spec_digits = 0; + } else { analog.meaning->unit = SR_UNIT_CELSIUS; + analog.encoding->digits = 1; + analog.spec->spec_digits = 1; + } analog.data = (void *)temp; sr_session_send(sdi, &packet); g_slist_free(analog.meaning->channels); @@ -448,6 +453,8 @@ static void lascar_el_usb_dispatch(struct sr_dev_inst *sdi, unsigned char *buf, analog.meaning->channels = g_slist_append(NULL, ch); analog.meaning->mq = SR_MQ_RELATIVE_HUMIDITY; analog.meaning->unit = SR_UNIT_PERCENTAGE; + analog.encoding->digits = 1; + analog.spec->spec_digits = 1; analog.data = (void *)rh; sr_session_send(sdi, &packet); g_slist_free(analog.meaning->channels);