From: Aurelien Jacobs Date: Wed, 17 Aug 2016 20:01:04 +0000 (+0200) Subject: maynuo-m97: properly set encoding digits X-Git-Tag: libsigrok-0.5.0~262 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=4301f1726ac94b111f78c4631586480ed09e6faf;p=libsigrok.git maynuo-m97: properly set encoding digits --- diff --git a/src/hardware/maynuo-m97/protocol.c b/src/hardware/maynuo-m97/protocol.c index 92cf5b3e..05c3ae68 100644 --- a/src/hardware/maynuo-m97/protocol.c +++ b/src/hardware/maynuo-m97/protocol.c @@ -125,7 +125,7 @@ SR_PRIV const char *maynuo_m97_mode_to_str(enum maynuo_m97_mode mode) } -static void maynuo_m97_session_send_value(const struct sr_dev_inst *sdi, struct sr_channel *ch, float value, enum sr_mq mq, enum sr_unit unit) +static void maynuo_m97_session_send_value(const struct sr_dev_inst *sdi, struct sr_channel *ch, float value, enum sr_mq mq, enum sr_unit unit, int digits) { struct sr_datafeed_packet packet; struct sr_datafeed_analog analog; @@ -133,7 +133,7 @@ static void maynuo_m97_session_send_value(const struct sr_dev_inst *sdi, struct struct sr_analog_meaning meaning; struct sr_analog_spec spec; - sr_analog_init(&analog, &encoding, &meaning, &spec, 0); + sr_analog_init(&analog, &encoding, &meaning, &spec, digits); analog.meaning->channels = g_slist_append(NULL, ch); analog.num_samples = 1; analog.data = &value; @@ -185,10 +185,10 @@ SR_PRIV int maynuo_m97_receive_data(int fd, int revents, void *cb_data) maynuo_m97_session_send_value(sdi, sdi->channels->data, RBFL(registers + 0), - SR_MQ_VOLTAGE, SR_UNIT_VOLT); + SR_MQ_VOLTAGE, SR_UNIT_VOLT, 3); maynuo_m97_session_send_value(sdi, sdi->channels->next->data, RBFL(registers + 2), - SR_MQ_CURRENT, SR_UNIT_AMPERE); + SR_MQ_CURRENT, SR_UNIT_AMPERE, 4); packet.type = SR_DF_FRAME_END; sr_session_send(sdi, &packet);