From: Gerhard Sittig Date: Sun, 23 Jan 2022 16:49:33 +0000 (+0100) Subject: std: epsilon for std_gvar_min_max_step_thresholds() upper limit X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e59c58514d7f11d0c64e84bd2da19cc4803d6e64;p=libsigrok.git std: epsilon for std_gvar_min_max_step_thresholds() upper limit Adjust the std_gvar_min_max_step_thresholds() routine which iterates over a range of threshold voltages that are specified by their lower and upper bounds and a step (stride). Allow for an epsilon in the loop's end condition to span the full driver's announced set of values and not stop prematurely. The issue was observed with Kingst LA2016 which announces a range from 0.4V to 4.0V in steps of 0.1V, while the config list ends at the 3.9V value and would have omitted the 4.0V upper bound. --- diff --git a/src/std.c b/src/std.c index 81f269fa..2c4546d6 100644 --- a/src/std.c +++ b/src/std.c @@ -687,7 +687,7 @@ SR_PRIV GVariant *std_gvar_min_max_step_thresholds(const double min, const doubl g_variant_builder_init(&gvb, G_VARIANT_TYPE_ARRAY); - for (d = min; d <= max; d += step) { + for (d = min; d <= max + step / 2.0; d += step) { /* * We will never see exactly 0.0 because of the error we're * accumulating, so catch the "zero" value and force it to be 0.