X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fteleinfo%2Fprotocol.c;h=9cb9ca82f717f94806db7d4b6b3ee9e070a2496f;hb=c2fdcc25a47c4c8f25e3ea96ea36a674a151e839;hp=fbbc044d4b96f75b6daf57e8e760556d39efecdb;hpb=695dc859c15ba4190f5c1aa2e1a6e2dc6a6e5845;p=libsigrok.git diff --git a/src/hardware/teleinfo/protocol.c b/src/hardware/teleinfo/protocol.c index fbbc044d..9cb9ca82 100644 --- a/src/hardware/teleinfo/protocol.c +++ b/src/hardware/teleinfo/protocol.c @@ -93,7 +93,7 @@ static void teleinfo_handle_measurement(struct sr_dev_inst *sdi, } if (!strcmp(label, "ADCO")) { - devc->num_samples++; + sr_sw_limits_update_samples_read(&devc->sw_limits, 1); } else if (!strcmp(label, "BASE")) { teleinfo_send_value(sdi, "BASE", v, SR_MQ_POWER, SR_UNIT_WATT_HOUR); } else if (!strcmp(label, "HCHP")) { @@ -184,7 +184,6 @@ SR_PRIV int teleinfo_receive_data(int fd, int revents, void *cb_data) struct sr_serial_dev_inst *serial; const uint8_t *ptr, *next_ptr, *end_ptr; int len; - int64_t time; (void)fd; @@ -217,19 +216,8 @@ SR_PRIV int teleinfo_receive_data(int fd, int revents, void *cb_data) return FALSE; } - if (devc->limit_samples && devc->num_samples >= devc->limit_samples) { - sr_info("Requested number of samples reached."); + if (sr_sw_limits_check(&devc->sw_limits)) sdi->driver->dev_acquisition_stop(sdi); - return TRUE; - } - if (devc->limit_msec) { - time = (g_get_monotonic_time() - devc->start_time) / 1000; - if (time > (int64_t)devc->limit_msec) { - sr_info("Requested time limit reached."); - sdi->driver->dev_acquisition_stop(sdi); - return TRUE; - } - } return TRUE; }