From 2d8b2848ca6b35b45a74517b7ff8e54610492b6a Mon Sep 17 00:00:00 2001 From: Lars Date: Mon, 16 Aug 2021 20:38:14 +0200 Subject: [PATCH] change battery handling when mower is in station and beginn the charge sequenze --- code/ardumower/robot.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/ardumower/robot.cpp b/code/ardumower/robot.cpp index b13f59d4e..35eadf413 100644 --- a/code/ardumower/robot.cpp +++ b/code/ardumower/robot.cpp @@ -612,7 +612,7 @@ void Robot::readSensors(){ if (millis() >= nextTimeBattery){ // read battery - nextTimeBattery = millis() + 100; + nextTimeBattery = millis() + 500; if ((abs(chgCurrent) > 0.04) && (chgVoltage > 5)){ // charging batCapacity += (chgCurrent / 36.0); @@ -633,9 +633,9 @@ void Robot::readSensors(){ #endif // **UZ** // low-pass filter - double accel = 0.01; + double accel = 0.5; //double accel = 1.0; - if (abs(batVoltage-batvolt)>5) batVoltage = batvolt; else batVoltage = (1.0-accel) * batVoltage + accel * batvolt; + if (abs(batVoltage-batvolt)>8) batVoltage = batvolt; else batVoltage = (1.0-accel) * batVoltage + accel * batvolt; if (abs(chgVoltage-chgvolt)>5) chgVoltage = chgvolt; else chgVoltage = (1.0-accel) * chgVoltage + accel * chgvolt; if (abs(chgCurrent-curramp)>0.5) chgCurrent = curramp; else chgCurrent = (1.0-accel) * chgCurrent + accel * curramp; } @@ -1324,6 +1324,7 @@ void Robot::setNextState(byte stateNew, byte dir){ //motorMowModulate = false; } if (stateNew == STATE_STATION){ + nextTimeBattery = millis(); //read immediatly the battery setMotorPWM(0,0,false); setActuator(ACT_CHGRELAY, 0); setDefaults();