mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Clear buttonState properly
Caused an issue on some dongles
This commit is contained in:
parent
65ba9c1366
commit
8e6ab3f3ae
1 changed files with 5 additions and 7 deletions
12
PS3BT.cpp
12
PS3BT.cpp
|
@ -459,9 +459,6 @@ void PS3BT::L2CAP_task() {
|
||||||
if (remote_name[0] == 'M') { // First letter in Motion Controller ('M')
|
if (remote_name[0] == 'M') { // First letter in Motion Controller ('M')
|
||||||
for (uint8_t i = 0; i < BULK_MAXPKTSIZE; i++) // Reset l2cap in buffer as it sometimes read it as a button has been pressed
|
for (uint8_t i = 0; i < BULK_MAXPKTSIZE; i++) // Reset l2cap in buffer as it sometimes read it as a button has been pressed
|
||||||
l2capinbuf[i] = 0;
|
l2capinbuf[i] = 0;
|
||||||
ButtonState = 0;
|
|
||||||
OldButtonState = 0;
|
|
||||||
|
|
||||||
l2cap_state = L2CAP_HID_PS3_LED;
|
l2cap_state = L2CAP_HID_PS3_LED;
|
||||||
} else
|
} else
|
||||||
l2cap_state = L2CAP_HID_ENABLE_SIXAXIS;
|
l2cap_state = L2CAP_HID_ENABLE_SIXAXIS;
|
||||||
|
@ -502,12 +499,9 @@ void PS3BT::Run() {
|
||||||
if (millis() - timer > 1000) { // loop 1 second before sending the command
|
if (millis() - timer > 1000) { // loop 1 second before sending the command
|
||||||
for (uint8_t i = 0; i < BULK_MAXPKTSIZE; i++) // Reset l2cap in buffer as it sometimes read it as a button has been pressed
|
for (uint8_t i = 0; i < BULK_MAXPKTSIZE; i++) // Reset l2cap in buffer as it sometimes read it as a button has been pressed
|
||||||
l2capinbuf[i] = 0;
|
l2capinbuf[i] = 0;
|
||||||
ButtonState = 0;
|
|
||||||
OldButtonState = 0;
|
|
||||||
|
|
||||||
enable_sixaxis();
|
|
||||||
for (uint8_t i = 15; i < 19; i++)
|
for (uint8_t i = 15; i < 19; i++)
|
||||||
l2capinbuf[i] = 0x7F; // Set the analog joystick values to center position
|
l2capinbuf[i] = 0x7F; // Set the analog joystick values to center position
|
||||||
|
enable_sixaxis();
|
||||||
l2cap_state = L2CAP_HID_PS3_LED;
|
l2cap_state = L2CAP_HID_PS3_LED;
|
||||||
timer = millis();
|
timer = millis();
|
||||||
}
|
}
|
||||||
|
@ -532,6 +526,10 @@ void PS3BT::Run() {
|
||||||
#endif
|
#endif
|
||||||
PS3MoveConnected = true;
|
PS3MoveConnected = true;
|
||||||
}
|
}
|
||||||
|
ButtonState = 0; // Clear all values
|
||||||
|
OldButtonState = 0;
|
||||||
|
ButtonClickState = 0;
|
||||||
|
|
||||||
onInit(); // Turn on the LED on the controller
|
onInit(); // Turn on the LED on the controller
|
||||||
l2cap_state = L2CAP_DONE;
|
l2cap_state = L2CAP_DONE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue