lsr/es51919: support channel selection (enable/disable P1/P2)
Upon reception of serial data from the ES51919 LCR chipset, the data for channels P1 and P2 was extracted from the packet, and unconditionally got sent to the sigrok session. Do check the channels' enabled state before submission. This fixes for serial-lcr what recently got reported for a Brymen DMM. Tested with $ sigrok-cli -d peaktech-2170:conn=/dev/ttyUSB0 --channels P2 and other --channels specifications.
This commit is contained in:
parent
12788e7e40
commit
503519b70a
|
@ -593,6 +593,7 @@ static void handle_packet(struct sr_dev_inst *sdi, const uint8_t *pkt)
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
float floatval;
|
float floatval;
|
||||||
gboolean frame;
|
gboolean frame;
|
||||||
|
struct sr_channel *channel;
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
|
@ -620,10 +621,11 @@ static void handle_packet(struct sr_dev_inst *sdi, const uint8_t *pkt)
|
||||||
analog.num_samples = 1;
|
analog.num_samples = 1;
|
||||||
analog.data = &floatval;
|
analog.data = &floatval;
|
||||||
|
|
||||||
analog.meaning->channels = g_slist_append(NULL, sdi->channels->data);
|
channel = sdi->channels->data;
|
||||||
|
analog.meaning->channels = g_slist_append(NULL, channel);
|
||||||
|
|
||||||
parse_measurement(pkt, &floatval, &analog, 0);
|
parse_measurement(pkt, &floatval, &analog, 0);
|
||||||
if (analog.meaning->mq != 0) {
|
if (analog.meaning->mq != 0 && channel->enabled) {
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
packet.type = SR_DF_FRAME_BEGIN;
|
packet.type = SR_DF_FRAME_BEGIN;
|
||||||
sr_session_send(sdi, &packet);
|
sr_session_send(sdi, &packet);
|
||||||
|
@ -637,10 +639,12 @@ static void handle_packet(struct sr_dev_inst *sdi, const uint8_t *pkt)
|
||||||
}
|
}
|
||||||
|
|
||||||
g_slist_free(analog.meaning->channels);
|
g_slist_free(analog.meaning->channels);
|
||||||
analog.meaning->channels = g_slist_append(NULL, sdi->channels->next->data);
|
|
||||||
|
channel = sdi->channels->next->data;
|
||||||
|
analog.meaning->channels = g_slist_append(NULL, channel);
|
||||||
|
|
||||||
parse_measurement(pkt, &floatval, &analog, 1);
|
parse_measurement(pkt, &floatval, &analog, 1);
|
||||||
if (analog.meaning->mq != 0) {
|
if (analog.meaning->mq != 0 && channel->enabled) {
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
packet.type = SR_DF_FRAME_BEGIN;
|
packet.type = SR_DF_FRAME_BEGIN;
|
||||||
sr_session_send(sdi, &packet);
|
sr_session_send(sdi, &packet);
|
||||||
|
|
Loading…
Reference in New Issue