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,9 +43,11 @@ 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));
if(!PS3.PS3NavigationConnected) {
Serial.print(F("\tR2: ")); Serial.print(F("\tR2: "));
Serial.print(PS3.getAnalogButton(R2_ANALOG)); Serial.print(PS3.getAnalogButton(R2_ANALOG));
} }
}
if(PS3.getButtonClick(PS)) { if(PS3.getButtonClick(PS)) {
Serial.print(F("\r\nPS")); Serial.print(F("\r\nPS"));
PS3.disconnect(); PS3.disconnect();

View file

@ -50,9 +50,11 @@ 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));
if(!PS3[i]->PS3NavigationConnected) {
Serial.print(F("\tR2: ")); Serial.print(F("\tR2: "));
Serial.print(PS3[i]->getAnalogButton(R2_ANALOG)); 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"));
PS3[i]->disconnect(); PS3[i]->disconnect();

View file

@ -55,20 +55,24 @@ void loop() {
output += PS3.getAnalogHat(LeftHatX); output += PS3.getAnalogHat(LeftHatX);
output += "\tLeftHatY: "; output += "\tLeftHatY: ";
output += PS3.getAnalogHat(LeftHatY); output += PS3.getAnalogHat(LeftHatY);
if(!PS3.PS3NavigationConnected) {
output += "\tRightHatX: "; output += "\tRightHatX: ";
output += PS3.getAnalogHat(RightHatX); output += PS3.getAnalogHat(RightHatX);
output += "\tRightHatY: "; output += "\tRightHatY: ";
output += PS3.getAnalogHat(RightHatY); 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)) {
if(output != "") if(output != "")
output += "\r\n"; output += "\r\n";
output += "L2: "; output += "L2: ";
output += PS3.getAnalogButton(L2_ANALOG); output += PS3.getAnalogButton(L2_ANALOG);
if(!PS3.PS3NavigationConnected) {
output += "\tR2: "; output += "\tR2: ";
output += PS3.getAnalogButton(R2_ANALOG); output += PS3.getAnalogButton(R2_ANALOG);
} }
}
if(output != "") { if(output != "") {
Serial.println(output); Serial.println(output);
if(SerialBT.connected) if(SerialBT.connected)