Don't print R2 and right joystick if a Navigation controller is connected

This commit is contained in:
Kristian Sloth Lauszus 2013-01-20 22:30:53 +01:00
parent 0397a3f088
commit 47ab932c0f
3 changed files with 18 additions and 10 deletions

View file

@ -43,8 +43,10 @@ void loop() {
if(PS3.getAnalogButton(L2_ANALOG) > 0 || PS3.getAnalogButton(R2_ANALOG) > 0) { if(PS3.getAnalogButton(L2_ANALOG) > 0 || PS3.getAnalogButton(R2_ANALOG) > 0) {
Serial.print(F("\r\nL2: ")); Serial.print(F("\r\nL2: "));
Serial.print(PS3.getAnalogButton(L2_ANALOG)); Serial.print(PS3.getAnalogButton(L2_ANALOG));
Serial.print(F("\tR2: ")); if(!PS3.PS3NavigationConnected) {
Serial.print(PS3.getAnalogButton(R2_ANALOG)); Serial.print(F("\tR2: "));
Serial.print(PS3.getAnalogButton(R2_ANALOG));
}
} }
if(PS3.getButtonClick(PS)) { if(PS3.getButtonClick(PS)) {
Serial.print(F("\r\nPS")); Serial.print(F("\r\nPS"));

View file

@ -50,8 +50,10 @@ void loop() {
if(PS3[i]->getAnalogButton(L2_ANALOG) > 0 || PS3[i]->getAnalogButton(R2_ANALOG) > 0) { if(PS3[i]->getAnalogButton(L2_ANALOG) > 0 || PS3[i]->getAnalogButton(R2_ANALOG) > 0) {
Serial.print(F("\r\nL2: ")); Serial.print(F("\r\nL2: "));
Serial.print(PS3[i]->getAnalogButton(L2_ANALOG)); Serial.print(PS3[i]->getAnalogButton(L2_ANALOG));
Serial.print(F("\tR2: ")); if(!PS3[i]->PS3NavigationConnected) {
Serial.print(PS3[i]->getAnalogButton(R2_ANALOG)); Serial.print(F("\tR2: "));
Serial.print(PS3[i]->getAnalogButton(R2_ANALOG));
}
} }
if(PS3[i]->getButtonClick(PS)) { if(PS3[i]->getButtonClick(PS)) {
Serial.print(F("\r\nPS")); Serial.print(F("\r\nPS"));

View file

@ -55,10 +55,12 @@ void loop() {
output += PS3.getAnalogHat(LeftHatX); output += PS3.getAnalogHat(LeftHatX);
output += "\tLeftHatY: "; output += "\tLeftHatY: ";
output += PS3.getAnalogHat(LeftHatY); output += PS3.getAnalogHat(LeftHatY);
output += "\tRightHatX: "; if(!PS3.PS3NavigationConnected) {
output += PS3.getAnalogHat(RightHatX); output += "\tRightHatX: ";
output += "\tRightHatY: "; output += PS3.getAnalogHat(RightHatX);
output += PS3.getAnalogHat(RightHatY); output += "\tRightHatY: ";
output += PS3.getAnalogHat(RightHatY);
}
} }
//Analog button values can be read from almost all buttons //Analog button values can be read from almost all buttons
if(PS3.getAnalogButton(L2_ANALOG) || PS3.getAnalogButton(R2_ANALOG)) { if(PS3.getAnalogButton(L2_ANALOG) || PS3.getAnalogButton(R2_ANALOG)) {
@ -66,8 +68,10 @@ void loop() {
output += "\r\n"; output += "\r\n";
output += "L2: "; output += "L2: ";
output += PS3.getAnalogButton(L2_ANALOG); output += PS3.getAnalogButton(L2_ANALOG);
output += "\tR2: "; if(!PS3.PS3NavigationConnected) {
output += PS3.getAnalogButton(R2_ANALOG); output += "\tR2: ";
output += PS3.getAnalogButton(R2_ANALOG);
}
} }
if(output != "") { if(output != "") {
Serial.println(output); Serial.println(output);