]> sigrok.org Git - libsigrok.git/commitdiff
rigol-ds: Enable/disable LA pod when (de)selecting digital channels.
authorMartin Ling <redacted>
Thu, 16 Jan 2014 23:25:59 +0000 (23:25 +0000)
committerUwe Hermann <redacted>
Fri, 17 Jan 2014 00:52:29 +0000 (01:52 +0100)
hardware/rigol-ds/api.c
hardware/rigol-ds/protocol.c
hardware/rigol-ds/protocol.h

index 2089865aa194cae679bb036a6243eae05355015d..7f21c8886067c8c63b5579578a2410add1f8c532 100644 (file)
@@ -823,9 +823,16 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
                                        return SR_ERR;
                        }
                } else if (probe->type == SR_PROBE_LOGIC) {
-                       if (probe->enabled)
+                       if (probe->enabled) {
                                devc->enabled_digital_probes = g_slist_append(
                                                devc->enabled_digital_probes, probe);
+                               /* Turn on LA module if currently off. */
+                               if (!devc->la_enabled) {
+                                       if (set_cfg(sdi, ":LA:DISP ON") != SR_OK)
+                                               return SR_ERR;
+                                       devc->la_enabled = TRUE;
+                               }
+                       }
                        if (probe->enabled != devc->digital_channels[probe->index]) {
                                /* Enabled channel is currently disabled, or vice versa. */
                                if (set_cfg(sdi, ":DIG%d:TURN %s", probe->index,
@@ -838,6 +845,11 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        if (!devc->enabled_analog_probes && !devc->enabled_digital_probes)
                return SR_ERR;
 
+       /* Turn off LA module if on and no digital probes selected. */
+       if (devc->la_enabled && !devc->enabled_digital_probes)
+               if (set_cfg(sdi, ":LA:DISP OFF") != SR_OK)
+                       return SR_ERR;
+
        if (devc->data_source == DATA_SOURCE_LIVE) {
                if (set_cfg(sdi, ":RUN") != SR_OK)
                        return SR_ERR;
index 69bb151ee2169e381e133845c2d2d9b24a4043a9..55d437b468806c509487f73b7d620417f5fa8ab6 100644 (file)
@@ -697,7 +697,11 @@ SR_PRIV int rigol_ds_get_dev_cfg(const struct sr_dev_inst *sdi)
 
        /* Digital channel state. */
        if (devc->model->has_digital) {
-               sr_dbg("Current digital channel state:");
+               if (get_cfg_string(sdi, ":LA:DISP?", &t_s) != SR_OK)
+                       return SR_ERR;
+               devc->la_enabled = !strcmp(t_s, "ON") ? TRUE : FALSE;
+               sr_dbg("Logic analyzer %s, current digital channel state:",
+                               devc->la_enabled ? "enabled" : "disabled");
                for (i = 0; i < 16; i++) {
                        cmd = g_strdup_printf(":DIG%d:TURN?", i);
                        res = get_cfg_string(sdi, cmd, &t_s);
index f0bf04f2e36723c72bac7d4b5dbfad0c991d483a..e19ac490358d8151baa0d64c25c6e538bd6afa0e 100644 (file)
@@ -111,6 +111,7 @@ struct dev_context {
        /* Device settings */
        gboolean analog_channels[MAX_ANALOG_PROBES];
        gboolean digital_channels[MAX_DIGITAL_PROBES];
+       gboolean la_enabled;
        float timebase;
        float vdiv[MAX_ANALOG_PROBES];
        int vert_reference[MAX_ANALOG_PROBES];