Skip to content

Increase polling rate of the RP6 (and others) builtin controller to 250hz - #12

Open
diogotr7 wants to merge 1 commit into
armada-os:mainfrom
diogotr7:rsinput-default-250hz
Open

Increase polling rate of the RP6 (and others) builtin controller to 250hz#12
diogotr7 wants to merge 1 commit into
armada-os:mainfrom
diogotr7:rsinput-default-250hz

Conversation

@diogotr7

Copy link
Copy Markdown

The byte changed is SET_PAR on other implementations of the same device, and from my research it tells the MCU of the built-in gamepad how long to wait between each poll. the time it waits is N+2ms. The old value, 7, results in a 9ms wait, which gives 1000/9=~111hz. Changing it to 2 results in a 4ms wait time, resulting in 250hz polling. Lower values do not work properly, as for some UART driver reasons the reports get batched for some reason and instead of getting e.g. 500hz at SET_PAR of 1, we instead get half a second worth of reports at once, instead of continuously. very strange.

Tested and works fine on my RP6, but of course the change affects other devices, which i have not tested.

Advantage of this polling rate increase comes mostly from being 2x the refresh rate (on 120hz devices). This reduces input latency because, since we poll twice per frame, every rendered frame will have fresh data to use, instead of running behind.

In practice, it's not particularly noticeable but it seems like a free improvement :D

AI use: Claude Code was used to diagnose the low polling rate, and a fix was tested and implemented. The initial patch it came up with lives here: https://github.com/virtudude/armada-packages/compare/main...diogotr7:armada-packages:rsinput-streaming-rx-parser

Change the hardcoded SET_PAR report-period byte from 0x07 to 0x02 in the
rsinput init command, raising the default gamepad polling rate from ~111 Hz
(9 ms) to ~250 Hz (4 ms) for all rsinput devices.

Empirically the MCU reports on whole-ms intervals: rate ~= 1000/(period+2),
so 0x07 -> 111 Hz and 0x02 -> 250 Hz. Verified lossless on a Retroid Pocket 6
(0 dropped frames at 250 Hz; UART ~50% utilised at 115200 baud).

NOTE: this is a blanket default change affecting every rsinput device
(AYN Odin 2 family, Ayaneo Pocket EVO, etc.), only hardware-validated on the
RP6. For a per-board / opt-in approach see the report_period param + DT
property branch instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant