matherp Guru
 Joined: 11/12/2012 Location: United KingdomPosts: 10967 |
| Posted: 08:16am 05 Jul 2025 |
|
|
|
UPDATE
I've finally manage to re-create the? (a?) problem by slowing the polling rate to 200mSec. At this speed I am seeing dropped characters but more importantly I know where they are. To fix this needs some fairly complex code as it is all tied in with the key repeat logic. If I polled continuously then the problem would not manifest itself although in the limit it could still occur (and of course MMBasic wouldn't run). The problem occurs if two or more new key-presses happen within the polling interval in which case both the first, second and possibly subsequent values in the USB report will represent those new key-presses.
This is non-trivial to interpret because a key held down will appear in the new report so the code has to distinguish between a held down key and a new key. At the moment it only does this for the top position in the report.
I still don't understand why Amnesie is seeing the issue to such an extent. I'm testing on one of my PicoMiteVGA USB edition boards (RP2040) which has the USB port properly configured as a host and even slowing the polling rate from the original 20mSec to 50mSec I can't replicate the problem (Lenovo KU-0225 keyboard). Could it be that the internal scan in some keyboards is very slow and they are stacking up the key-presses into a single report - who knows?
Anyway, I'll spend some time re-coding to accept new data in other than the first report slot and see if that solves it. Watch this space. |