From: Bert Vermeulen Date: Thu, 16 Oct 2014 13:24:27 +0000 (+0200) Subject: scpi-pps: Disable beeper during session. X-Git-Tag: libsigrok-0.4.0~852 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=ee2860ee110367d137559e0aaf91b2859e045968;p=libsigrok.git 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. --- diff --git a/src/hardware/scpi-pps/api.c b/src/hardware/scpi-pps/api.c index 8bb0ac0c..813bf7f3 100644 --- a/src/hardware/scpi-pps/api.c +++ b/src/hardware/scpi-pps/api.c @@ -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; diff --git a/src/hardware/scpi-pps/profiles.c b/src/hardware/scpi-pps/profiles.c index 06b63fdd..eea5666c 100644 --- a/src/hardware/scpi-pps/profiles.c +++ b/src/hardware/scpi-pps/profiles.c @@ -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?" }, diff --git a/src/hardware/scpi-pps/protocol.h b/src/hardware/scpi-pps/protocol.h index 93c4580c..8a810af7 100644 --- a/src/hardware/scpi-pps/protocol.h +++ b/src/hardware/scpi-pps/protocol.h @@ -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;