]> sigrok.org Git - libsigrok.git/commitdiff
serial-dmm: count analog DMM channels starting at 1
authorGerhard Sittig <redacted>
Sun, 30 Sep 2018 02:36:39 +0000 (04:36 +0200)
committerUwe Hermann <redacted>
Tue, 2 Oct 2018 17:01:25 +0000 (19:01 +0200)
Commit 556a926d432dd introduced support for multiple displays in
subdrivers of serial-dmm, but also changed user visible channel numbers
to start from 0. Restore the previous behaviour, start counting from 1
which users may perceive as more natural (serial-dmm used to start at P1
in the past, scopes start with CH1 as well).

src/hardware/serial-dmm/api.c

index 040531815cc79f60f374fc2563a8defaf0679560..88e3b88aef6b8974208a473313b558d8cc5b53e5 100644 (file)
@@ -137,7 +137,9 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        if (dmm->packet_parse == sr_metex14_4packets_parse)
                dmm->channel_count = 4;
        for (ch_idx = 0; ch_idx < dmm->channel_count; ch_idx++) {
-               snprintf(ch_name, sizeof(ch_name), "P%zu", ch_idx);
+               size_t ch_num;
+               ch_num = ch_idx + 1;
+               snprintf(ch_name, sizeof(ch_name), "P%zu", ch_num);
                sr_channel_new(sdi, ch_idx, SR_CHANNEL_ANALOG, TRUE, ch_name);
        }
        devices = g_slist_append(devices, sdi);