4 Commits

Author SHA1 Message Date
Jonas Acker
2460ae3251 feat(zwift): split each Play/Ride paddle into inward and outward buttons
paddleLeft/paddleRight become paddleLeftInward/Outward and
paddleRightInward/Outward, each mappable on its own. Defaults are
unchanged (left shifts down, right shifts up), and the built-in Zwift
keymap maps both directions as the paddle was.

The sign-to-direction mapping lives in one place, ZwiftPaddle in
constants.dart, shared by the Play and Ride parsers, RideControllerPress
and the emulator profiles. Inward = left positive / right negative, the
sign BikeControl already sends Zwift to brake; not hardware-verified
for reading paddles.

Saved keymaps that name paddleLeft/paddleRight load onto both new
buttons of that side, keeping action and device id; the next save
writes the new names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:27:59 +01:00
jonas.bark@gmx.de
33be7b8181 fix(keymap): show the number on generic gamepad buttons
The round button label kept only the first letter of each word, so every
generic gamepad button ("button-7") read "B" and every axis ("axis-1_-1")
read "A". Show "B7", "A1+" and "A1−" instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 13:37:49 +02:00
Jonas Bark
e9e7425c29 Integration tests: controller connections + virtual shifting through fake platform seams
Add test/integration with platform fakes installed at the plugin seams
(UniversalBle.setInstance, NsdPlatformInterface.instance); everything
above them — Connection, device classification, protocol parsers, press
state machine, keymaps, ProxyDevice — is the real code:

- controller_connection_test: scan→classification (Zwift Click/Ride via
  manufacturer data, Di2 via service UUID, FTMS trainer→ProxyDevice,
  ignored names/devices), connect lifecycle (device-info reads, battery,
  RideOn handshake, subscriptions), drops, dedupe, forget list.
- controller_button_chain_test: byte-accurate BLE notifications through
  the full reaction chain — single/double/long press, trigger remapping,
  duplicate-frame dedupe, unmapped-button error surfacing, multi-button
  Ride presses.
- virtual_shifting_connection_logic_test: retrofit-mode defaults (WiFi /
  BT-wins / proxy for power meters), auto-connect consent gating,
  in-place "No connection" disconnect + in-place reconnect, WiFi trainer
  discovery rules (found/lost/connected-survives-flap, self-exclusion),
  and an end-to-end Click-press → real action pipeline → gear shift.

Protocol-level coverage (DirCon over real TCP, BLE peripheral) lives in
the prop submodule's own tests — no prop internals in this repo.

Bug fix found by these tests: Connection.disconnect(keepInList: true)
was defeated — UniversalBle.disconnect resolves only after the platform
disconnect event, so the still-attached connectionStream listener
re-entered disconnect() without keepInList and dropped the device,
orphaning the object the open details page holds (the exact bug
0db8cf0c addressed). Guarded via _inPlaceDisconnects.

Also update stale tests to current behavior: sim-mode shifts return
Ignored since e0e4494d (handled by the bridge, not forwarded, logged
neutrally), ControllerButton.initials direction arrows, and skip the
third BC2 state-machine test consistently with its siblings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 18:59:14 +02:00
Jonas Bark
256a0bc2c3 feat(controller): add ControllerButton.initials getter 2026-04-24 10:33:38 +02:00