]> sigrok.org Git - libsigrok.git/commitdiff
hp-3457a: Do not retrigger new measurement after the last sample
authorAlexandru Gagniuc <redacted>
Sat, 9 Apr 2016 17:07:55 +0000 (10:07 -0700)
committerUwe Hermann <redacted>
Sat, 23 Apr 2016 15:44:26 +0000 (17:44 +0200)
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.

src/hardware/hp-3457a/protocol.c

index 618a99cd4cc324379310b8a8818bf450ccb0de90..fca9e24b1faff20f91b0c2b0513af424ca744c68 100644 (file)
@@ -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);
        }