arachnid-labs-re-load-pro: Setting correct current limit.

Use round() instead of just truncate the value.
This commit is contained in:
Frank Stettner 2017-11-20 13:48:53 +01:00 committed by Uwe Hermann
parent a217289951
commit 9edda1d25b
1 changed files with 2 additions and 1 deletions

View File

@ -18,6 +18,7 @@
*/ */
#include <config.h> #include <config.h>
#include <math.h>
#include <string.h> #include <string.h>
#include "protocol.h" #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). */ /* 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); sr_err("Setting current limit to %f A (%d mA).", current, ma);