]> sigrok.org Git - libsigrok.git/commitdiff
rigol-ds: Use set_cfg wrapper for capture setup commands.
authorMartin Ling <redacted>
Fri, 27 Dec 2013 22:19:55 +0000 (23:19 +0100)
committerBert Vermeulen <redacted>
Sat, 28 Dec 2013 13:05:56 +0000 (14:05 +0100)
hardware/rigol-ds/api.c

index f18271e0804506ba07300daf892a6f5287e7e0ca..6ada6a4bb0a2d046e80b5b5e7d9b2d826a5eaa3d 100644 (file)
@@ -782,7 +782,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        struct dev_context *devc;
        struct sr_probe *probe;
        GSList *l;
-       char cmd[256];
 
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
@@ -799,9 +798,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
                                                devc->enabled_analog_probes, probe);
                        if (probe->enabled != devc->analog_channels[probe->index]) {
                                /* Enabled channel is currently disabled, or vice versa. */
-                               sprintf(cmd, ":CHAN%d:DISP %s", probe->index + 1,
-                                               probe->enabled ? "ON" : "OFF");
-                               if (sr_scpi_send(sdi->conn, cmd) != SR_OK)
+                               if (set_cfg(sdi, ":CHAN%d:DISP %s", probe->index + 1,
+                                               probe->enabled ? "ON" : "OFF") != SR_OK)
                                        return SR_ERR;
                        }
                } else if (probe->type == SR_PROBE_LOGIC) {
@@ -810,9 +808,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
                                                devc->enabled_digital_probes, probe);
                        if (probe->enabled != devc->digital_channels[probe->index]) {
                                /* Enabled channel is currently disabled, or vice versa. */
-                               sprintf(cmd, ":DIG%d:TURN %s", probe->index,
-                                               probe->enabled ? "ON" : "OFF");
-                               if (sr_scpi_send(sdi->conn, cmd) != SR_OK)
+                               if (set_cfg(sdi, ":DIG%d:TURN %s", probe->index,
+                                               probe->enabled ? "ON" : "OFF") != SR_OK)
                                        return SR_ERR;
                        }
                }
@@ -822,7 +819,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
                return SR_ERR;
 
        if (devc->data_source == DATA_SOURCE_LIVE) {
-               if (sr_scpi_send(sdi->conn, ":RUN") != SR_OK)
+               if (set_cfg(sdi, ":RUN") != SR_OK)
                        return SR_ERR;
        } else if (devc->data_source == DATA_SOURCE_MEMORY) {
                if (devc->model->series != RIGOL_DS2000) {
@@ -859,11 +856,11 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
                                /* Apparently for the DS2000 the memory
                                 * depth can only be set in Running state -
                                 * this matches the behaviour of the UI. */
-                               if (sr_scpi_send(sdi->conn, ":RUN") != SR_OK)
+                               if (set_cfg(sdi, ":RUN") != SR_OK)
                                        return SR_ERR;
-                               if (sr_scpi_send(sdi->conn, "ACQ:MDEP %d", devc->analog_frame_size) != SR_OK)
+                               if (set_cfg(sdi, "ACQ:MDEP %d", devc->analog_frame_size) != SR_OK)
                                        return SR_ERR;
-                               if (sr_scpi_send(sdi->conn, ":STOP") != SR_OK)
+                               if (set_cfg(sdi, ":STOP") != SR_OK)
                                        return SR_ERR;
                        } else
                                devc->analog_frame_size = DS2000_ANALOG_LIVE_WAVEFORM_SIZE;