]> sigrok.org Git - libsigrok.git/commitdiff
scpi-pps: Disable beeper during session.
authorBert Vermeulen <redacted>
Thu, 16 Oct 2014 13:24:27 +0000 (15:24 +0200)
committerBert Vermeulen <redacted>
Thu, 16 Oct 2014 13:24:27 +0000 (15:24 +0200)
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.

src/hardware/scpi-pps/api.c
src/hardware/scpi-pps/profiles.c
src/hardware/scpi-pps/protocol.h

index 8bb0ac0ce4450bc70ab45a84f74d064674cfee83..813bf7f375aeeffefdc044a4220696430e1fe4f0 100644 (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;
index 06b63fdd1141720bfc7b0bd099a7c45e42a2fb15..eea5666c555c1442693911daae6c09be3eadf9bd 100644 (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?" },
index 93c4580c559dce4fbbc16b73dcb89fd8d8fceca3..8a810af7f32ce67aaf362794b881cf2e35e77cf6 100644 (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;