Skip to content

Commit 0112c57

Browse files
committed
Fix constrain warning
1 parent 6e2f3c7 commit 0112c57

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ uint8_t SFE_MAX1704X::setThreshold(uint8_t percent)
480480
// It has an LSb weight of 1%, and can be programmed from 1% to 32%.
481481
// The value is (32 - ATHD)%, e.g.: 00000=32%, 00001=31%, 11111=1%.
482482
// Let's convert our percent to that first:
483-
percent = constrain(percent, 0, 32);
483+
percent = (uint8_t)constrain((float)percent, 0.0, 32.0);
484484
percent = 32 - percent;
485485

486486
// Read config reg, so we don't modify any other values:

0 commit comments

Comments
 (0)