From: Petteri Aimonen Date: Sun, 28 Feb 2021 13:28:55 +0000 (+0200) Subject: scpi-dmm: Add infinity limit to model-specific config. X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=33306b13acdc34fb50b35a56d362f1ab56fc0afd scpi-dmm: Add infinity limit to model-specific config. Owon multimeters seem otherwise compatible with gwinstek reader, except infinity is only 1e9. --- diff --git a/src/hardware/scpi-dmm/api.c b/src/hardware/scpi-dmm/api.c index 7867ebc2..456c24db 100644 --- a/src/hardware/scpi-dmm/api.c +++ b/src/hardware/scpi-dmm/api.c @@ -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, }, }; diff --git a/src/hardware/scpi-dmm/protocol.c b/src/hardware/scpi-dmm/protocol.c index f9aea2a4..bc739400 100644 --- a/src/hardware/scpi-dmm/protocol.c +++ b/src/hardware/scpi-dmm/protocol.c @@ -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; diff --git a/src/hardware/scpi-dmm/protocol.h b/src/hardware/scpi-dmm/protocol.h index fe6138d4..5261168f 100644 --- a/src/hardware/scpi-dmm/protocol.h +++ b/src/hardware/scpi-dmm/protocol.h @@ -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 {