Commit Graph

1245 Commits

Author SHA1 Message Date
Jonas Bark
5c44ca43f2 UI adjustments 2026-07-09 15:48:34 +02:00
Jonas Bark
0723272455 prepare release 2026-07-09 15:17:51 +02:00
Jonas Bark
ff2a2aace7 Merge branch '6.2-beta' into 6.3
# Conflicts:
#	lib/bluetooth/devices/sram/sram_axs.dart
#	lib/pages/controller_settings.dart
2026-07-09 15:07:49 +02:00
Jonas Bark
c94b87f08a feat(sram): discrete-click gesture + "both levers" front-shift combo
A SRAM press is a single 0xFF edge on d9050054 — no release event, and (with
shifting disabled) no multishift burst. An --observe capture confirmed a HELD
lever emits exactly one edge, so a hold is indistinguishable from a tap and
long-press cannot be reconstructed. Replace the old instant-down+up-per-edge
guard with a small assembler that treats every press as a discrete CLICK and
reconstructs the one thing the base device can't get from the raw edges — "both
levers at once":

- a press is buffered for a short combo window; if the other lever's press lands
  inside it, both buttons are emitted together in ONE call so the base device's
  _maybeHandleFrontShiftCombo fires frontShift ({shiftUp,shiftDown}) and
  suppresses the rear shifts — the "left+right together" goal;
- otherwise the single button clicks (down+up). Single vs double click is left
  to the base device (two discrete taps in its double-click window);
- supportsLongPress is set false — it's not achievable on this hardware.

Buffer/timer reset on (re)connect and cancelled on disconnect. Single clicks now
land ~_comboWindow (90ms) after the press instead of waiting on a release that
never comes. Combo detection still needs a two-lever hardware check.

Tests: fakeAsync coverage for a single discrete click, both-levers-together one
click, a held (single-edge) lever as a single click, and two spaced taps as two
clicks.
2026-07-09 14:49:28 +02:00
Jonas Bark
2868ad39c0 some fixes 2026-07-09 09:47:29 +02:00
Jonas Bark
bd2f729981 logs 2026-07-09 09:20:36 +02:00
Jonas Bark
3778136411 fix(sram): differentiate left/right shifters and default one lever to shift down
Testers reported both AXS shifters doing the same thing and gears only ever
increasing, with presses logged as a generic "SRAM Paddle". Root cause: both
drop-bar paddles report button mask 1, so the mask alone can't tell them apart,
and every discovered button was hardcoded to InGameAction.shiftUp.

- Use the button event's controller device_type (prop SramPress.deviceType,
  field 2) to name and key buttons, so left and right become distinct keymap
  entries even in a plaintext (serial-less) session — the common case in the
  field. Names now resolve to "SRAM Left/Right Shifter" without needing an
  advert or the sparse d9050003 serial.
- Default the LEFT paddle to shift DOWN and everything else to shift UP so the
  shifters aren't identical out of the box ("one lever changes down") without
  hunting through the keymap. Every button stays freely remappable.
- Persist the device_type in the button record so a restart re-registers the
  same left/right name + default instead of a duplicate entry; two serial-less
  paddles that differ only by side stay separate, and a legacy side-less record
  upgrades in place once the side is known.
- Remember a shifter's side against its serial (preserving any known model) when
  both are seen, so its other buttons resolve the same name.
- Bump the prop submodule to the field-2 decode.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H48NvkfXYm2spiiwcTQsv8

# Conflicts:
#	prop
2026-07-09 09:20:12 +02:00
Jonas Bark
d2a5d188bf Use 5W ERG steps for physical shifter buttons, matching on-screen controls
Physical remote/shifter buttons adjusted ERG target power in 10W jumps
while the on-screen and overlay +/- buttons use 5W. Align the button
action path to 5W and apply the same 0-500W clamp as the UI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 09:19:22 +02:00
Jonas Bark
c3811410a1 refactor(sram): split setup-sheet UI out of the device file
sram_axs.dart had grown to ~990 lines by carrying the whole guided
setup/restore sheet. Extract it in two layers:

- lib/widgets/guided_operation_sheet.dart — reusable, feature-agnostic
  building blocks (StepRail, StageBadge, ProgressChecklist) any staged
  setup flow can compose.
- sram_setup_sheet.dart — the SRAM-specific composition, copy, palette
  and the AXS "press & hold" hero.

The device file (446 lines now) keeps only device/BLE logic and the
trimmed panel. No behaviour or pixels change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-09 09:19:22 +02:00
Jonas Bark
50c3b6de09 fix(sram): cap guided sheet width on wide displays
The setup/restore bottom sheet spans the full window width; on desktop
that stretched the content unpleasantly. Centre it and cap it at 480
(heightFactor: 1 keeps the sheet shrink-wrapped to its content height).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-09 09:19:22 +02:00
Jonas Bark
405dcf2362 refactor(sram): trim setup panel to status + action only
The panel duplicated the device card's own header and mappable-button
list. Reduce it to just the current status (intro + "Set up SRAM
control", or the "shifting off" strip + "Restore") since the card
already shows the device name and the discovered buttons. Removes the
now-dead _SramDeviceHeader/_SramStepChip/_SramControlRow widgets, the
debugSeedButton test hook, and 11 orphaned l10n keys. The guided bottom
sheet is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-09 09:19:22 +02:00
Jonas Bark
e7cc7d5441 feat(sram): redesign setup/restore UI from design-system handoff
UI-only reskin of _buildSetupPanel + _runGuidedOperation (BLE/decode logic and
the _SramSetupStage machine untouched): a two-state device panel (header + tile,
3-step diagram / status strip + mappable-controls list) and the guided flow
re-presented as a bottom sheet with a step rail, icon badge, progress checklist,
and the AXS press-and-hold hero. +20 localized strings (en/de/es/fr/it/pl);
reduced-motion honored; snapshot test renders the real sheet stages via a
@visibleForTesting builder.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-09 09:19:22 +02:00
Jonas Bark
c1434b85a9 logs 2026-07-09 09:18:22 +02:00
Jonas Bark
bdfbe4395c fix(sram): differentiate left/right shifters and default one lever to shift down
Testers reported both AXS shifters doing the same thing and gears only ever
increasing, with presses logged as a generic "SRAM Paddle". Root cause: both
drop-bar paddles report button mask 1, so the mask alone can't tell them apart,
and every discovered button was hardcoded to InGameAction.shiftUp.

- Use the button event's controller device_type (prop SramPress.deviceType,
  field 2) to name and key buttons, so left and right become distinct keymap
  entries even in a plaintext (serial-less) session — the common case in the
  field. Names now resolve to "SRAM Left/Right Shifter" without needing an
  advert or the sparse d9050003 serial.
- Default the LEFT paddle to shift DOWN and everything else to shift UP so the
  shifters aren't identical out of the box ("one lever changes down") without
  hunting through the keymap. Every button stays freely remappable.
- Persist the device_type in the button record so a restart re-registers the
  same left/right name + default instead of a duplicate entry; two serial-less
  paddles that differ only by side stay separate, and a legacy side-less record
  upgrades in place once the side is known.
- Remember a shifter's side against its serial (preserving any known model) when
  both are seen, so its other buttons resolve the same name.
- Bump the prop submodule to the field-2 decode.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H48NvkfXYm2spiiwcTQsv8
2026-07-09 09:12:41 +02:00
Jonas Bark
c8776bd9bf Use 5W ERG steps for physical shifter buttons, matching on-screen controls
Physical remote/shifter buttons adjusted ERG target power in 10W jumps
while the on-screen and overlay +/- buttons use 5W. Align the button
action path to 5W and apply the same 0-500W clamp as the UI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 08:10:19 +02:00
Jonas Bark
1ba08d0527 refactor(sram): split setup-sheet UI out of the device file
sram_axs.dart had grown to ~990 lines by carrying the whole guided
setup/restore sheet. Extract it in two layers:

- lib/widgets/guided_operation_sheet.dart — reusable, feature-agnostic
  building blocks (StepRail, StageBadge, ProgressChecklist) any staged
  setup flow can compose.
- sram_setup_sheet.dart — the SRAM-specific composition, copy, palette
  and the AXS "press & hold" hero.

The device file (446 lines now) keeps only device/BLE logic and the
trimmed panel. No behaviour or pixels change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 15:15:28 +02:00
Jonas Bark
cd61f83045 fix(sram): cap guided sheet width on wide displays
The setup/restore bottom sheet spans the full window width; on desktop
that stretched the content unpleasantly. Centre it and cap it at 480
(heightFactor: 1 keeps the sheet shrink-wrapped to its content height).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 15:05:48 +02:00
Jonas Bark
7b91d5e7dc refactor(sram): trim setup panel to status + action only
The panel duplicated the device card's own header and mappable-button
list. Reduce it to just the current status (intro + "Set up SRAM
control", or the "shifting off" strip + "Restore") since the card
already shows the device name and the discovered buttons. Removes the
now-dead _SramDeviceHeader/_SramStepChip/_SramControlRow widgets, the
debugSeedButton test hook, and 11 orphaned l10n keys. The guided bottom
sheet is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 14:18:44 +02:00
Jonas Bark
ee6ec7d507 feat(sram): redesign setup/restore UI from design-system handoff
UI-only reskin of _buildSetupPanel + _runGuidedOperation (BLE/decode logic and
the _SramSetupStage machine untouched): a two-state device panel (header + tile,
3-step diagram / status strip + mappable-controls list) and the guided flow
re-presented as a bottom sheet with a step rail, icon badge, progress checklist,
and the AXS press-and-hold hero. +20 localized strings (en/de/es/fr/it/pl);
reduced-motion honored; snapshot test renders the real sheet stages via a
@visibleForTesting builder.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 13:45:55 +02:00
Jonas Bark
e310adbceb Merge branch '6.2' into 6.3
Brings SRAM AXS shifter support, beta-access/Shorebird track, and the
battery-saver timeout fix into 6.3. Merged the prop submodule (83f4bf9) so the
SRAM parser/button-tables and the Climb protocol coexist. Resolved: CHANGELOG
(SRAM AXS folded into 6.3.0), the prop pointer, and repointed the SRAM
integration test to the fake-BLE harness that 6.3 promoted into lib/.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 12:04:00 +02:00
Jonas Bark
bc3b6c7a7b i18n(sram): localize the SRAM setup/restore UI strings (en/de/es/fr/it/pl)
Externalize the panel + guided-dialog strings into intl_*.arb across all six
languages and wire sram_axs.dart to context.i18n. Button/log labels stay in
English (technical identifiers). Regenerated lib/gen is gitignored.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 18:51:49 +02:00
Jonas Bark
140f41e60c fix(sram): only treat the 1-byte 0xFF edge as a press (stop read-response loop)
The real cause of the runaway: handleTrigger reads d9050054 to decrypt the
button event, and on iOS/CoreBluetooth a read response is also delivered via
the notify callback — so the multi-byte read value re-entered processCharacteristic
and triggered another read, looping at BLE-read cadence (~120-180ms) from a
single click. Ignore anything that isn't the 0xFF edge (§6.1). The §7 multishift
guard from the previous commit stays as defense against genuine held-paddle bursts.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 17:57:58 +02:00
Jonas Bark
9d4684922b fix(sram): suppress multishift bursts; only prompt authorize when a bond is needed
Add the protocol §7 multishift/hold guard: a held paddle makes the derailleur
emit a rapid burst of triggers — forward the first two (so a real double-click
still reaches the base device) and drop the 3rd+ rapid one, fixing a runaway
press loop. Also make the guided setup/restore dialog try the operation first
and only ask the user to press-and-hold the AXS button if a fresh bond is
actually required — no re-authorize prompt when already bonded.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 17:51:00 +02:00
Jonas Bark
df1cebd326 fix(sram): exclude non-button components from pre-registration; stabilize names
sramShifterAdverts now gates on effectiveType (no model escape hatch), so a
front derailleur or dropper post no longer mints a phantom paddle button.
Persist each shifter's advertised type/model by serial so a button's §6.4 name
survives sessions where the shifter isn't advertising, instead of orphaning the
keymap mapping.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 17:34:52 +02:00
Jonas Bark
821ba2d0fe feat(sram): connect only to the rear derailleur; name buttons per shifter type
Filter scan results to the RD (device-type record in the 0xFE51 advertising
service data, §2), so we no longer create a controller for bare shifters. Name
buttons from the pressing shifter's advertised type/model (§6.4 — Left/Right
Shifter, Aux Top, Bonus, ...) and pre-register nearby shifters' buttons on
connect so they appear without a press; degrade to Shifter A/B when no advert.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 17:17:18 +02:00
Jonas Bark
086b127158 fix(sram): guided restore + drop vestigial re-run button
Restore now runs through the same staged dialog as setup, so when the session
key didn't survive a reconnect and a fresh bond is needed, it guides the
press-and-hold AXS authorize gesture and shows the error with a Retry instead
of only logging to the console. Remove the 'Re-run SRAM setup' button (a no-op
once shifting is disabled). Log once per connection when a press can't be
decoded, to make the key-not-active-this-session case visible.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 16:27:51 +02:00
Jonas Bark
2e59a71518 feat(sram): interactive setup dialog on the main card with visible errors
Move the setup/restore panel onto the main device card (showAdditionalInformation)
and make setup a guided dialog: instructions to press-and-hold the AXS button →
progress → success, or the actual error (e.g. bond authorization failure) with a
Retry, instead of only logging to the console. Restore surfaces a toast.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 16:04:27 +02:00
Jonas Bark
8204a41a8b fix(sram): never overwrite the saved backup on re-run; re-bond stale keys
setupControl captures the original config only once and never overwrites a
saved backup (a re-run reads the already-cleared device and would wipe it);
restore clears the backup so a later setup re-captures. Both flows verify the
session key via ensureBonded and persist any re-bond.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 15:09:13 +02:00
Jonas Bark
200ee36e1b refactor(sram): use BikeControl's built-in double-click, drop custom gesture layer
Each physical (shifter, button) now emits one press so the base device
handles single/double click from the keymap, like every other controller.
Removes the SRAM-specific tap-count timer and the double-click-window setting/UI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 14:47:13 +02:00
Jonas Bark
01ec230a2b feat(sram): guided setup / restore preferences panel
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 14:11:04 +02:00
Jonas Bark
e2475a9b76 feat(sram): decode presses into per-shifter/button model via prop logic
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 14:04:10 +02:00
Jonas Bark
c1ca003cf4 feat(sram): universal_ble transport implementation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 13:36:38 +02:00
Jonas Bark
1fd2a05098 fix(wheeltop): filter subscribe targets by notify capability, fix troubleshooting heading, reset state on disconnect
Addresses three final-review findings on the WHEELTOP EDS shifter branch:
subscribing to 6e400002 regardless of GATT properties silently killed
firmware that puts notifications on 6e400003; a missing `*` marker line
made the new TROUBLESHOOTING.md section render as one giant heading; and
never clearing per-connection button/subscription state let a mid-hold BLE
drop swallow the next press after reconnecting.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 12:56:29 +02:00
Jonas Bark
45f708a50a docs(wheeltop): rider info panel, changelog and troubleshooting for EDS shifters
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 12:11:34 +02:00
Jonas Bark
db751c80e8 feat(wheeltop): recognize EDS shifters from their advertisement
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 12:05:05 +02:00
Jonas Bark
2b361e8bac feat(wheeltop): add WHEELTOP EDS shifter button protocol (beta)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:57:17 +02:00
Jonas Bark
f48f786ab8 fix(battery-saver): extend local-method inactivity timeout to 60 min
When the local connection method (Keyboard/Touch/Media) is the only one
active, the battery saver disconnected idle controllers after 30 minutes
of no button activity. Riders on long steady efforts (e.g. Z2) with no
shifting got dropped mid-ride. Double the local-only sliding window to
60 minutes; the network method still never times out while connected.

The disconnect alert is parameterized off timeout.inMinutes, so it now
reads "60 minutes" with no string change.

Fixes #349

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 11:41:25 +02:00
Jonas Bark
b7225bc965 fix(battery-saver): allow auto-reconnect 90s after the inactivity disconnect (#329)
The suppression that lets a controller power down was permanent, and the
controller's post-disconnect advertisement left a stale scan-dedup entry
that blocked every later advertisement from reaching addDevices — a woken
controller could not reconnect until an app restart. A cooldown timer now
lifts the suppression and purges the stale entry, so waking the controller
reconnects it automatically.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 07:58:51 +02:00
Jonas Bark
071d4969c5 feat(steering): show the steering gauge for Elite Sterzo and Rizer
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 22:05:00 +02:00
Jonas Bark
34e60a498a fix(emulation): routing fallback for forgotten ids, capped write log, Di2 per-press baseline 2026-07-02 12:01:17 +02:00
Jonas Bark
9e2122445b feat(emulation): Cycplus, ThinkRider, SRAM AXS, OpenBikeControl and Di2 profiles
Adds the last emulation profile batch and finalizes allEmulationProfiles
(controllers, then steering, then accessories). Test assertions deviate from
the brief where verified behavior required it: Cycplus/ThinkRider buttons
compare by name (allowMultiple: true makes BluetoothDevice copy the static
button with a per-session sourceDeviceId, which ControllerButton equality
includes); the Di2 test sets a CustomApp so getOrAddButton actually registers
its dynamically-created channel buttons; setUp seeds packageInfoValue so
OpenBikeControlDevice's app-info write doesn't null-check crash.
2026-07-02 11:33:51 +02:00
Jonas Bark
35777d58e5 feat(emulation): Wahoo Kickr Bike Shift, Climb and Headwind profiles
Adds three emulation profiles for Task 9: Kickr Bike Shift (3-byte
button frames with rolling dedupe sequence), Kickr Climb (request-
control on connect + incline writes decoded/logged), and Headwind
(manual-mode + speed writes logged, status echo keeps the app's mode
tracking consistent with real hardware).
2026-07-02 11:12:38 +02:00
Jonas Bark
7b6ac4299c feat(emulation): Elite Sterzo, Square and Rizer profiles 2026-07-02 10:55:54 +02:00
Jonas Bark
54abf07ec8 feat(emulation): Zwift Play, Play FW2 and Click V2 profiles
Adds buildZwiftController + zwiftPlayNotification encoder plus five
new EmulationProfiles (Play L/R, Play FW2, Click V2 L/R) built on
Task 3's rideMaskInputs. Wires them into allEmulationProfiles.

TDD: emulation_zwift_profiles_test.dart written first (RED: profiles
undefined), then implemented to GREEN (5/5). The test's setUp also
initializes prop's global `propPrefs` directly — IntegrationEnv's
harness never wires it up (only production Settings.init() does),
and ZwiftClickV2's handleButtonsClicked reads it on every click, so
Click V2 side tests hit a LateInitializationError without it. This is
the first integration test to exercise a ZwiftClickV2 button press
end-to-end, which is why the gap wasn't hit before.
2026-07-02 10:30:06 +02:00
Jonas Bark
de746a0788 feat(emulation): unregister emulated peripheral on forget
Forgetting an emulated device now tears down its fake peripheral and
clears the scan-result dedupe cache so the same profile can be
re-added later.
2026-07-02 09:58:10 +02:00
Jonas Bark
c95eb147c3 feat(emulation): EmulationManager, profiles model, Click/Ride profiles, debug platform install
Adds the EmulationProfile/EmulatedInput model, EmulationManager +
EmulationSession, removePeripheral on the fake BLE platform, the first two
device profiles (Zwift Click + Ride) with an allEmulationProfiles registry,
core.emulation, and the debug-only RoutingBlePlatform install in main().
2026-07-02 09:45:12 +02:00
Jonas Bark
15ce431098 fix(emulation): silence dangling doc-comment info with library directive 2026-07-02 09:36:03 +02:00
Jonas Bark
34c523eb58 feat(emulation): RoutingBlePlatform + real-platform factory 2026-07-02 09:28:32 +02:00
Jonas Bark
20ea804198 Reapply "refactor(emulation): promote fake BLE harness from test/ to lib/bluetooth/emulation"
This reverts commit 0346594c2e.
2026-07-02 09:14:48 +02:00
Jonas Bark
0346594c2e Revert "refactor(emulation): promote fake BLE harness from test/ to lib/bluetooth/emulation"
This reverts commit 45e987ef97.
2026-07-02 09:06:53 +02:00