ball read: fix major bug in reading ballSeen
parent
732298b7db
commit
69284cb009
|
@ -11,7 +11,7 @@ DataSourceBall :: DataSourceBall(HardwareSerial* ser_, int baud) : DataSource(se
|
||||||
void DataSourceBall :: postProcess(){
|
void DataSourceBall :: postProcess(){
|
||||||
if((value & 0x01) == 1){
|
if((value & 0x01) == 1){
|
||||||
distance = value;
|
distance = value;
|
||||||
ballSeen = distance > 1;
|
ballSeen = distance == 255 ? 0 : 1;
|
||||||
}else{
|
}else{
|
||||||
angle = value * 2;
|
angle = value * 2;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,9 @@ void DataSourceBall :: test(){
|
||||||
if(ballSeen){
|
if(ballSeen){
|
||||||
DEBUG.print(angle);
|
DEBUG.print(angle);
|
||||||
DEBUG.print(" | ");
|
DEBUG.print(" | ");
|
||||||
DEBUG.println(distance);
|
DEBUG.print(distance);
|
||||||
|
DEBUG.print(" | ");
|
||||||
|
DEBUG.println(ballSeen);
|
||||||
}else{
|
}else{
|
||||||
DEBUG.println("Not seeing ball");
|
DEBUG.println("Not seeing ball");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue