Skip to content

Commit ea5bdda

Browse files
Rob SingletonRob Singleton
authored andcommitted
Changed input current limit comparison values from double to float. Fixed 900 mA comparison.
1 parent fcd8e80 commit ea5bdda

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/BQ24195.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ float PMICClass::getInputVoltageLimit(void) {
331331
* Return : 0 on Error, 1 on Success
332332
*******************************************************************************/
333333
bool PMICClass::setInputCurrentLimit(float current) {
334-
335334
int DATA = readRegister(INPUT_SOURCE_REGISTER);
336335

337336
if (DATA == -1) {
@@ -341,25 +340,25 @@ bool PMICClass::setInputCurrentLimit(float current) {
341340
byte mask = DATA & 0xF8;
342341
byte current_val = CURRENT_LIM_100;
343342

344-
if (current > 0.015) {
343+
if (current > 0.015f) {
345344
current_val = CURRENT_LIM_150;
346345
}
347-
if (current >= 0.5) {
346+
if (current >= 0.500f) {
348347
current_val = CURRENT_LIM_500;
349348
}
350-
if (current >= CURRENT_LIM_900) {
349+
if (current >= 0.900f) {
351350
current_val = CURRENT_LIM_900;
352351
}
353-
if (current >= 1.2) {
352+
if (current >= 1.200f) {
354353
current_val = CURRENT_LIM_1200;
355354
}
356-
if (current >= 1.5) {
355+
if (current >= 1.500f) {
357356
current_val = CURRENT_LIM_1500;
358357
}
359-
if (current >= 2.0) {
358+
if (current >= 2.000f) {
360359
current_val = CURRENT_LIM_2000;
361360
}
362-
if (current >= 3.0) {
361+
if (current >= 3.000f) {
363362
current_val = CURRENT_LIM_3000;
364363
}
365364
return writeRegister(INPUT_SOURCE_REGISTER, (mask | current_val));

0 commit comments

Comments
 (0)