X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fhameg-hmo%2Fprotocol.c;h=1306338200699532af3a7e5eda3686b75322f730;hb=3782e57129fa661a773be337c9f548708f593eb0;hp=0c4d57f3f6cf465ba34ff17b590a2924192e944c;hpb=612336970dcf03c07a826e90cc562bb506edd029;p=libsigrok.git diff --git a/src/hardware/hameg-hmo/protocol.c b/src/hardware/hameg-hmo/protocol.c index 0c4d57f3..13063382 100644 --- a/src/hardware/hameg-hmo/protocol.c +++ b/src/hardware/hameg-hmo/protocol.c @@ -495,8 +495,21 @@ SR_PRIV int hmo_update_sample_rate(const struct sr_dev_inst *sdi) channel_found = FALSE; for (i = 0; i < config->analog_channels; i++) { - if (state->analog_channels[i].state) { - g_snprintf(chan_name, sizeof(chan_name), "CHAN%d", i + 1); + if (!state->analog_channels[i].state) + continue; + g_snprintf(chan_name, sizeof(chan_name), "CHAN%d", i + 1); + g_snprintf(tmp_str, sizeof(tmp_str), + (*config->scpi_dialect)[SCPI_CMD_GET_SAMPLE_RATE_LIVE], + chan_name); + channel_found = TRUE; + break; + } + + if (!channel_found) { + for (i = 0; i < config->digital_pods; i++) { + if (!state->digital_pods[i]) + continue; + g_snprintf(chan_name, sizeof(chan_name), "POD%d", i); g_snprintf(tmp_str, sizeof(tmp_str), (*config->scpi_dialect)[SCPI_CMD_GET_SAMPLE_RATE_LIVE], chan_name); @@ -505,19 +518,6 @@ SR_PRIV int hmo_update_sample_rate(const struct sr_dev_inst *sdi) } } - if (!channel_found) { - for (i = 0; i < config->digital_pods; i++) { - if (state->digital_pods[i]) { - g_snprintf(chan_name, sizeof(chan_name), "POD%d", i); - g_snprintf(tmp_str, sizeof(tmp_str), - (*config->scpi_dialect)[SCPI_CMD_GET_SAMPLE_RATE_LIVE], - chan_name); - channel_found = TRUE; - break; - } - } - } - /* No channel is active, ask the instrument for the sample rate * in single shot mode */ if (!channel_found) {