Skip to content

Commit 8f37b54

Browse files
committed
Fix bug in startup battery check
The battery gauge was being checked before it was marked as online. Dummy values were returned, causing the low battery check to inaccurately pass. This would lead to very low voltage units into a rolling reset if voltage was too low.
1 parent 20f3b78 commit 8f37b54

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Firmware/RTK_Surveyor/Begin.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,8 @@ void beginFuelGauge()
544544
return;
545545
}
546546

547+
online.battery = true;
548+
547549
//Always use hibernate mode
548550
if (lipo.getHIBRTActThr() < 0xFF) lipo.setHIBRTActThr((uint8_t)0xFF);
549551
if (lipo.getHIBRTHibThr() < 0xFF) lipo.setHIBRTHibThr((uint8_t)0xFF);
@@ -553,7 +555,7 @@ void beginFuelGauge()
553555
checkBatteryLevels(); //Force check so you see battery level immediately at power on
554556

555557
//Check to see if we are dangerously low
556-
if (battLevel < 5 && battChangeRate < 0) //5% and not charging
558+
if (battLevel < 5 && battChangeRate < 0.5) //5% and not charging
557559
{
558560
Serial.println("Battery too low. Please charge. Shutting down...");
559561

@@ -565,7 +567,6 @@ void beginFuelGauge()
565567
powerDown(false); //Don't display 'Shutting Down'
566568
}
567569

568-
online.battery = true;
569570
}
570571

571572
//Begin accelerometer if available

0 commit comments

Comments
 (0)