X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fmotech-lps-30x%2Fprotocol.c;h=1a3c75dc591954cbd4a4dfeec3ad0b917063fabc;hb=8aafc5e64d60ef5e91992707a8f4dbce03e901a0;hp=03e9cdd54885a39ef5e1a4a84d6df7bc80b201c4;hpb=301090aa58844e78e7c4d45275a4b6c29b31c72a;p=libsigrok.git diff --git a/src/hardware/motech-lps-30x/protocol.c b/src/hardware/motech-lps-30x/protocol.c index 03e9cdd5..1a3c75dc 100644 --- a/src/hardware/motech-lps-30x/protocol.c +++ b/src/hardware/motech-lps-30x/protocol.c @@ -59,7 +59,7 @@ static void send_data(struct sr_dev_inst *sdi) analog.data[i] = devc->channel_status[i].output_current_last; /* Value always 0 for channel 3, if present! */ sr_session_send(sdi, &packet); - devc->num_samples++; + sr_sw_limits_update_samples_read(&devc->limits, 1); } /** Process a complete line (without CR/LF) in buf. */ @@ -140,7 +140,6 @@ SR_PRIV int motech_lps_30x_receive_data(int fd, int revents, void *cb_data) struct dev_context *devc; struct sr_serial_dev_inst *serial; int len; - gdouble elapsed_s; (void)fd; @@ -179,16 +178,9 @@ SR_PRIV int motech_lps_30x_receive_data(int fd, int revents, void *cb_data) } } - /* If number of samples or time limit reached, stop acquisition. */ - if (devc->limit_samples && (devc->num_samples >= devc->limit_samples)) + if (sr_sw_limits_check(&devc->limits)) sdi->driver->dev_acquisition_stop(sdi); - if (devc->limit_msec) { - elapsed_s = g_timer_elapsed(devc->elapsed_msec, NULL); - if ((elapsed_s * 1000) >= devc->limit_msec) - sdi->driver->dev_acquisition_stop(sdi); - } - /* Only request the next packet if required. */ if (!((sdi->status == SR_ST_ACTIVE) && (devc->acq_running))) return TRUE;