rigol-ds1xx2: Assorted parameter setting fixes.

This commit is contained in:
Martin Ling 2012-12-30 14:06:58 +01:00 committed by Uwe Hermann
parent e0b7d23ce8
commit 542843f76f
1 changed files with 8 additions and 8 deletions

View File

@ -295,15 +295,15 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
break; break;
case SR_HWCAP_TRIGGER_SLOPE: case SR_HWCAP_TRIGGER_SLOPE:
tmp_u64 = *(const int *)value; tmp_u64 = *(const int *)value;
rigol_ds1xx2_send_data(devc->fd, "TRIG:EDGE:%s\n", tmp_u64 ? "POS" : "NEG"); rigol_ds1xx2_send_data(devc->fd, ":TRIG:EDGE:%s\n", tmp_u64 ? "POS" : "NEG");
break; break;
case SR_HWCAP_HORIZ_TRIGGERPOS: case SR_HWCAP_HORIZ_TRIGGERPOS:
tmp_float = *(const float *)value; tmp_float = *(const float *)value;
rigol_ds1xx2_send_data(devc->fd, "TIM:OFFS %f\n", tmp_float); rigol_ds1xx2_send_data(devc->fd, ":TIM:OFFS %.9f\n", tmp_float);
break; break;
case SR_HWCAP_TIMEBASE: case SR_HWCAP_TIMEBASE:
tmp_rat = *(const struct sr_rational *)value; tmp_rat = *(const struct sr_rational *)value;
rigol_ds1xx2_send_data(devc->fd, "TIM:SCAL %f\n", (float) tmp_rat.p / tmp_rat.q); rigol_ds1xx2_send_data(devc->fd, ":TIM:SCAL %.9f\n", (float) tmp_rat.p / tmp_rat.q);
break; break;
case SR_HWCAP_TRIGGER_SOURCE: case SR_HWCAP_TRIGGER_SOURCE:
if (!strcmp(value, "CH1")) if (!strcmp(value, "CH1"))
@ -317,7 +317,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
else else
ret = SR_ERR_ARG; ret = SR_ERR_ARG;
break; break;
rigol_ds1xx2_send_data(devc->fd, "TRIG:SOUR %s\n", channel); rigol_ds1xx2_send_data(devc->fd, ":TRIG:SOUR %s\n", channel);
break; break;
case SR_HWCAP_VDIV: case SR_HWCAP_VDIV:
/* TODO: Not supporting vdiv per channel yet. */ /* TODO: Not supporting vdiv per channel yet. */
@ -327,7 +327,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
&& vdivs[i].q == tmp_rat.q) { && vdivs[i].q == tmp_rat.q) {
devc->scale = (float) tmp_rat.p / tmp_rat.q; devc->scale = (float) tmp_rat.p / tmp_rat.q;
for (j = 0; j < 2; j++) for (j = 0; j < 2; j++)
rigol_ds1xx2_send_data(devc->fd, "CHAN%d:SCAL %f\n", j, devc->scale); rigol_ds1xx2_send_data(devc->fd, ":CHAN%d:SCAL %.3f\n", j, devc->scale);
break; break;
} }
} }
@ -339,7 +339,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
for (i = 0; coupling[i]; i++) { for (i = 0; coupling[i]; i++) {
if (!strcmp(value, coupling[i])) { if (!strcmp(value, coupling[i])) {
for (j = 0; j < 2; j++) for (j = 0; j < 2; j++)
rigol_ds1xx2_send_data(devc->fd, "CHAN%d:COUP %s\n", j, coupling[i]); rigol_ds1xx2_send_data(devc->fd, ":CHAN%d:COUP %s\n", j, coupling[i]);
break; break;
} }
} }
@ -386,12 +386,12 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
len = read(devc->fd, buf, sizeof(buf)); len = read(devc->fd, buf, sizeof(buf));
buf[len] = 0; buf[len] = 0;
devc->scale = atof(buf); devc->scale = atof(buf);
sr_dbg("scale is %f", devc->scale); sr_dbg("scale is %.3f", devc->scale);
rigol_ds1xx2_send_data(devc->fd, ":CHAN1:OFFS?\n"); rigol_ds1xx2_send_data(devc->fd, ":CHAN1:OFFS?\n");
len = read(devc->fd, buf, sizeof(buf)); len = read(devc->fd, buf, sizeof(buf));
buf[len] = 0; buf[len] = 0;
devc->offset = atof(buf); devc->offset = atof(buf);
sr_dbg("offset is %f", devc->offset); sr_dbg("offset is %.6f", devc->offset);
rigol_ds1xx2_send_data(devc->fd, ":WAV:DATA?\n"); rigol_ds1xx2_send_data(devc->fd, ":WAV:DATA?\n");
return SR_OK; return SR_OK;