The right puck switches itself off after a minute of not being used.
BikeControl now prevents that on its own, with no button to press. The
sequence lives in prop; this side supplies what only it knows and shows
the rider the one case they can fix.
- the gate reads raw adverts, not the device list: the sibling only has
to be nearby, and a left puck the rider ignored — every left puck in
right-side-only mode — still counts. Discovery is also the retrigger,
since an ignored puck never completes a handshake
- an optional step on the controller card, and a note on the right puck's
own card, when no left puck is in range. An offer, never a blocker
- drops the D-pad line from "use the right side only"
Fixes a related bug: the controller link counted every undone step,
optional or not, so an optional offer alone turned a working controller
amber and held back "Ready to ride". The other two links already
excluded optional steps.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Riders who can't find their controller are told the firmware may be out of
date, but never where to update it — a support report showed someone had no
idea updates run through the Zwift Companion app.
- name the Companion app in every firmware hint and give each one an action
that opens it (scan-time Zwift Ride toast, missing-custom-service alert,
newer-firmware-available alert)
- add a firmware tip with the same link to the onboarding "no controllers
found" state, where riders actually get stuck
- localize the three hints, which were hardcoded English, across all 6 locales
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Picking unlock-with-Zwift on the right puck's card updated the mode but left
the separate right-side entry connected, with no way back to the joined
controller. chooseUnlockWithZwift has never touched useNewUnlockMethod — the
only thing that could turn the split representation off was the "use new
unlock method" switch, and removing that switch (74bb2737) left the setting a
one-way door: chooseRightSideOnly turns it on, nothing turned it back off.
Make the mode own the representation, mirroring chooseRightSideOnly in the
other direction. Unlock-with-Zwift is the both-pucks mode and the unified
controller is both pucks as one device; the split exists so the RIGHT puck
can work alone, unlock free, which is the other mode. So the choice drops
every split instance, clears the scan cache and rescans: the left puck's
advert rebuilds as the unified controller and the right puck's builds nothing,
which is what removes the separate entry. The flag is set before
restoreLeftSides(), which can restart the scan and would otherwise rebuild the
very entry being folded away.
The unified controller's card carries the unlock-mode row now too. It only
ever rendered its unlock warnings, so landing on it would have been a trip
with no route back to right-side-only.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- Remembered controllers offer a single "Forget" instead of two disconnect
variants: there is no link to drop on a device that isn't here.
- Click V2: drop the unlock-mode dropdown and the new-unlock-method toggle.
The explainer stays the one place the mode is chosen — it also does the
follow-on work (un-ignoring the left puck, the right-side-only remap,
cancelling the reset timer) that the bare dropdown never did. "Set up
again" now sits on the right puck's card too.
- Paywall: the Base column reads "Basis"/"Base" rather than "VOLL"/"FULL",
and the one-time Base card moves above the Pro plans so top-to-bottom
matches the comparison table's left-to-right.
- A remembered controller's own settings page shows its button mapping
again. The gate counted live controllers only and KeymapExplanation
looked its filterDevice up in the live list, so the page fell through to
a warning about connection methods, which had nothing to do with it.
- showGoProDialog takes a feature name for its title, so the keymap sync
cloud icon says what it does instead of only "Pro Feature".
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Reported from a device: switching "use new unlock method" on from the
detail page connected only the LEFT puck — the one that needs unlocking
— which is the setup the switch exists to move the rider off.
Two causes, both needed fixing.
Nothing put the rider into a mode. The toggle only flipped the
representation, so with unlock-with-Zwift off and right-side-only off,
the left puck's gate let it connect while the right puck's gate — which
needs one of those two settings — kept it out. Enabling now routes
through chooseRightSideOnly(), so the toggle and the explainer leave
identical state. A rider who deliberately chose unlock-with-Zwift keeps
both sides; this only redirects the default.
And even with the mode set, the right puck could never appear. In the
legacy representation its advert IS scanned and cached, but
fromScanResult returns null for it — the advert is remembered while
resolving to no device, and the scanner then dedupes against that cache
forever. So the switch also restarts the scan, the same thing
restoreLeftSides already needed.
That meant widening what counts as a left puck. In the legacy
representation the unified ZwiftClickV2 IS the left puck, built from its
advert (the right one builds nothing), so ignoring only
ZwiftClickV2LeftSide missed the very case this bug is about.
_ignoreLeftSides now matches ZwiftClickV2 — which covers both classes
and cannot catch the right side, since that extends ZwiftRide — and
restoreLeftSides recognises both label constants, or a puck ignored as
the unified controller could never be restored.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two things.
The unlock step now says when the unlock runs out rather than just
ticking. That makes it the one done step in the chain carrying detail,
deliberately: an unlock expires, so a bare tick would hide that this
comes back tomorrow.
It also has to distinguish two states the device page already drew
apart. BikeControl cannot read a Click V2's lock state back — after an
unlock it knows when the 24 hours ought to run out, but not whether the
unlock took — so SetupStep.uncertain carries that, and the step reads
"Likely unlocked until Friday, 14:30" instead of claiming more than is
known. The date is preformatted at the page: the chain model stays free
of locales and date formats, which is what keeps it testable without a
loaded locale.
ZwiftClickV2 grows an `unlockedUntil` getter rather than the page
reaching into propPrefs. The +24h arithmetic already existed twice in
that file, and widening its `prop` import is its own hazard — that
package exports a `Set` which shadows dart:core's.
Separately, "Unlock again" on the controller details page threw "No
DrawerOverlay found in the widget tree" and did nothing. The page wraps
itself in a DrawerOverlay, but _buildDeviceCard and _buildActions are
methods on the State, so the context they close over is State.context —
which sits ABOVE the overlay its own build creates. Two callers were
hitting it, "Unlock again" and the device-script drawer. Both now build
from the context under the overlay, the pattern onboarding_page already
documents for the same trap.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Three things the first cut of right-side-only got wrong on a real phone.
The left puck was held back by a setting rather than ignored, so it kept
its entry in the device list and the active scan handed it straight back
— an orphan stuck on "connecting" that never could. Filtering it out of
controllerDevices fixed the onboarding list and missed the home chain,
which also draws from offlineControllers. That is the argument against
inventing a second mechanism: ignoring is the one the scan filter, the
remembered-device loader and the device list all already honour, so
using it takes the puck out of every list at once. The dedicated gate
and the isExcludedBySetup filter are gone with it.
Ignoring has to cover the remembered stand-in too, not just a live
device — the chain lists both side by side, and the card in the report
was a stand-in.
It also has to be undoable, or picking "unlock with Zwift" after
right-side-only silently still yields one controller. Removing the
ignored entry is not enough on its own: the scanner dedupes against its
cached advert, and performScanning() returns immediately while a scan is
already running, so the puck only came back on the next launch. It now
restarts the scan.
Both lists showed "Zwift Click" for both pucks: `name` is the raw BLE
advertised name, identical for the two. They use displayName, which
carries the translated left/right suffix.
Finally, the chain sat 24px in from each screen edge on mobile —
Overview's scroll view pads it by 12 and HomePage added 12 of its own,
before each card's padding on top. Desktop keeps its inset; there the
chain sits in a centred max-width box with no padding of its own.
Known sharp edge, left deliberately: un-ignoring the left puck by hand
while still in right-side-only mode brings both up live, and the right
side's handshake cancels the left's restart timer.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The first-run explainer offered "use the left side only" as the way to
avoid Zwift. That is the one puck Zwift actually locks. Picking it left
the rider on the 59-second restart loop, and — because
ZwiftClickV2RightSide.shouldAutoConnect required unlock-with-Zwift — it
also withheld the puck that needs nothing at all. Worse, with Zwift's
built-in keymap binding the right paddle to shiftUp and the left paddle
to shiftDown, the left side alone could only ever shift down. The
genuinely clean setup was reachable only by first choosing the mode it
was meant to replace, then tapping "Use the right side only" on the
right card.
So the option becomes right-side-only: no unlock ever, no restarts, and
the +/B remap the right card already applied so one puck covers both
shift directions. The cons now name the real price — no D-pad, so no
steering and no action bar.
Click V2 state is three modes now, not a boolean, and both connect gates
say so out loud. ClickLogic drives the left side's restart loop from a
single static timer that the right side's handshake cancels, so those
two can never be live together; that invariant used to be implied by one
gate and is now stated in both. Left-restart mode survives as the left
card's existing Select for riders who want the D-pad, just not as a
first-run choice.
The right card's shortcut delegates to the same policy rather than
keeping its own path, so both leave identical state: the left side held
back by the setting instead of pushed onto the ignored-devices list,
which is what lets "Set up again" undo it. Its confirmation copy moves
accordingly, and it stops offering itself once the left side is merely
listed rather than connected.
The remap sits in its own recordError guard. It needs a trainer app to
have been picked, and a mode the rider explicitly chose must not be left
half-written because an optional convenience could not run.
This also turns emulation_zwift_profiles_test's right-side case green:
it had been red since the gate landed, because e74c5920 fixed only the
isPending half of what was holding that side back.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
undelivered shifts
Three things.
The chain's 68 strings existed only in English, so five locales fell back
to it on the app's main screen. Now translated, in each file's own register
— informal second person throughout, matching the copy already around
them. Polish needed a `few` plural category for the step and day counters:
it uses a distinct form for 2-4, so `other` would have rendered "Zostały 2
kroków" instead of "kroki". Two keys written speculatively and never wired
up are dropped rather than sent to five translators.
The checklist's summary row sat inside a Button whose own padding inset it
past the steps below, and the leading glyphs differed in both width (15px
icon, 17px tick) and gap, so matching the outer inset alone would not have
lined them up. One _rowInset / _leadingSize / _leadingGap now governs both,
with the glyphs centred in a box of equal width. Two tests pin the tick and
the label columns, because this is exactly what drifts back unnoticed.
Finally, shifting with a trainer connected but no app holding the bridge
was charged to the daily command budget. Those shifts reach nothing. The
existing exemption only covered the case where the 20-minute
virtual-shifting budget was already ticking — that avoids double-billing —
so it grows a second reason: a command that was never delivered anywhere is
not a command the rider spent.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The wizard's Click V2 auto-prompt marked 'the pair' by uniqueId before the
second side was even discovered, so two concurrent connectionStream runs
each opened the explainer — replaced with a single flag set synchronously
before the await (the row's Setup-needed button remains the way back in).
ZwiftClickV2RightSide.shouldAutoConnect now also requires unlock-with-
Zwift mode: after 'left side only' the right controller is deliberately
unused, and connecting it anyway burned battery and disturbed ClickLogic's
restart cycle. Covers both the auto-connect queue and ClickV2Onboarding's
_connectPending (connect() is a no-op while the gate is false).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Extracts the recovery added for OpenBikeControl (abe636d4) into
PeripheralAdvertisingRecovery and applies it to ZwiftEmulator too.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Rouvy Zwift-BLE advertisement (Zwift fc82 + OBC 128-bit UUID + name
"BikeControl" = ~38 bytes) overflows Android's 31-byte primary packet, so
startAdvertising fails with "Data too large" — Rouvy users on 6.1 can't
connect (the bluetooth_low_energy -> universal_ble migration stopped
splitting service UUIDs into the scan response).
Bump universal_ble to the fork commit that adds
PeripheralAndroidOptions.addServicesInScanResponse, expose it through
PeripheralServer.startAdvertising, and enable it for the Rouvy branch of
the Zwift emulator. Primary packet becomes flags+name (~16B), scan
response carries the UUIDs (~22B); active scanners still see everything.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Intercept InGameAction.frontShift in ZwiftEmulator.sendAction and emit
the SHFT_UP_R|SHFT_UP_L combined buttonMap frame followed by the release
frame — the standard Zwift Ride gesture that triggers a front-chainring
shift in Zwift (SRAM) and a generic controller gesture in other apps.
No app-capability flag, no fallback, no toggle state.
UNVERIFIED: bitmask vs live Zwift SRAM — confirm on-device.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The connection titles ("Connect using Bluetooth", "Connect directly over
Network", "Connect using MyWhoosh Link", ...) were captured once at object
construction in English, so they didn't follow the active locale. Back the
title with a builder (String Function()) and expose it via a getter so it
re-localizes — fixing the English titles in the localized store screenshots.
Updated all 10 subclasses and the fake connection in the bridge-transport test.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The "use the right side only" button remapped the active keymap (+ shifts up,
B shifts down) in memory, but the change was lost on the next launch when the
active profile was a built-in app: those keymaps are code-defined templates
rebuilt on startup, and Settings.setKeyMap only persists key pairs for custom
profiles.
Mirror the button editor: if the active profile isn't already a custom one,
fork it into a "<App> (Copy)" custom profile (via KeymapManager.duplicateSync)
before applying the remap, then persist. The remap now runs before the left
side is disconnected so the forked copy keeps every connected controller's
existing mappings. Adds a regression test covering both the built-in-fork and
already-custom paths, including a reload from storage.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Move the new-unlock-method toggle from showAdditionalInformation (rendered on
both the compact overview card and the detail page) into buildPreferences,
which the controller detail page renders under "Preferences". The toggle now
appears only when the controller entry is opened, not on the overview card.
The Click V2 left side inherits this from ZwiftClickV2; the right side gets its
own override. Unlock-status warnings and the "use right side only" prompt are
unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Make the split left/right controllers available to everyone: replace the
isPro gate in the device factory with a "Use new unlock method" setting
(default on); off falls back to the legacy unified ZwiftClickV2.
- Add the "Use new unlock method" toggle to all three Click V2 settings panels;
flipping it reconnects the Click as the new/legacy representation.
- Fix the "Unlock again" button placement: on narrow side-by-side cards the
action now drops below the status text instead of squeezing it.
- Add "Use the right side only" to the right side when a left side is connected:
ignores the left side (reversible via Ignored Devices) and remaps the active
keymap so + shifts up and B shifts down.
- Localize new strings (de/es/fr/it/pl; en already present) and add
factory/settings unit tests.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The "connected"/"disconnected" activity alerts fired when a trainer app
attaches to one of our emulators now name the app ("Connected to Zwift",
"Disconnected from Zwift") and tag the alert with the transport, so the
activity log shows a WiFi or Bluetooth icon depending on how the app is
connected instead of always Bluetooth.
- AlertNotification gains a connectionType field + a connection() factory
that builds the localized, app-named message and tags the transport.
- All 6 emulator call sites (Zwift BLE, FTMS/Rouvy mDNS) route through it,
passing their own type and core.settings.getTrainerApp()?.name.
- ConnectionMethodType.activityIcon maps network -> wifi, else -> bluetooth;
overview threads connectionType through and uses it for the leading icon.
- Reuse existing connectedTo string; add disconnectedFrom (en/de/es/fr/it/pl).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Zwift and Rouvy drop a wired LAN controller after ~30s without traffic. The Ftms/Rouvy mDNS emulators only emit on a button press, so an idle rider (pedalling, not shifting) goes silent and gets disconnected.
Add a ControllerKeepAlive timer that re-emits the neutral "released" controller frame every 5s while a client is connected, started/stopped from each emulator's isConnected listener. It's the same frame a key-up sends, so it resets the peer's inactivity watchdog without registering a phantom press.
Also drops an earlier keepalive attempt from OpenBikeControlMdnsEmulator — that path speaks the OpenBikeControl protocol, which Zwift doesn't use.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Brings the BLE peripheral-mode migration to universal_ble 2.0.0 into the
WiFi DirCon trainer-discovery branch and bumps universal_ble to the latest
fork commit (ref: changes, 2.0.0).
Conflict resolutions:
- prop submodule: merged the universal_ble 2.0 transporter migration with
the WiFi DirCon TrainerTransport refactor; kept the '0x' short-UUID
normalisation on startAdvertising. Updated BleCharacteristic call sites
to the new 3-arg (uuid, properties, descriptors) constructor.
- obc_ble_emulator.dart: took the PeripheralServer / universal_ble 2.0
write-handler migration; kept the richer Error(button:) context on
sendAction (using _currentDeviceId, the migrated connection tracker).
- unlock.dart: kept the main.dart import.
- pubspec.yaml: kept version 6.0.0+135; took ref: changes for universal_ble.
Pre-existing prop test failures (composite/dircon/fitness serviceUUIDs) are
unchanged by this merge — they fail identically on the pre-merge branch.
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>
isUnlocked / alreadyUnlocked / waiting notifiers + the vendor message
capture move to ZwiftClickV2. ftmsEmulator.setScanResult and
handleServices are no longer called from the click flow. The unlock
page binds to widget.device's notifiers. The prefs-based unlock check
is renamed isPersistedUnlocked to avoid shadowing the new live notifier.
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>
ZwiftClickV2 no longer tracks which emulator hosts its definition or
listens for trainer arrival/departure. Instead:
- ProxyDevice installs an emulator.companionProvider that returns click
defs for any connected ZwiftClickV2 at start time.
- ZwiftClickV2.handleServices builds the def, asks running trainer
emulators to refreshCompanions, or starts the standalone if no
trainer is running.
- ProxyDevice.disconnect migrates the click def back to the standalone
so the Click stays usable after a trainer goes away.
Removes EmulatorRegistry singleton, the rebind handler, and the
sharedTrainerEmulator listener.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ZwiftClickDefinition is now attached to the resolved DirconEmulator at
Click-connect time, regardless of whether the unlock page is open:
- No trainer → ZwiftClickV2.handleServices starts the standalone so
Zwift / Rouvy see BikeControl-as-Click as soon as the user plugs the
Click in.
- Trainer present → click def attaches to the trainer's emulator; the
trainer's existing peripheral advertises both services via the
composite, so Zwift auto-subscribes to the Click service when it
pairs with the trainer.
unlock.dart no longer drives the standalone's lifecycle; it just
listens to the shared unlock notifiers.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- unlock.dart now seeds ftmsEmulator.scanResult before calling
startServer, so the unlock page works when the Click is bound to the
trainer's emulator (and never told the standalone about itself).
Also guards the startServer call behind isStarted.value to avoid
double-starting.
- ZwiftClickV2 attach/detach call sites now wrap their futures in
catchError(recordError, context: '...') per the project's
feedback_record_error rule.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ZwiftClickV2.handleServices / _onSharedTrainerChanged were calling
setScanResult and handleServices on whichever DirconEmulator the
registry resolved to — corrupting the trainer's mDNS advertisement
(which reads scanResult.deviceId + scanResult.services for its TXT
record) and breaking subsequent _createDefinitionAndTransporter
rebuilds whenever a trainer was the resolve target.
The Click's hardware identity already lives inside the
ZwiftClickDefinition (services / device constructor args). Only the
standalone ftmsEmulator should learn the Click as its primary device.
When a smart trainer is connected, the Click V2's ZwiftClickDefinition
attaches to the trainer's emulator so Zwift/Rouvy pair once and see
both services. When no trainer is connected, falls back to the
standalone ftmsEmulator (existing unlock path). Trainer arrival /
departure while the Click is connected rebinds the definition.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ZwiftClickV2 uses this to find the trainer's DirconEmulator at connect
time and attach its ZwiftClickDefinition there, falling back to the
standalone emulator only when no trainer is connected.