improve battery tracking
This commit is contained in:
+5
-3
@@ -142,17 +142,19 @@ void loop() {
|
||||
lcdWrapper->loop();
|
||||
|
||||
mainBattery->loop();
|
||||
if (mainBattery->getBatteryPercent() <= 10) {
|
||||
if (mainBattery->isBatteryLow(10)) {
|
||||
moveController.setDrivingStatus(DrivingStatus::stop);
|
||||
moveController.setSpeed(0);
|
||||
moveController.setRotationSpeed(0);
|
||||
|
||||
uint16_t voltage = (uint16_t) (mainBattery->getBatteryVoltage() * 100);
|
||||
|
||||
lcd->setCursor(0, 0);
|
||||
lcd->printf("Low Battery...");
|
||||
lcd->printf("Low Battery: %u", voltage);
|
||||
lcd->setCursor(0, 1);
|
||||
lcd->print("Please turn off.");
|
||||
|
||||
while (1);
|
||||
while (true);
|
||||
}
|
||||
|
||||
if (disconnectPs3) {
|
||||
|
||||
Reference in New Issue
Block a user