rigol-ds: Enable/disable LA pod when (de)selecting digital channels.

This commit is contained in:
Martin Ling 2014-01-16 23:25:59 +00:00 committed by Uwe Hermann
parent 51b294cd01
commit 04e8e01ec6
3 changed files with 19 additions and 2 deletions

View 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;

View 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);

View 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];