From: Alexandru Gagniuc Date: Sat, 9 Apr 2016 17:07:55 +0000 (-0700) Subject: hp-3457a: Do not retrigger new measurement after the last sample X-Git-Tag: libsigrok-0.5.0~494 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e2626373b73e7583a8a02454a6e0771a4f18be44;p=libsigrok.git hp-3457a: Do not retrigger new measurement after the last sample Due to a PEBKAC error, after the last sample was sent, a new measurement was triggered, but its value was never sent down the session bus. This is easily fixed by incrementing devc->num_samples right after a measurement is sent instead of when a measurement is retriggered. --- diff --git a/src/hardware/hp-3457a/protocol.c b/src/hardware/hp-3457a/protocol.c index 618a99cd..fca9e24b 100644 --- a/src/hardware/hp-3457a/protocol.c +++ b/src/hardware/hp-3457a/protocol.c @@ -315,8 +315,10 @@ SR_PRIV int hp_3457a_receive_data(int fd, int revents, void *cb_data) return FALSE; } - if (devc->acq_state == ACQ_GOT_MEASUREMENT) + if (devc->acq_state == ACQ_GOT_MEASUREMENT) { acq_send_measurement(sdi); + devc->num_samples++; + } if (devc->limit_samples && (devc->num_samples >= devc->limit_samples)) { sdi->driver->dev_acquisition_stop(sdi, cb_data); @@ -326,7 +328,6 @@ SR_PRIV int hp_3457a_receive_data(int fd, int revents, void *cb_data) /* Got more to go. */ if (devc->acq_state == ACQ_GOT_MEASUREMENT) { /* Retrigger */ - devc->num_samples++; retrigger_measurement(scpi, devc); }