From: Aurelien Jacobs Date: Sat, 14 Feb 2015 22:48:36 +0000 (+0100) Subject: rigol-ds: fix search for the closest vdiv. X-Git-Tag: libsigrok-0.4.0~639 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=c33ff3771bcbab940ee7da88c89e70b61c26d0d3;p=libsigrok.git rigol-ds: fix search for the closest vdiv. We try to find the smallest diff by comparing each diff with the previously known smallest diff, so initially, this smallest diff should be INFINITY so that we are sure to find a smaller one. This fixes the following exception: sr: rigol-ds: Negative vdiv index: -1. Caught exception: not applicable --- diff --git a/src/hardware/rigol-ds/api.c b/src/hardware/rigol-ds/api.c index 257bd11e..c25f9ef5 100644 --- a/src/hardware/rigol-ds/api.c +++ b/src/hardware/rigol-ds/api.c @@ -502,7 +502,7 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s const char *tmp_str; uint64_t samplerate; int analog_channel = -1; - float smallest_diff = 0.0000000001; + float smallest_diff = INFINITY; int idx = -1; unsigned i;