X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fmic-985xx%2Fprotocol.c;h=af567ebd0987a993cebca585ee09d2ebe8025766;hb=fdf0744fa4b40adab32e8f10d84df784284c67cc;hp=151b7c837af7cbf8f021c5c900c0e2fea0848f62;hpb=695dc859c15ba4190f5c1aa2e1a6e2dc6a6e5845;p=libsigrok.git diff --git a/src/hardware/mic-985xx/protocol.c b/src/hardware/mic-985xx/protocol.c index 151b7c83..af567ebd 100644 --- a/src/hardware/mic-985xx/protocol.c +++ b/src/hardware/mic-985xx/protocol.c @@ -14,8 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * along with this program; if not, see . */ #include @@ -113,7 +112,7 @@ static int handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi, int idx) return SR_ERR; } - sr_analog_init(&analog, &encoding, &meaning, &spec, 3); + sr_analog_init(&analog, &encoding, &meaning, &spec, 1); /* Common values for both channels. */ packet.type = SR_DF_ANALOG; @@ -142,7 +141,7 @@ static int handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi, int idx) g_slist_free(l); } - devc->num_samples++; + sr_sw_limits_update_samples_read(&devc->limits, 1); return SR_OK; } @@ -186,7 +185,6 @@ static int receive_data(int fd, int revents, int idx, void *cb_data) { struct sr_dev_inst *sdi; struct dev_context *devc; - int64_t t; static gboolean first_time = TRUE; struct sr_serial_dev_inst *serial; @@ -211,20 +209,8 @@ static int receive_data(int fd, int revents, int idx, void *cb_data) } } - if (devc->limit_samples && devc->num_samples >= devc->limit_samples) { - sr_info("Requested number of samples reached."); - sdi->driver->dev_acquisition_stop(sdi); - return TRUE; - } - - if (devc->limit_msec) { - t = (g_get_monotonic_time() - devc->starttime) / 1000; - if (t > (int64_t)devc->limit_msec) { - sr_info("Requested time limit reached."); - sdi->driver->dev_acquisition_stop(sdi); - return TRUE; - } - } + if (sr_sw_limits_check(&devc->limits)) + sr_dev_acquisition_stop(sdi); return TRUE; }