serial-dmm: count analog DMM channels starting at 1

Commit 556a926d43 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).
This commit is contained in:
Gerhard Sittig 2018-09-30 04:36:39 +02:00 committed by Uwe Hermann
parent 3ef305b079
commit 48e2992f86
1 changed files with 3 additions and 1 deletions

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