siglent_sds_channel_start(): Use ternary operator to shorten code.

This commit is contained in:
Uwe Hermann 2018-02-21 21:36:58 +01:00
parent 55bece00aa
commit eb354840f0
1 changed files with 4 additions and 9 deletions

View File

@ -216,6 +216,7 @@ SR_PRIV int siglent_sds_channel_start(const struct sr_dev_inst *sdi)
{ {
struct dev_context *devc; struct dev_context *devc;
struct sr_channel *ch; struct sr_channel *ch;
const char *s;
if (!(devc = sdi->priv)) if (!(devc = sdi->priv))
return SR_ERR; return SR_ERR;
@ -227,15 +228,9 @@ SR_PRIV int siglent_sds_channel_start(const struct sr_dev_inst *sdi)
switch (devc->model->series->protocol) { switch (devc->model->series->protocol) {
case NON_SPO_MODEL: case NON_SPO_MODEL:
case SPO_MODEL: case SPO_MODEL:
if (ch->type == SR_CHANNEL_LOGIC) { s = (ch->type == SR_CHANNEL_LOGIC) ? "D%d:WF?" : "C%d:WF? ALL";
if (sr_scpi_send(sdi->conn, "D%d:WF?", if (sr_scpi_send(sdi->conn, s, ch->index + 1) != SR_OK)
ch->index + 1) != SR_OK) return SR_ERR;
return SR_ERR;
} else {
if (sr_scpi_send(sdi->conn, "C%d:WF? ALL",
ch->index + 1) != SR_OK)
return SR_ERR;
}
siglent_sds_set_wait_event(devc, WAIT_NONE); siglent_sds_set_wait_event(devc, WAIT_NONE);
break; break;
} }