Merge pull request #207 from matt-bull/patch-1

* patch-1:
  Have PS3.printStatusString() print to a new line each time it is called.
This commit is contained in:
Kristian Sloth Lauszus 2016-02-09 20:50:09 +01:00
commit 5f460dec87
2 changed files with 7 additions and 7 deletions

View file

@ -158,9 +158,9 @@ bool PS3BT::getStatus(StatusEnum c) {
} }
void PS3BT::printStatusString() { void PS3BT::printStatusString() {
char statusOutput[100]; // Max string length plus null character char statusOutput[102]; // Max string length plus null character
if(PS3Connected || PS3NavigationConnected) { if(PS3Connected || PS3NavigationConnected) {
strcpy_P(statusOutput, PSTR("ConnectionStatus: ")); strcpy_P(statusOutput, PSTR("\r\nConnectionStatus: "));
if(getStatus(Plugged)) strcat_P(statusOutput, PSTR("Plugged")); if(getStatus(Plugged)) strcat_P(statusOutput, PSTR("Plugged"));
else if(getStatus(Unplugged)) strcat_P(statusOutput, PSTR("Unplugged")); else if(getStatus(Unplugged)) strcat_P(statusOutput, PSTR("Unplugged"));
@ -185,7 +185,7 @@ void PS3BT::printStatusString() {
else if(getStatus(Bluetooth)) strcat_P(statusOutput, PSTR("Bluetooth - Rumble is off")); else if(getStatus(Bluetooth)) strcat_P(statusOutput, PSTR("Bluetooth - Rumble is off"));
else strcat_P(statusOutput, PSTR("Error")); else strcat_P(statusOutput, PSTR("Error"));
} else if(PS3MoveConnected) { } else if(PS3MoveConnected) {
strcpy_P(statusOutput, PSTR("PowerRating: ")); strcpy_P(statusOutput, PSTR("\r\nPowerRating: "));
if(getStatus(MoveCharging)) strcat_P(statusOutput, PSTR("Charging")); if(getStatus(MoveCharging)) strcat_P(statusOutput, PSTR("Charging"));
else if(getStatus(MoveNotCharging)) strcat_P(statusOutput, PSTR("Not Charging")); else if(getStatus(MoveNotCharging)) strcat_P(statusOutput, PSTR("Not Charging"));
@ -196,7 +196,7 @@ void PS3BT::printStatusString() {
else if(getStatus(MoveFull)) strcat_P(statusOutput, PSTR("Full")); else if(getStatus(MoveFull)) strcat_P(statusOutput, PSTR("Full"));
else strcat_P(statusOutput, PSTR("Error")); else strcat_P(statusOutput, PSTR("Error"));
} else } else
strcpy_P(statusOutput, PSTR("Error")); strcpy_P(statusOutput, PSTR("\r\nError"));
USB_HOST_SERIAL.write(statusOutput); USB_HOST_SERIAL.write(statusOutput);
} }

View file

@ -362,9 +362,9 @@ bool PS3USB::getStatus(StatusEnum c) {
} }
void PS3USB::printStatusString() { void PS3USB::printStatusString() {
char statusOutput[100]; // Max string length plus null character char statusOutput[102]; // Max string length plus null character
if(PS3Connected || PS3NavigationConnected) { if(PS3Connected || PS3NavigationConnected) {
strcpy_P(statusOutput, PSTR("ConnectionStatus: ")); strcpy_P(statusOutput, PSTR("\r\nConnectionStatus: "));
if(getStatus(Plugged)) strcat_P(statusOutput, PSTR("Plugged")); if(getStatus(Plugged)) strcat_P(statusOutput, PSTR("Plugged"));
else if(getStatus(Unplugged)) strcat_P(statusOutput, PSTR("Unplugged")); else if(getStatus(Unplugged)) strcat_P(statusOutput, PSTR("Unplugged"));
@ -389,7 +389,7 @@ void PS3USB::printStatusString() {
else if(getStatus(Bluetooth)) strcat_P(statusOutput, PSTR("Bluetooth - Rumble is off")); else if(getStatus(Bluetooth)) strcat_P(statusOutput, PSTR("Bluetooth - Rumble is off"));
else strcat_P(statusOutput, PSTR("Error")); else strcat_P(statusOutput, PSTR("Error"));
} else } else
strcpy_P(statusOutput, PSTR("Error")); strcpy_P(statusOutput, PSTR("\r\nError"));
USB_HOST_SERIAL.write(statusOutput); USB_HOST_SERIAL.write(statusOutput);
} }