Skip to content

Fix AmigaHID-pico with GL.iNet Comet (GL-RM1)#43

Open
reinauer wants to merge 5 commits into
borb:mainfrom
reinauer:glkvm
Open

Fix AmigaHID-pico with GL.iNet Comet (GL-RM1)#43
reinauer wants to merge 5 commits into
borb:mainfrom
reinauer:glkvm

Conversation

@reinauer

Copy link
Copy Markdown
Contributor

The GL-RM1 is a PiKVM fork that can be purchased off Amazon for 115$ right now.
Turns out it would be the perfect and fairly affordable KVM solution for getting
an Amiga connected. However, there were a two of issues when attempting to
use it in combination with the amigahid-pico:

  • mouse movements up and down only worked if you also move the mouse
    left and right at the same time.
  • fairly high latency on the amigahid-pico side

This patch train solves both of these issues and makes this combo work like a charm.
Three of the commits are adding debugging that was useful along the way (and that
you want to leave turned off if latency is at all important to you as an I2C transfer
to the OLED is very expensive):

  • platform/amiga: fix quadrature mouse delta handling
  • debug: add HID and mouse status diagnostics
  • debug: gate input tracing behind build flags
  • platform/amiga: queue mouse motion across cores
  • debug: gate HID status behind a build flag

Keep mouse motion in 16-bit accumulators and preserve divider
remainders between output batches.

This stops small axis-only movement from being dropped before it
reaches the Amiga quadrature generator. It also aligns the initial
quadrature state with the idle line levels used at init.
Show HID mount state on the OLED, including device address,
instance, protocol and receive-report status.

Also print the latest mouse deltas and button bitmap, and reset
stale report counts on mount and unmount so the status line stays
accurate.
Add DEBUG_MOUSE and DEBUG_KEYBOARD build options so the
per-report mouse trace and per-key keyboard trace can be
compiled out of the default build.

This keeps the debug code available when needed without
forcing the hot input paths to update UART and the OLED on
every event.
Replace the shared x/y accumulators with a queue-backed handoff
between the USB host side and the quadrature output loop.

This removes the racy cross-core read-modify-write pattern that
could drop motion under load. It also lets the quadrature loop
merge newly arrived deltas between output steps.
Add DEBUG_HID_STATUS so the OLED HID mount and receive status
line can be compiled out of the default build.

This keeps the status display available for diagnosis without
forcing line 2 updates in normal use.
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