From: Aurelien Jacobs Date: Sat, 11 Jun 2016 23:46:52 +0000 (+0200) Subject: agilent-dmm: add support for AC/DC flags in current mode X-Git-Tag: libsigrok-0.5.0~292 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=0fe18626bd525e19e674361fa52394155c6fbdcc;p=libsigrok.git agilent-dmm: add support for AC/DC flags in current mode --- diff --git a/src/hardware/agilent-dmm/sched.c b/src/hardware/agilent-dmm/sched.c index e361f13b..de9ab584 100644 --- a/src/hardware/agilent-dmm/sched.c +++ b/src/hardware/agilent-dmm/sched.c @@ -459,11 +459,22 @@ static int recv_conf_u124x_5x(const struct sr_dev_inst *sdi, GMatchInfo *match) } } else devc->cur_mqflags |= SR_MQFLAG_DC; - } else if (!strcmp(mstr, "CURR")) { + } else if (!strncmp(mstr, "CURR", 4)) { devc->cur_mq = SR_MQ_CURRENT; devc->cur_unit = SR_UNIT_AMPERE; devc->cur_mqflags = 0; devc->cur_exponent = 0; + if (mstr[4] == ':') { + if (!strncmp(mstr + 5, "ACDC", 4)) { + /* AC + DC offset */ + devc->cur_mqflags |= SR_MQFLAG_AC | SR_MQFLAG_DC | SR_MQFLAG_RMS; + } else if (!strncmp(mstr + 5, "AC", 2)) { + devc->cur_mqflags |= SR_MQFLAG_AC | SR_MQFLAG_RMS; + } else if (!strncmp(mstr + 5, "DC", 2)) { + devc->cur_mqflags |= SR_MQFLAG_DC; + } + } else + devc->cur_mqflags |= SR_MQFLAG_DC; } else if (!strcmp(mstr, "RES")) { devc->cur_mq = SR_MQ_RESISTANCE; devc->cur_unit = SR_UNIT_OHM; @@ -561,6 +572,7 @@ SR_PRIV const struct agdmm_recv agdmm_recvs_u124x[] = { { "^([-+][0-9]\\.[0-9]{8}E[-+][0-9]{2})$", recv_fetc }, { "^\"(VOLT|CURR|RES|CAP|FREQ) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, { "^\"(VOLT:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, + { "^\"(CURR:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, { "^\"(CPER:[40]-20mA) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, { "^\"(T[0-9]:[A-Z]+) ([A-Z]+)\"$", recv_conf_u124x_5x }, { "^\"(DIOD)\"$", recv_conf_u124x_5x }, @@ -573,6 +585,7 @@ SR_PRIV const struct agdmm_recv agdmm_recvs_u125x[] = { { "^([-+][0-9]\\.[0-9]{8}E[-+][0-9]{2})$", recv_fetc }, { "^\"(VOLT|CURR|RES|CAP|FREQ) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, { "^\"(VOLT:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, + { "^\"(CURR:[ACD]+) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, { "^\"(CPER:[40]-20mA) ([-+][0-9\\.E\\-+]+),([-+][0-9]\\.[0-9]{8}E([-+][0-9]{2}))\"$", recv_conf_u124x_5x }, { "^\"(T[0-9]:[A-Z]+) ([A-Z]+)\"$", recv_conf_u124x_5x }, { "^\"(DIOD)\"$", recv_conf_u124x_5x },