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:
Felix
2026-04-29 20:48:49 +02:00
parent a2e3a33f00
commit 7414b303a0
2 changed files with 47 additions and 4 deletions
+2 -2
View File
@@ -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