refactor: optimize USB polling rate and fix report race condition
- Increased HID polling rate from 250Hz (4ms) to 1000Hz (1ms) in the configuration descriptor to match wired DualSense performance. - Fixed a potential race condition between Bluetooth data callbacks and the USB task using pico/critical_section. - Implemented a 'dirty flag' mechanism to prevent sending redundant duplicate reports, ensuring the dongle only transmits to the host when fresh Bluetooth data is received. - Added a fallback retry logic in interrupt_loop to ensure data integrity if a USB report fails to queue.
This commit is contained in:
@@ -314,7 +314,7 @@ uint8_t const descriptor_configuration[] = {
|
||||
0x84, // bEndpointAddress: IN EP4
|
||||
0x03, // bmAttributes: Interrupt
|
||||
0x40, 0x00, // wMaxPacketSize: 64
|
||||
0x04, // bInterval: 4 (polling every 4ms)
|
||||
0x04, // bInterval: 1 (polling every 4ms -> 1ms)
|
||||
|
||||
// Endpoint Descriptor (HID OUT: EP3)
|
||||
0x07, // bLength
|
||||
@@ -322,7 +322,7 @@ uint8_t const descriptor_configuration[] = {
|
||||
0x03, // bEndpointAddress: OUT EP3
|
||||
0x03, // bmAttributes: Interrupt
|
||||
0x40, 0x00, // wMaxPacketSize: 64
|
||||
0x04, // bInterval: 4
|
||||
0x01, // bInterval: 1 (polling every 4ms -> 1ms)
|
||||
};
|
||||
|
||||
// Invoked when received GET CONFIGURATION DESCRIPTOR
|
||||
|
||||
Reference in New Issue
Block a user