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:
Bert Vermeulen 2014-10-16 15:24:27 +02:00
parent bf48ccebee
commit ee2860ee11
3 changed files with 22 additions and 0 deletions

View File

@ -153,7 +153,9 @@ static int dev_clear(void)
static int dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
struct sr_scpi_dev_inst *scpi;
GVariant *beeper;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR;
@ -165,6 +167,15 @@ static int dev_open(struct sr_dev_inst *sdi)
sdi->status = SR_ST_ACTIVE;
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;
}
@ -172,12 +183,16 @@ static int dev_open(struct sr_dev_inst *sdi)
static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_scpi_dev_inst *scpi;
struct dev_context *devc;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
devc = sdi->priv;
scpi = sdi->conn;
if (scpi) {
if (devc->beeper_was_set)
scpi_cmd(sdi, SCPI_CMD_BEEPER_ENABLE);
scpi_cmd(sdi, SCPI_CMD_LOCAL);
sr_scpi_close(scpi);
sdi->status = SR_ST_INACTIVE;

View File

@ -84,6 +84,9 @@ struct channel_group_spec rigol_dp800_cg[] = {
struct scpi_command rigol_dp800_cmd[] = {
{ SCPI_CMD_REMOTE, "SYST:REMOTE" },
{ 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_GET_MEAS_VOLTAGE, ":MEAS:VOLT?" },
{ SCPI_CMD_GET_MEAS_CURRENT, ":MEAS:CURR?" },

View File

@ -30,6 +30,9 @@
enum pps_scpi_cmds {
SCPI_CMD_REMOTE,
SCPI_CMD_LOCAL,
SCPI_CMD_BEEPER,
SCPI_CMD_BEEPER_ENABLE,
SCPI_CMD_BEEPER_DISABLE,
SCPI_CMD_SELECT_CHANNEL,
SCPI_CMD_GET_MEAS_VOLTAGE,
SCPI_CMD_GET_MEAS_CURRENT,
@ -138,6 +141,7 @@ struct dev_context {
void *cb_data;
/* Operational state */
gboolean beeper_was_set;
/* Temporary state across callbacks */
struct sr_channel *cur_channel;