scpi-dmm: Add support for Owon XDM2041
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>
Sun, 28 Feb 2021 13:34:40 +0000 (15:34 +0200)
committerGerhard Sittig <gerhard.sittig@gmx.net>
Sat, 6 Mar 2021 18:04:32 +0000 (19:04 +0100)
src/hardware/scpi-dmm/api.c
src/hardware/scpi-dmm/protocol.c

index c6753860b866a072443e9221acd04179bd48ebe9..7e4b4e5b4f73d4c74e98bda762bf7d25799aa47f 100644 (file)
@@ -104,6 +104,15 @@ static const struct scpi_command cmdset_gwinstek_906x[] = {
        ALL_ZERO,
 };
 
+static const struct scpi_command cmdset_owon[] = {
+       { DMM_CMD_SETUP_REMOTE, "SYST:REM", },
+       { DMM_CMD_SETUP_LOCAL, "SYST:LOC", },
+       { DMM_CMD_SETUP_FUNC, "CONF:%s", },
+       { DMM_CMD_QUERY_FUNC, "FUNC?", },
+       { DMM_CMD_QUERY_VALUE, "MEAS1?", },
+       ALL_ZERO,
+};
+
 static const struct mqopt_item mqopts_agilent_34405a[] = {
        { SR_MQ_VOLTAGE, SR_MQFLAG_DC, "VOLT:DC", "VOLT ", NO_DFLT_PREC, },
        { SR_MQ_VOLTAGE, SR_MQFLAG_AC, "VOLT:AC", "VOLT:AC ", NO_DFLT_PREC, },
@@ -162,6 +171,20 @@ static const struct mqopt_item mqopts_gwinstek_gdm906x[] = {
        { SR_MQ_CAPACITANCE, 0, "CAP", "CAP", NO_DFLT_PREC, },
 };
 
+static const struct mqopt_item mqopts_owon_xdm2041[] = {
+       { SR_MQ_VOLTAGE, SR_MQFLAG_AC, "VOLT:AC", "VOLT AC", NO_DFLT_PREC, },
+       { SR_MQ_VOLTAGE, SR_MQFLAG_DC, "VOLT:DC", "VOLT", NO_DFLT_PREC, },
+       { SR_MQ_CURRENT, SR_MQFLAG_AC, "CURR:AC", "CURR AC", NO_DFLT_PREC, },
+       { SR_MQ_CURRENT, SR_MQFLAG_DC, "CURR:DC", "CURR", NO_DFLT_PREC, },
+       { SR_MQ_RESISTANCE, 0, "RES", "RES", NO_DFLT_PREC, },
+       { SR_MQ_RESISTANCE, SR_MQFLAG_FOUR_WIRE, "FRES", "FRES", NO_DFLT_PREC, },
+       { SR_MQ_CONTINUITY, 0, "CONT", "CONT", -1, },
+       { SR_MQ_VOLTAGE, SR_MQFLAG_DC | SR_MQFLAG_DIODE, "DIOD", "DIOD", -4, },
+       { SR_MQ_TEMPERATURE, 0, "TEMP", "TEMP", NO_DFLT_PREC, },
+       { SR_MQ_FREQUENCY, 0, "FREQ", "FREQ", NO_DFLT_PREC, },
+       { SR_MQ_CAPACITANCE, 0, "CAP", "CAP", NO_DFLT_PREC, },
+};
+
 SR_PRIV const struct scpi_dmm_model models[] = {
        {
                "Agilent", "34405A",
@@ -220,6 +243,13 @@ SR_PRIV const struct scpi_dmm_model models[] = {
                ARRAY_AND_SIZE(devopts_generic),
                0, 0,
        },
+       {
+               "OWON", "XDM2041",
+               1, 5, cmdset_owon, ARRAY_AND_SIZE(mqopts_owon_xdm2041),
+               scpi_dmm_get_meas_gwinstek,
+               ARRAY_AND_SIZE(devopts_generic),
+               0, 1e9,
+       },
 };
 
 static const struct scpi_dmm_model *is_compatible(const char *vendor, const char *model)
index fe20441408fa39b1c43fbdd9ab82ce0676a39c26..884ba6dcca2a77a337fb96a58d27cbd33473debf 100644 (file)
@@ -116,6 +116,8 @@ SR_PRIV int scpi_dmm_get_mq(const struct sr_dev_inst *sdi,
                if (mqitem)
                        *mqitem = item;
                ret = SR_OK;
+       } else {
+               sr_warn("Unknown measurement quantity: %s", have);
        }
 
        if (rsp) {