arachnid-labs-re-load-pro: Setting correct current limit.
Use round() instead of just truncate the value.
This commit is contained in:
parent
a217289951
commit
9edda1d25b
|
@ -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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue