Trainers latch their control session to the protocol live at connect
time, so a switch only takes real effect on a fresh connection (Jonas
verified on hardware via the manual Bridge disconnect/reconnect). Both
switch sites — the VS-options selector and the self-test verdict CTA —
now run ProxyDevice.reconnectUpstream(), which mirrors the
ConnectionCard cycle and waits for the reseeded definition. Inert picks
(same effective delivery) skip the cycle.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- self_test_card.dart: a precheck refusal on "Run again" now clears
_engine inside the same setState. _body only renders _idle (where
_refusal is shown) when _engine is null, so a refusal raised while a
finished verdict engine was still attached rendered invisibly behind
the verdict view — the rerun CTA silently no-opped.
- settings.dart: add missing static to _selfTestKey, matching its
sibling key helpers.
- self_test_harness_test.dart: drop unused self_test_harness.dart import.
Adds a widget test: complete a run to a verdict, attach the trainer
app, tap "Run again" — the trainer-app refusal is now visible and no
new run starts.
Three things a rider asked for, all on the same idea: an offer's button should
do the thing, and nothing should be labelled optional that is plainly working.
- "Enable overlay" now enables the overlay and *then* opens the Overlay
section. A button that only navigates to another switch is the toast
problem again, one tap further along. The enable path moved into a shared
enableTrainerOverlay(), run by both the section's switch and the step, so
the two cannot drift; it persists the flag only when the platform actually
put something on screen, so declining Android's draw-over prompt can't
leave a setting claiming an invisible overlay. A refusal says why, and the
page opens anyway — that is where the permission tile lives.
- New optional step on the app card: "Add keyboard and mouse actions",
offered when Local is available on this device but switched off (target is
This device, per CoreLogic.showLocalControl) and an app is chosen. Local is
not a way to reach the app, it is a way to do more to it — keystrokes and
clicks the button editor only offers once it is on — and a rider who never
turns it on never learns those actions exist. Its button runs the existing
enableLocalControl(), permission sheet and all.
- The card header drops its OPTIONAL tag once the link is off "off". The
link stays optional underneath, which is what keeps a trainer nobody owns
from blocking "Ready to ride", but the word is there to reassure someone
looking at an empty slot — not to caption connected hardware.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The same physical trainer is regularly discovered twice — once over BLE
(MAC/UUID device id) and once over mDNS/DirCon (dircon://<serviceName>) —
and BluetoothDevice.== is id-based, so the two never dedupe. Both rows
carried the same name, the same "Supports virtual shifting" subtitle and
the same bike icon, leaving the rider to guess which one to tap.
Name the upstream transport wherever the duplicates surface:
- the onboarding trainer picker (both the scan rows and the already-
connected card) now reads "<transport> · Supports virtual shifting"
and leads with a wifi/bluetooth mark instead of the generic bike;
- ProxyDevice.nameBadge drops the exact-duplicate-name gate — real
duplicates differ slightly (BLE advertisement vs DirCon service name),
which is exactly the case the gate missed;
- the diagnostics bundle gains upstream=wifi|ble next to the existing
mode= (which is the *downstream* retrofit mode, not the same thing);
- the home chain card ranks bridged > connected > connecting > idle so a
live entry always beats its idle twin.
New reusable connectionWifi / connectionBluetooth l10n keys replace the
hardcoded 'WiFi'/'BT' strings in the connection card and the proxy
metric row.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Replaces the three benefit tiles with a three-scene stage that shows what
Virtual Shifting does in the widgets it actually does it with, and rebuilds
the scan as its own card with the found trainers inside it.
- Scene 1 pairs smart trainers with the training apps BikeControl supports.
- Scene 2 drives the gear editor's own ratio curve through its presets, so
GearRatioCurve is split into a definition-bound wrapper plus a value-driven
GearRatioCurveView, and the presets move to gear_ratio_presets.dart where
both the editor and the preview read them.
- Scene 3 introduces FrontShiftVisual (chainrings + resulting ratio range),
which FrontShiftCard now shows above its teeth steppers in place of the
bare ratio factor.
The stage holds still under reduced motion and screenshotMode, opening on
initialScene so each scene can be captured deterministically.
Also localizes the ratio curve's hardcoded labels and pluralizes the
"trainers found" count.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Four things found riding the real app.
The offline note claimed "your changes apply the next time it connects",
which is simply untrue — button mappings live in the keymap, not on the
device, so nothing is queued up waiting for a reconnect. It now says what
is actually true: you can still change what its buttons do.
A smart trainer that had only just been discovered announced itself as
"Wahoo KICKR lost connection". That was mine, and the cause is worth
recording: _handleConnectionQueue calls _connect() on every queued device,
but ProxyDevice.connect() deliberately no-ops unless the rider has asked
for that trainer. Recording "connected this session" right after connect()
returned therefore marked a trainer that never connected as having
connected — and the chain then read the disconnected state as a break.
Recording now hangs off the actual connection signal, and a new
DevicePresence.discovered ("in range, never connected") maps to a grey
"Not connected" that, being optional, doesn't stop the rider being ready.
A trainer that genuinely drops is still red.
"More options" had picked up two things that don't belong in a settings
drawer: a scanner running a permanent searching animation, implying work
the app wasn't doing on anyone's behalf, and a Close row on desktop, where
SystemNavigator.pop() does nothing useful and the window's own close
button is the way out. Pairing lives in the controller card's setup sheet,
which is where the scanner already was.
The virtual-shifting takeover dialog is gone entirely — the widget, the
shouldAutoConnect gate, the settings accessors and the onboarding call
site. Tapping Connect once is the whole consent story. Two tests asserted
the old gate; one is rewritten around intent alone being sufficient, and
the widget test for the dialog's presence is dropped rather than inverted,
because showSmartTrainerConsentDialog no longer exists and bringing the
gate back could not compile.
Also removes twelve imports in overview.dart left orphaned by the chain
refactor. Verified against the untouched 6.4 baseline: analyze reports no
errors, and the suite's failures are unchanged pre-existing golden drift.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The picker asks the user to choose between BikeControl's virtual
shifting, a plain proxy, and letting the trainer app handle shifting
itself — without much to go on. Link out to the blog post that compares
the two paths honestly, so the trade-offs are one tap away.
Localized across all six locales. Also adds the snapshot test that
generates the picker image used in that post.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ERG (review findings on the ±5W change):
- New ErgPowerStepping extension is the single home for the 5W step and
500W manual cap, replacing 7 inline copies (physical buttons, hero-card
buttons/slider, three overlay controllers).
- Boundaries are guards, not clamps: up at >=500W is a no-op like the
disabled UI button (a 600W FTMS target is no longer slashed to 500),
down from >500W steps relative, and an unknown baseline (hub-commanded
ERG reports no target) is a no-op with a new localized message instead
of slamming the trainer to ~150W.
- ERG shift-up Success carries the button again so +5W presses show
activity feedback (missed conversion from 843f7985).
SRAM gesture:
- Same-lever repeats inside the 90ms combo window coalesce as duplicates:
a finger can't re-press in 90ms, but iOS re-delivers a colliding read
response of the 0xFF edge through the notify callback — it must not
actuate twice (nor break a combo when it misdecodes to the other lever).
- The §7 multishift guard only runs while shifting is enabled — the one
state where a held paddle actually bursts (per c94b87f0's --observe
capture). Bonded rapid tapping and both-lever combos are never
throttled. Timer-driven instead of DateTime.now() (deterministic under
fakeAsync) and cleared by _resetGesture on (re)connect.
- The "set up SRAM control" warning fires once per connection, not on
every undecoded press.
Harness:
- EmulationSession.notify drops notifications for removed peripherals so
delayed notifies (SRAM double-tap) can't land after teardown.
- The 0xFF press edge is SramAxsConstants.triggerEdge at all call sites;
the emulation test waits on the named TRIGGER_UUID constant.
- New coverage: guard behavior through processCharacteristic in both
states, burst suppression while unbonded, all-taps-delivered once
bonded, ERG boundary/game-set-target cases.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- FrontShiftCard now applies its toggle/chainring changes to the live
FitnessBikeDefinition (not just the persisted config), so enabling the
virtual front derailleur takes effect immediately instead of only after a
reconnect/mode-switch — the combo gate read the config while the action
checked the def, so the just-enabled feature reported itself disabled.
- Bound the small-ring stepper to the large ring so small can't exceed large
(which inverted the ratio and made the shift a no-op).
- Error-handle the fire-and-forget front-shift combo so a throw is recorded
instead of becoming an unobserved async error.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extract FrontShiftCard from the gear-ratios page so it can render in
isolation, and add two golden scenes that capture single widgets for the
6.2 blog: the front-derailleur setting card and the second-window gear
overlay (2×N notation). Each renders the widget in a keyed RepaintBoundary
for a tight, page-free capture.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
With the virtual front derailleur on, the compact gear readout switches
from rear gear/total (14/25) to head-unit-style front×rear position
notation (small ring 1×N, large ring 2×N, e.g. 2×14) — matching how
Garmin/Wahoo display Di2/AXS gearing. With it off, it stays 14/25.
- Add tested formatGearReadout helper.
- Wire into the proxy card, debug menu, desktop second window + Android
PiP/overlay (trainer_overlay_view), and the gear hero card (2× · 50T).
- Carry frontShiftEnabled + frontRingLarge through TrainerOverlayState
(json, ==, hashCode, activity map) so the snapshot reaches the overlay
and the iOS surfaces.
- iOS PiP + Live Activity: format 2×N centrally in GearSnapshot.
- Standardize the off-state readout to 14/25 across all surfaces.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- New "Floating window (Picture-in-Picture)" overlay setting (iOS 16+). Default
follows the per-device auto behavior (on for iPad / non-DI iPhones, off for
Dynamic-Island iPhones); DI-iPhone users can opt in. The Live Activity keeps
running alongside it (additive).
- iPad: start PiP immediately on activation (foreground) instead of only when
backgrounded — there's screen room (DeviceCapabilities.prefersForegroundPip +
scheduleForegroundStart poll).
- DeviceCapabilities.isPipCapable (any iOS 16+ PiP device) + bike_control/pip_ios
"isCapable"; settings.getOverlayUsePip/setOverlayUsePip; show() resolves the
preference.
- requiresLinearPlayback = true to drop the PiP skip/scrub (next/prev) controls
(it's a live HUD; central play/pause is system chrome, harmless no-op).
- overlayUsePip + overlayUsePipSubtitle in all 6 languages; changelog updated.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add SRAM-style front-shift card to gear-ratios editor: enable toggle bound
to frontShiftEnabled, small/large chainring StepperControls clamped to
ShiftingConfig constants, derived ratio helper text. Persists via
_updateActive copyWith. Localized in all six ARBs (en/de/es/fr/it/pl).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Bump golden_screenshot 8.2.0 -> ^11.0.1 (drops the Yaru dependency, hence the
linux plugin-registrant change).
- screenshot_test.dart now renders each scene for 6 locales (en/de/es/fr/it/pl)
via a shoot() helper, writing screenshots/<locale>/<scene>-<device>.png.
Marketing titles are translated per locale (de/es/fr/it/pl are drafts).
- main.dart: screenshotLocale global drives the app locale in screenshot mode
(was hardcoded to English).
- v11 only loads fonts found in the rendered tree, so loadAssets() runs after
the first pump.
- Virtual Shifting scene shows the gear UI instead of the "trainer doesn't
advertise FTMS" warning: added ProxyDevice.debugAttachFitnessBike (test seam,
no server side-effects) and hide the MyWhoosh gearing hint in screenshot mode.
- prepare_store_screenshots.sh maps each store locale from its language folder
(de-DE <- screenshots/de, ...).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Link the 5.4 smart-trainers/virtual-shifting blog post as a secondary
'More Information' action above 'Got it', reusing the existing moreInformation
string (all 6 locales).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Show a one-time, full-screen explainer the first time the Smart Trainer
page is opened: Virtual Shifting is in beta, works with dozens of trainers
(some not perfectly yet), links to the supported-trainers list, and invites
feedback. Gated by a global 'virtual_shifting_intro_seen' pref and skipped in
screenshot mode. Reuses existing icons only. Strings added in all 6 locales.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
After an in-place "No connection" disconnect, selecting Virtual Shifting
again reconnected the BLE upstream but the connect never completed:
device.isConnected stayed false and the card hung on "connecting".
The listener that flips isConnected (and drives the handshake to
completion) is created only in _connect(), which runs once via the
auto-connect queue at app start. The first manual connect reuses that
listener; disconnect cancels it (so a BLE drop doesn't fire
auto-reconnect); the second manual connect via startProxy() had no
listener and never re-ran _connect.
Route the in-place reconnect through a new Connection.connectDevice()
wrapper over _connect, re-attaching the action / connection-state
listeners — the same path the working auto-connect uses — instead of
calling ProxyDevice.startProxy() directly.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The "No connection" picker entry disconnects without leaving the details
page, but Connection.disconnect(forget: false) removed the ProxyDevice
from the registry (isResetting is false). The open page kept the now
orphaned object: rediscovery built a *new* ProxyDevice while the page
still pointed at the old one, so selecting Virtual Shifting again
reconnected a device absent from bluetoothDevices — its BLE notifications
were rejected ("Device not found") and the connection was force-dropped.
Add a keepInList flag to disconnect; the in-place "No connection" path
passes it so the same device object stays registered (and its scan
result is retained to avoid a churned duplicate) and remains
reconnectable on the same card. The Disconnect buttons, which pop the
page, keep the default removing behaviour.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- ConnectionCard: "No connection" shows "Not connected" instead of the
bridge connect instruction; switching modes keeps the bridge accordion
mounted with inline progress (drops the "Connecting in ... mode"
placeholder card).
- proxy_device_details: stable keys on ConnectionCard / LiveMetricsSection
/ MiniWorkoutCard. On (dis)connect, conditional siblings toggle both
above (FTMS warning) and below (gear/settings/VS-notice) these widgets,
trapping the unkeyed ones in Flutter's reconciliation middle and
remounting them — which collapsed the accordion and rebuilt the page.
- ProxyDevice: re-establish the emulator-state bindings on every
(re)connect (_rebindEmulatorState in startProxy). The in-place
"No connection" disconnect detaches them on a reused ProxyDevice, so
reconnecting Virtual Shifting left the UI stuck on "connecting" while
the emulator was actually connected.
- ProxyDevice.disconnect/switchRetrofitMode/handleServices: await the
emulator stops so mDNS/TCP is torn down before reporting disconnected,
and log the previously swallowed detach errors.
- connection.dart: log the discovered device name instead of its runtime
type.
- Bump prop for the awaited mDNS teardown.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
handleServices builds both ProxyBikeDefinition and
FitnessBikeDefinition up front and attaches to the right emulator
based on retrofit mode. ProxyDevice provides advertisementName +
mdnsTxt to ftmsEmulator/_proxyEmulator via the new startServer
parameters. Drops DirconEmulator state mirroring that's no longer
needed. ZwiftClickV2 no longer calls startServer (click-alone
path removed per prop strip). UI consumers route through
ProxyDevice.advertisementName and device.retrofitMode.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Missed in the main refactor commit — live_metrics_section was still
accessing device.emulator.fitnessBike directly. Updated to use the
stable ProxyDevice-level accessor.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ftmsEmulator is now the single emulator for Virtual Shifting traffic
across all trainers and the Click V2. ProxyDevice keeps a per-instance
emulator only for proxy mode (each proxy trainer advertises its own
mDNS identity). ZwiftClickV2 attaches its def to ftmsEmulator directly.
ProxyDevice exposes its own state ValueListenables (isStartedListenable,
isConnectedListenable, retrofitMode, localAddress) that mirror the active
emulator, so UI bindings survive mode swaps. setRetrofitMode and
switchRetrofitMode live on ProxyDevice and migrate the FBD between
proxy/shared emulators.
Removes companionProvider, refreshCompanions, and the click-def
internal seeding in DirconEmulator.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
activeDefinition now returns the CompositeBleDefinition; consumers
that need the FitnessBikeDefinition specifically use the fitnessBike
convenience getter. Bumps prop submodule to pick up the composite
machinery.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Surfaces the new opt-in cadence spike filter in the gear-ratios editor
page. Persists via ShiftingConfig.cadenceFilterEnabled; FitnessBike-
Definition picks it up on next seed.
Fixes the user-reported bugs after the auto-show landed:
1. Auto-opened overlay buttons did nothing
The trainer emulator rebinds a fresh FitnessBikeDefinition each time
its transport restarts (e.g. when a trainer app connects), so the
`def` captured at show() time can already be stale by the time the
user taps + / −. Action handlers now re-resolve through a new
`LiveDefinitionLookup` callback on every dispatch. Navigation's
auto-show and OverlaySettingsSection's manual show both pass a
lookup that reads `device.emulator.activeDefinition` live.
2. Toggling "Show overlay during ride" off didn't close the panel
The vendored macOS plugin's `closeWindow` handler ignored its args
and called `closeWindow(NSApp.mainWindow)`, which either terminated
the app or no-op'd silently. Patched it to honor
`isMainWindow: false` and close the (single) secondary window.
3. "Error in overlay.position.decode: Unexpected character: light"
The vendored macOS plugin packs the Dart entrypoint args in the
order [routeName, theme, argsJson]; the Windows runner uses
`std::map` iteration order. The sub-window was indexing `args[1]`
blindly. Now it scans `args[1..]` for the first JSON-looking
payload with `x`/`y`.
Also:
- TrainerOverlayController.show now takes optional `liveDef`; all
three implementations (desktop, android, ios) thread it through.
- Navigation initState no longer early-`return`s after auto-show, so
the post-frame system-UI / changelog logic still runs.
- All silent `catch (_) {}` blocks in the overlay code now forward
via `recordError(e, s, context: '...')`. New project memory
entry [feedback_record_error.md] documents the rule.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The overlay isolate's overlayMain was annotated @pragma('vm:entry-point')
but the file was not imported anywhere, so Flutter never compiled it into
the binary. Android then logged 'Width is zero' followed by 'Destroying
the overlay window service' because the secondary engine couldn't find
the entry point. Importing it from android_overlay_controller.dart pulls
the file into the build.
Also gate the 'Grant overlay permission' settings tile on the actual
runtime permission state (FlutterOverlayWindow.isPermissionGranted),
hiding it once permission has been granted.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Initialize _enabled from _controller.isShowing.value in initState instead
of reading the persisted getOverlayEnabled() setting, which can be true
from a previous session while no overlay is actually showing on cold start.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Workout: Pause/Resume action is a new InGameAction in the trainer-control
group. It toggles core.workoutRecorder between recording and paused
states without requiring a connected proxy trainer (handled in
base_actions.dart before the proxy dispatch). No-op when the recorder
is idle.
Inline feedback prompt replaces the standalone "Provide Feedback"
button on the proxy device details page. It shows "Does it work?"
with a 3-cell grid (Yes / No difference / No). Yes and No navigate
to TrainerFeedbackPage with the rating pre-filled (TrainerFeedbackPage
now accepts an optional initialRating). "No difference" dismisses
the prompt for the current page session.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pulls page header / reset, intro copy, virtual-shifting mode tile and
its three radio labels, gear count tile and mismatch warning, grade
smoothing tile, gear preset labels, per-gear list section labels and
neutral/current badges, neutral-relative hints, and the shifting
config picker's prompt / manage dialog copy into the ARB.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>