scpi-dmm: run OPC queries immediately before essential commands
The current implementation of the SCPI DMM driver is conservative about checking the device's being operational, but the *OPC? queries are found in unfortunate locations. Run the OPC query right before running the next "actual" command, not afterwards. And certainly not between sending requests and potentially gathering responses in subsequent calls. This commit does not change current behaviour, but improves maintenance before pending commits.
This commit is contained in:
parent
08f3b427b6
commit
2887799404
|
@ -101,8 +101,8 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
|
||||||
size_t i;
|
size_t i;
|
||||||
gchar *channel_name;
|
gchar *channel_name;
|
||||||
|
|
||||||
ret = sr_scpi_get_hw_id(scpi, &hw_info);
|
|
||||||
scpi_dmm_cmd_delay(scpi);
|
scpi_dmm_cmd_delay(scpi);
|
||||||
|
ret = sr_scpi_get_hw_id(scpi, &hw_info);
|
||||||
if (ret != SR_OK) {
|
if (ret != SR_OK) {
|
||||||
sr_info("Could not get IDN response.");
|
sr_info("Could not get IDN response.");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -289,8 +289,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
command = sr_scpi_cmd_get(devc->cmdset, DMM_CMD_START_ACQ);
|
command = sr_scpi_cmd_get(devc->cmdset, DMM_CMD_START_ACQ);
|
||||||
if (command && *command) {
|
if (command && *command) {
|
||||||
ret = sr_scpi_send(scpi, command);
|
|
||||||
scpi_dmm_cmd_delay(scpi);
|
scpi_dmm_cmd_delay(scpi);
|
||||||
|
ret = sr_scpi_send(scpi, command);
|
||||||
if (ret != SR_OK)
|
if (ret != SR_OK)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -319,8 +319,8 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
command = sr_scpi_cmd_get(devc->cmdset, DMM_CMD_STOP_ACQ);
|
command = sr_scpi_cmd_get(devc->cmdset, DMM_CMD_STOP_ACQ);
|
||||||
if (command && *command) {
|
if (command && *command) {
|
||||||
(void)sr_scpi_send(scpi, command);
|
|
||||||
scpi_dmm_cmd_delay(scpi);
|
scpi_dmm_cmd_delay(scpi);
|
||||||
|
(void)sr_scpi_send(scpi, command);
|
||||||
}
|
}
|
||||||
sr_scpi_source_remove(sdi->session, scpi);
|
sr_scpi_source_remove(sdi->session, scpi);
|
||||||
|
|
||||||
|
|
|
@ -90,12 +90,12 @@ SR_PRIV int scpi_dmm_get_mq(const struct sr_dev_inst *sdi,
|
||||||
if (mqitem)
|
if (mqitem)
|
||||||
*mqitem = NULL;
|
*mqitem = NULL;
|
||||||
|
|
||||||
|
scpi_dmm_cmd_delay(sdi->conn);
|
||||||
command = sr_scpi_cmd_get(devc->cmdset, DMM_CMD_QUERY_FUNC);
|
command = sr_scpi_cmd_get(devc->cmdset, DMM_CMD_QUERY_FUNC);
|
||||||
if (!command || !*command)
|
if (!command || !*command)
|
||||||
return SR_ERR_NA;
|
return SR_ERR_NA;
|
||||||
response = NULL;
|
response = NULL;
|
||||||
ret = sr_scpi_get_string(sdi->conn, command, &response);
|
ret = sr_scpi_get_string(sdi->conn, command, &response);
|
||||||
scpi_dmm_cmd_delay(sdi->conn);
|
|
||||||
if (ret != SR_OK)
|
if (ret != SR_OK)
|
||||||
return ret;
|
return ret;
|
||||||
if (!response || !*response)
|
if (!response || !*response)
|
||||||
|
@ -140,10 +140,12 @@ SR_PRIV int scpi_dmm_set_mq(const struct sr_dev_inst *sdi,
|
||||||
|
|
||||||
mode = item->scpi_func_setup;
|
mode = item->scpi_func_setup;
|
||||||
command = sr_scpi_cmd_get(devc->cmdset, DMM_CMD_SETUP_FUNC);
|
command = sr_scpi_cmd_get(devc->cmdset, DMM_CMD_SETUP_FUNC);
|
||||||
ret = sr_scpi_send(sdi->conn, command, mode);
|
|
||||||
scpi_dmm_cmd_delay(sdi->conn);
|
scpi_dmm_cmd_delay(sdi->conn);
|
||||||
|
ret = sr_scpi_send(sdi->conn, command, mode);
|
||||||
|
if (ret != SR_OK)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int scpi_dmm_get_meas_agilent(const struct sr_dev_inst *sdi, size_t ch)
|
SR_PRIV int scpi_dmm_get_meas_agilent(const struct sr_dev_inst *sdi, size_t ch)
|
||||||
|
@ -267,8 +269,8 @@ SR_PRIV int scpi_dmm_get_meas_agilent(const struct sr_dev_inst *sdi, size_t ch)
|
||||||
command = sr_scpi_cmd_get(devc->cmdset, DMM_CMD_QUERY_VALUE);
|
command = sr_scpi_cmd_get(devc->cmdset, DMM_CMD_QUERY_VALUE);
|
||||||
if (!command || !*command)
|
if (!command || !*command)
|
||||||
return SR_ERR_NA;
|
return SR_ERR_NA;
|
||||||
ret = sr_scpi_get_string(scpi, command, &response);
|
|
||||||
scpi_dmm_cmd_delay(scpi);
|
scpi_dmm_cmd_delay(scpi);
|
||||||
|
ret = sr_scpi_get_string(scpi, command, &response);
|
||||||
if (ret != SR_OK)
|
if (ret != SR_OK)
|
||||||
return ret;
|
return ret;
|
||||||
g_strstrip(response);
|
g_strstrip(response);
|
||||||
|
|
Loading…
Reference in New Issue