scpi-dmm: Add infinity limit to model-specific config.
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>
Sun, 28 Feb 2021 13:28:55 +0000 (15:28 +0200)
committerGerhard Sittig <gerhard.sittig@gmx.net>
Sat, 6 Mar 2021 18:04:14 +0000 (19:04 +0100)
Owon multimeters seem otherwise compatible with gwinstek reader,
except infinity is only 1e9.

src/hardware/scpi-dmm/api.c
src/hardware/scpi-dmm/protocol.c
src/hardware/scpi-dmm/protocol.h

index 7867ebc2acd48b336e47a6efd9c591a7ec607550..456c24dbf9ea93e13668efa56b482f642057185a 100644 (file)
@@ -168,42 +168,42 @@ SR_PRIV const struct scpi_dmm_model models[] = {
                1, 5, cmdset_agilent, ARRAY_AND_SIZE(mqopts_agilent_34405a),
                scpi_dmm_get_meas_agilent,
                ARRAY_AND_SIZE(devopts_generic),
-               0,
+               0, 0,
        },
        {
                "Agilent", "34410A",
                1, 6, cmdset_hp, ARRAY_AND_SIZE(mqopts_agilent_34405a),
                scpi_dmm_get_meas_agilent,
                ARRAY_AND_SIZE(devopts_generic),
-               0,
+               0, 0,
        },
        {
                "GW", "GDM8251A",
                1, 6, cmdset_gwinstek, ARRAY_AND_SIZE(mqopts_gwinstek_gdm8200a),
                scpi_dmm_get_meas_gwinstek,
                ARRAY_AND_SIZE(devopts_generic),
-               1000 * 2500,
+               1000 * 2500, 0,
        },
        {
                "GW", "GDM8255A",
                1, 6, cmdset_gwinstek, ARRAY_AND_SIZE(mqopts_gwinstek_gdm8200a),
                scpi_dmm_get_meas_gwinstek,
                ARRAY_AND_SIZE(devopts_generic),
-               1000 * 2500,
+               1000 * 2500, 0,
        },
        {
                "GWInstek", "GDM9060",
                1, 6, cmdset_gwinstek_906x, ARRAY_AND_SIZE(mqopts_gwinstek_gdm906x),
                scpi_dmm_get_meas_agilent,
                ARRAY_AND_SIZE(devopts_generic),
-               0,
+               0, 0,
        },
        {
                "GWInstek", "GDM9061",
                1, 6, cmdset_gwinstek_906x, ARRAY_AND_SIZE(mqopts_gwinstek_gdm906x),
                scpi_dmm_get_meas_agilent,
                ARRAY_AND_SIZE(devopts_generic),
-               0,
+               0, 0,
        },
        {
                "HP", "34401A",
@@ -211,14 +211,14 @@ SR_PRIV const struct scpi_dmm_model models[] = {
                scpi_dmm_get_meas_agilent,
                ARRAY_AND_SIZE(devopts_generic),
                /* 34401A: typ. 1020ms for AC readings (default is 1000ms). */
-               1000 * 1500,
+               1000 * 1500, 0,
        },
        {
                "Keysight", "34465A",
                1, 5, cmdset_agilent, ARRAY_AND_SIZE(mqopts_agilent_34405a),
                scpi_dmm_get_meas_agilent,
                ARRAY_AND_SIZE(devopts_generic),
-               0,
+               0, 0,
        },
 };
 
index f9aea2a4612287c871f87543439d4fe23123df44..bc739400cb38240e101573f58fa0d064f725715a 100644 (file)
@@ -459,9 +459,11 @@ SR_PRIV int scpi_dmm_get_meas_gwinstek(const struct sr_dev_inst *sdi, size_t ch)
        if (!response)
                return SR_ERR;
        limit = 9e37;
-       if (info->d_value > +limit) {
+       if (devc->model->infinity_limit != 0.0)
+               limit = devc->model->infinity_limit;
+       if (info->d_value >= +limit) {
                info->d_value = +INFINITY;
-       } else if (info->d_value < -limit) {
+       } else if (info->d_value <= -limit) {
                info->d_value = -INFINITY;
        } else {
                p = response;
index fe6138d4c1de3e3b63a023ffb86997565dc41aa4..5261168f3edba1daea4f4dd8a25e862bf1c7f230 100644 (file)
@@ -64,6 +64,7 @@ struct scpi_dmm_model {
        const uint32_t *devopts;
        size_t devopts_size;
        unsigned int read_timeout_us; /* If zero, use default from src/scpi/scpi.c. */
+       float infinity_limit; /* If zero, use default from protocol.c */
 };
 
 struct dev_context {