Skip to content

feat: experimental gyro aiming on the on-screen keyboard - #204

Merged
nextestudios merged 1 commit into
mainfrom
feature/77-gyro-keyboard
Sep 27, 2026
Merged

nextestudios merged 1 commit into
mainfrom
feature/77-gyro-keyboard

Conversation

@nextestudios

Copy link
Copy Markdown
Owner

Summary

Experiment #77: gyro aiming on the on-screen keyboard, as a prototype behind a setting that is off by default, with findings in docs/decisions/0007.

  • SDL3 sensor API: SDL_GamepadHasSensor / SDL_SetGamepadSensorEnabled(SDL_SENSOR_GYRO) and SDL_EVENT_GAMEPAD_SENSOR_UPDATE (sensor timestamp when available). The sensor is only turned on while Configurações → Controles → Mira por giroscópio no teclado is on, and also for controllers connected later.
  • Core GyroPointer: continuous calibration (bias learned while still), soft deadzone (2.5°/s), exponential smoothing, sensitivity (1 key per 4°), gap clamp (50 ms), so Bluetooth bursts don't turn into jumps.
  • Pointer layer (AppController.AimKeyboard): starts at the center of the focused key and moves in fractions of a key; crossing into another key focuses it, and South types as usual. It stops at the edges (no wrap). The D-pad still works and re-anchors the pointer. R3 recenters, and the footer shows "Recentralizar mira" only when the active controller has an enabled gyro. Only the active controller aims, only on the keyboard, and never in the background. Nothing depends on the gyro.
  • Deviation: the issue suggested "hold L2 to aim", but LT/RT already move the caret to start/end on the keyboard, so the prototype aims whenever the keyboard is open (with the setting on). 0007 explains this and gives next steps (a dedicated hold on L3, or aim-after-flick) if hardware shows accidental movement. The tuning values live in GyroSettings, not in the UI yet.

Tests (CI)

  • GyroPointerTests (2): drift learned while still and tremor ignored; direction, proportional movement and gap clamp.
  • GyroKeyboardJourneyTests: off by default; points at keys within/over key boundaries; no wrap at edges; D-pad re-anchors; R3 recenters without switching view; South types the aimed key.

Manual (not hardware validated)

Added to docs/TESTING.md under "Mira por giroscópio no teclado (#77)": DualSense over USB and Bluetooth, resting drift over 1 min, tremor while typing with the D-pad, timing D-pad vs gyro, and Xbox (no gyro). The measurement results go into docs/decisions/0007.

Closes #77

🤖 Generated with Claude Code

@nextestudios
nextestudios force-pushed the feature/77-gyro-keyboard branch from 8fe785f to ea8f928 Compare September 27, 2026 22:27
@nextestudios
nextestudios force-pushed the feature/77-gyro-keyboard branch from ea8f928 to 2f7be2c Compare September 27, 2026 22:30
@nextestudios
nextestudios merged commit f8911d4 into main Sep 27, 2026
1 check passed
@nextestudios
nextestudios deleted the feature/77-gyro-keyboard branch September 27, 2026 22:32
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.

experiment: investigate DualSense gyro typing

1 participant