scpi-pps: Disable beeper during session.
At least the Rigol DP800 series trigger the beeper when changing channels remotely. Which gets rather annoying when doing acquisition on three channels as fast as you can.
This commit is contained in:
parent
bf48ccebee
commit
ee2860ee11
|
@ -153,7 +153,9 @@ static int dev_clear(void)
|
||||||
|
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
|
struct dev_context *devc;
|
||||||
struct sr_scpi_dev_inst *scpi;
|
struct sr_scpi_dev_inst *scpi;
|
||||||
|
GVariant *beeper;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
@ -165,6 +167,15 @@ static int dev_open(struct sr_dev_inst *sdi)
|
||||||
sdi->status = SR_ST_ACTIVE;
|
sdi->status = SR_ST_ACTIVE;
|
||||||
|
|
||||||
scpi_cmd(sdi, SCPI_CMD_REMOTE);
|
scpi_cmd(sdi, SCPI_CMD_REMOTE);
|
||||||
|
devc = sdi->priv;
|
||||||
|
devc->beeper_was_set = FALSE;
|
||||||
|
if (scpi_cmd_resp(sdi, &beeper, G_VARIANT_TYPE_BOOLEAN, SCPI_CMD_BEEPER) == SR_OK) {
|
||||||
|
if (g_variant_get_boolean(beeper)) {
|
||||||
|
devc->beeper_was_set = TRUE;
|
||||||
|
scpi_cmd(sdi, SCPI_CMD_BEEPER_DISABLE);
|
||||||
|
}
|
||||||
|
g_variant_unref(beeper);
|
||||||
|
}
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
@ -172,12 +183,16 @@ static int dev_open(struct sr_dev_inst *sdi)
|
||||||
static int dev_close(struct sr_dev_inst *sdi)
|
static int dev_close(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct sr_scpi_dev_inst *scpi;
|
struct sr_scpi_dev_inst *scpi;
|
||||||
|
struct dev_context *devc;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
|
devc = sdi->priv;
|
||||||
scpi = sdi->conn;
|
scpi = sdi->conn;
|
||||||
if (scpi) {
|
if (scpi) {
|
||||||
|
if (devc->beeper_was_set)
|
||||||
|
scpi_cmd(sdi, SCPI_CMD_BEEPER_ENABLE);
|
||||||
scpi_cmd(sdi, SCPI_CMD_LOCAL);
|
scpi_cmd(sdi, SCPI_CMD_LOCAL);
|
||||||
sr_scpi_close(scpi);
|
sr_scpi_close(scpi);
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
|
|
|
@ -84,6 +84,9 @@ struct channel_group_spec rigol_dp800_cg[] = {
|
||||||
struct scpi_command rigol_dp800_cmd[] = {
|
struct scpi_command rigol_dp800_cmd[] = {
|
||||||
{ SCPI_CMD_REMOTE, "SYST:REMOTE" },
|
{ SCPI_CMD_REMOTE, "SYST:REMOTE" },
|
||||||
{ SCPI_CMD_LOCAL, "SYST:LOCAL" },
|
{ SCPI_CMD_LOCAL, "SYST:LOCAL" },
|
||||||
|
{ SCPI_CMD_BEEPER, "SYST:BEEP:STAT?" },
|
||||||
|
{ SCPI_CMD_BEEPER_ENABLE, "SYST:BEEP:STAT ON" },
|
||||||
|
{ SCPI_CMD_BEEPER_DISABLE, "SYST:BEEP:STAT OFF" },
|
||||||
{ SCPI_CMD_SELECT_CHANNEL, ":INST:NSEL %s" },
|
{ SCPI_CMD_SELECT_CHANNEL, ":INST:NSEL %s" },
|
||||||
{ SCPI_CMD_GET_MEAS_VOLTAGE, ":MEAS:VOLT?" },
|
{ SCPI_CMD_GET_MEAS_VOLTAGE, ":MEAS:VOLT?" },
|
||||||
{ SCPI_CMD_GET_MEAS_CURRENT, ":MEAS:CURR?" },
|
{ SCPI_CMD_GET_MEAS_CURRENT, ":MEAS:CURR?" },
|
||||||
|
|
|
@ -30,6 +30,9 @@
|
||||||
enum pps_scpi_cmds {
|
enum pps_scpi_cmds {
|
||||||
SCPI_CMD_REMOTE,
|
SCPI_CMD_REMOTE,
|
||||||
SCPI_CMD_LOCAL,
|
SCPI_CMD_LOCAL,
|
||||||
|
SCPI_CMD_BEEPER,
|
||||||
|
SCPI_CMD_BEEPER_ENABLE,
|
||||||
|
SCPI_CMD_BEEPER_DISABLE,
|
||||||
SCPI_CMD_SELECT_CHANNEL,
|
SCPI_CMD_SELECT_CHANNEL,
|
||||||
SCPI_CMD_GET_MEAS_VOLTAGE,
|
SCPI_CMD_GET_MEAS_VOLTAGE,
|
||||||
SCPI_CMD_GET_MEAS_CURRENT,
|
SCPI_CMD_GET_MEAS_CURRENT,
|
||||||
|
@ -138,6 +141,7 @@ struct dev_context {
|
||||||
void *cb_data;
|
void *cb_data;
|
||||||
|
|
||||||
/* Operational state */
|
/* Operational state */
|
||||||
|
gboolean beeper_was_set;
|
||||||
|
|
||||||
/* Temporary state across callbacks */
|
/* Temporary state across callbacks */
|
||||||
struct sr_channel *cur_channel;
|
struct sr_channel *cur_channel;
|
||||||
|
|
Loading…
Reference in New Issue