]> sigrok.org Git - libsigrok.git/commitdiff
hameg-hmo: Use 1-based (not 0-based) POD numbers.
authorGuido Trentalancia <redacted>
Fri, 16 Nov 2018 20:51:49 +0000 (21:51 +0100)
committerUwe Hermann <redacted>
Thu, 25 Jul 2019 22:11:07 +0000 (00:11 +0200)
The current starting index for the POD name is currently wrong as it is zero.

The official POD numbering starts instead at 1 (see device panel, buttons
and manual), so the current index used for message printing and groups
naming in the driver needs to be incremented by one.

src/hardware/hameg-hmo/protocol.c

index 9d0604f36d3a100dbed851ce70df2122002e1c44..4341bdfc6ee1e9a13bc517c5545c58b109fa8cac 100644 (file)
@@ -404,11 +404,11 @@ static void scope_state_dump(const struct scope_config *config,
 
        for (i = 0; i < config->digital_pods; i++) {
                if (strncmp("USER", (*config->logic_threshold)[state->digital_pods[i].threshold], 4))
-                       sr_info("State of digital POD %d -> %s : %s (threshold)", i,
+                       sr_info("State of digital POD %d -> %s : %s (threshold)", i + 1,
                                state->digital_pods[i].state ? "On" : "Off",
                                (*config->logic_threshold)[state->digital_pods[i].threshold]);
                else // user-defined or custom logic threshold
-                       sr_info("State of digital POD %d -> %s : %E (threshold)", i,
+                       sr_info("State of digital POD %d -> %s : %E (threshold)", i + 1,
                                state->digital_pods[i].state ? "On" : "Off",
                                state->digital_pods[i].user_threshold);
        }
@@ -882,7 +882,7 @@ SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi)
                        ret = SR_ERR_MALLOC;
                        break;
                }
-               devc->digital_groups[i]->name = g_strdup_printf("POD%d", i);
+               devc->digital_groups[i]->name = g_strdup_printf("POD%d", i + 1);
                sdi->channel_groups = g_slist_append(sdi->channel_groups,
                                   devc->digital_groups[i]);
        }