]> sigrok.org Git - libsigrok.git/commitdiff
hameg_hmo: Mostly fix dumping of current timebase
authorStefan Brüns <redacted>
Wed, 11 Jan 2017 23:29:03 +0000 (00:29 +0100)
committerUwe Hermann <redacted>
Sat, 21 Jan 2017 14:08:21 +0000 (15:08 +0100)
sr_period_string takes the frequency as its argument, i.e. the reciprocal
of the timebase. Obviously this will not work for frequencies less than
1Hz / timebases greater than 1 second, but at least is correct for all
other available timebases.

src/hardware/hameg-hmo/protocol.c

index b25165953dd31749f8aa89cb7d17064ffbbbc3a5..b0cdfe778573449bf7b71fbb1c1ebfaca6be4951 100644 (file)
@@ -364,8 +364,9 @@ static void scope_state_dump(const struct scope_config *config,
                        state->digital_pods[i] ? "On" : "Off");
        }
 
-       tmp = sr_period_string((*config->timebases)[state->timebase][0] *
-                              (*config->timebases)[state->timebase][1]);
+       /* FIXME: this is wrong for TB > 1 second */
+       tmp = sr_period_string((*config->timebases)[state->timebase][1] /
+                              (*config->timebases)[state->timebase][0]);
        sr_info("Current timebase: %s", tmp);
        g_free(tmp);