]> sigrok.org Git - libsigrok.git/commitdiff
hp-3478a: Check for overflow.
authorFrank Stettner <redacted>
Tue, 17 Dec 2019 18:55:28 +0000 (19:55 +0100)
committerUwe Hermann <redacted>
Fri, 20 Dec 2019 22:08:51 +0000 (23:08 +0100)
src/hardware/hp-3478a/protocol.c

index 74acd144b0f1c77e0bf2de0a06f80fc4993dbb0a..7842f2f4e25992ca81a9d72e2f6d63a783274256 100644 (file)
@@ -497,6 +497,10 @@ SR_PRIV int hp_3478a_receive_data(int fd, int revents, void *cb_data)
        if (sr_scpi_get_double(scpi, NULL, &devc->measurement) != SR_OK)
                return FALSE;
 
+       /* Check for overflow. */
+       if (devc->measurement >= 9.998e+9)
+               devc->measurement = INFINITY;
+
        /*
         * This is necessary to get the actual range for the encoding digits.
         * Must be called after reading the value, because it resets the