From: Frank Stettner Date: Mon, 20 Nov 2017 12:48:53 +0000 (+0100) Subject: arachnid-labs-re-load-pro: Setting correct current limit. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=9edda1d25b3b076b9e221daf4bf200240cc4a315;p=libsigrok.git arachnid-labs-re-load-pro: Setting correct current limit. Use round() instead of just truncate the value. --- diff --git a/src/hardware/arachnid-labs-re-load-pro/protocol.c b/src/hardware/arachnid-labs-re-load-pro/protocol.c index 4a3a6fec..e704b16f 100644 --- a/src/hardware/arachnid-labs-re-load-pro/protocol.c +++ b/src/hardware/arachnid-labs-re-load-pro/protocol.c @@ -18,6 +18,7 @@ */ #include +#include #include #include "protocol.h" @@ -77,7 +78,7 @@ SR_PRIV int reloadpro_set_current_limit(const struct sr_dev_inst *sdi, } /* Hardware expects current in mA, integer (0..6000). */ - ma = (int)(current * 1000); + ma = (int)round(current * 1000); sr_err("Setting current limit to %f A (%d mA).", current, ma);