diff --git a/Liam/BWFSensor.cpp b/Liam/BWFSensor.cpp index 88ad801..e6269f0 100644 --- a/Liam/BWFSensor.cpp +++ b/Liam/BWFSensor.cpp @@ -42,7 +42,7 @@ void BWFSENSOR::clearSignal() { bool BWFSENSOR::isInside() { - return (signal_status == INSIDE); + return (signal_status == INSIDE); } bool BWFSENSOR::isOutside() { diff --git a/Liam/Battery.cpp b/Liam/Battery.cpp index 3dd628c..d13f851 100644 --- a/Liam/Battery.cpp +++ b/Liam/Battery.cpp @@ -89,8 +89,8 @@ word BATTERY::readBatteryAndCalcValue(){ unsigned long newReading = analogRead(batSocpin); newReading = newReading * 488 * VOLTDIVATOR; newReading /= 10000; - return newReading; - //return word(newReading); + //return newReading; + return word(newReading); } bool BATTERY::isBeingCharged() { diff --git a/Liam/Battery.h b/Liam/Battery.h index 7ae4328..5fe8800 100644 --- a/Liam/Battery.h +++ b/Liam/Battery.h @@ -26,10 +26,10 @@ Placed under the GNU license #define LIION 2 //All voltage value need to be x100 to avoid decimals (12.54V = 1254) -#define LIIONFULL 1300 -#define LIIONEMPTY 1040 -#define NIMHFULL 1450 -#define NIMHEMPTY 1150 +#define LIIONFULL 1256 +#define LIIONEMPTY 1040 +#define NIMHFULL 1450 +#define NIMHEMPTY 1150 #define LEADACIDFULL 1330 #define LEADACIDEMPTY 1200 diff --git a/Liam/Controller.cpp b/Liam/Controller.cpp index e6ceadb..e06a299 100644 --- a/Liam/Controller.cpp +++ b/Liam/Controller.cpp @@ -65,9 +65,15 @@ int CONTROLLER::turnToReleaseRight(int angle) { sensor->select(0); if (sensor->isInside()) { - sensor->select(1); - if (sensor->isInside()) - return 0; // OK + // Only check sensor one if more than 1 sensor defined. + if(NUMBER_OF_SENSORS>1) + { + sensor->select(1); + if (sensor->isInside()) + return 0; // OK + } + else + return 0; // OK } if (wheelsAreOverloaded()) @@ -292,18 +298,10 @@ boolean CONTROLLER::hasBumped() { } boolean CONTROLLER::hasTilted() { - Serial.println(""); - Serial.println("NU är tiltvärdet :"); - Serial.println(compass->getTiltAngle(), DEC); - Serial.println(compass->getTiltAngle() > TILTANGLE); return (compass->getTiltAngle() > TILTANGLE); } boolean CONTROLLER::hasFlipped() { - Serial.println(""); - Serial.println("NU är Flippvärdet :"); - Serial.println(compass->getTiltAngle(), DEC); - Serial.println(compass->getTiltAngle() > FLIPANGLE); return (compass->getTiltAngle() > FLIPANGLE); } diff --git a/Liam/Definition.h b/Liam/Definition.h index dce24b2..0307178 100644 --- a/Liam/Definition.h +++ b/Liam/Definition.h @@ -65,10 +65,10 @@ const int MY_CUTTERMOTOR = 1; const int MY_BATTERY = 2; /* Number of BWF sensors can be 1-4 depending on shield */ -const int NUMBER_OF_SENSORS = 2; +const int NUMBER_OF_SENSORS = 1; /* BWF transmitter signals */ -#define INSIDE_BWF 85 +#define INSIDE_BWF 86 #define OUTSIDE_BWF 5 /* If you have a bumper connected to pin8, set it to true. Remember to cut the brake connection on your motor shield */ diff --git a/Liam/Liam.ino b/Liam/Liam.ino index 3b1df96..bd5a0e7 100644 --- a/Liam/Liam.ino +++ b/Liam/Liam.ino @@ -269,7 +269,7 @@ void loop() { state = DOCKING; break; } - + // Tries to turn, but if timeout then reverse and try again if ((err = Mower.turnToReleaseRight(30) > 0)) { Mower.runBackward(FULLSPEED);