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>
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>
The keymap ('app') and the trainer app ('trainer_app') are independent
prefs. When the keymap one is missing while a trainer app is selected,
actionHandler.supportedApp stays null — every button press then threw
"Null check operator used on a null value" and the device registered no
buttons at all, so the SRAM edit screen came up empty.
- RemoteActions/DesktopActions/AndroidActions no longer dereference
supportedApp (or getKeyPair) with `!`; they return the same
noKeymapSet / noActionAssigned Error BaseActions already produces.
- Fall back to the selected trainer app when the keymap pref can't be
resolved (initializeActions, Settings.init, deleteCustomAppProfile).
- BaseDevice.getOrAddButton keeps the created button in availableButtons
even without a keymap, so the device still renders its buttons.
- The OBC BLE/mDNS emulators evaluated connectedApp.value! before the
null guard that follows, making the guard dead code — reordered.
- handleButtonsClicked now forwards through recordError, which is why
this never showed up in crash reporting.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Riders keep writing in about the wrong gear number in MyWhoosh and others.
The answer has always been the gear overlay, and the one-time toast that said
so was the wrong messenger: it fired once, mid-connect, and scrolled away
before anyone read it.
Move the offer onto the trainer card, where it stays until it is acted on.
- New SetupStepId.trainerGearOverlay, last in the trainer checklist and
offered only once the bridge is up, the trainer app runs on this device
(Target.thisDevice), the platform can draw an overlay, and a Virtual
Shifting session is producing a gear to draw. Ticks off — and leaves the
card — as soon as the overlay is enabled.
- Its button reads "Enable overlay" and deep-links to the trainer detail
page's Overlay section, which owns the permission and PiP flows.
- SetupStep gains an `optional` flag so an offer stays an offer: it does not
colour the card, does not count towards the banner's steps, and never
stops "Ready to ride". Marked OPTIONAL on its own line, via the tag the
card header already wore (now a shared OptionalTag).
- Drops OverlayConnectHint, its ProxyDevice listener and the
overlay_connect_hint_shown flag. The two l10n strings it owned are reused
as the step's hint and button label in all six locales.
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>
Nearly every MyWhoosh/Rouvy bridge rider pairs the virtual trainer, then
writes support asking why the gear shown in the trainer app doesn't sync
— trainer apps can't display BikeControl's virtual gears. Surface the
canonical answer (the gear overlay) exactly once, at the moment the
question would otherwise arise: the first time a trainer app connects to
the virtual trainer while the overlay is off.
- OverlayConnectHint fires an AlertNotification (toast + activity-log
entry) whose button deep-links to the trainer detail page, scrolled to
the Overlay section (new revealOverlaySection param).
- Hooked on ProxyDevice's device-level isConnected wrapper so it
survives emulator/mode swaps; gated on an active VS session
(fitnessBike != null), overlay disabled, and a persisted one-time
flag (overlay_connect_hint_shown).
- New l10n strings in all six locales.
Co-Authored-By: Claude Fable 5 <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>
performScanning() arms a periodic 3s gamepad poll; stop() cancelled the BLE
scan and the wifi trainer scanner but not that. Worse, stop() clears
isScanning, so the next performScanning() sails past its early-return guard
and assigns a second periodic timer over the top of the first — one leaked
per stop/rescan cycle, and restoreLeftSides plus both Click V2 unlock-mode
choices all do exactly that.
Cancel it in stop(), symmetric with the method that arms it.
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>
Three chain-card changes. They arrived as one commit because the first
was still uncommitted when the others landed on top of it.
**A Click V2 waiting for its unlock-mode choice.** Reported edge case: a
brand-new install where the wizard was skipped or finished on another
controller leaves clickV2OnboardingDone false, so a Click V2 switched on
afterwards is discovered, in range, healthy — and deliberately not
connected. The chain had no way to say "we are choosing not to connect
this", fell back to presence, and told the rider their controller had
never been paired and should be brought back into range, about a device
switched on beside them.
That step now REPLACES the checklist rather than joining it. Putting it
first would have left the false steps sitting below it; every other step
is unknowable until the device is allowed to connect. Once the choice is
made the normal checklist returns. The card's action reads "Set up" and
opens the explainer, since the choice is what releases the controller
into the connect queue.
**Warning glyphs beside the status.** A flat battery, a pending firmware
update or a signal about to drop are qualifiers on "Connected" — it
works, but not for much longer, or not well — and the card said nothing.
They show only when something is actually wrong, so a glyph appearing
means something. Thresholds are the device page's own (20%, -70 dBm)
rather than new ones, so the two screens cannot disagree about "low".
**The bridging pitch on an unused trainer.** A trainer that is here but
has never been connected now shows what bridging it would buy instead of
an empty card; that list already existed on the device page, and this is
exactly the rider who has not seen it. Dropped once bridged, where live
numbers are the useful content, and dropped for one that broke
mid-session, where it would read as if nothing were wrong.
Not covered by tests: which badges get chosen, and when the feature list
appears — both are private methods on _HomePageState, which has no
widget test to hang a case on.
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>
An accessory's settings page had nothing to say about what the device can
actually do: its actions live on a controller's buttons, and the page that
would have shown them (button mapping) is hidden here because a fan has no
buttons of its own.
It now lists them — the six Headwind speed/HR actions, the four incline
ones — straight off the device via a new BaseDevice.assignableActions, and
hands over to the controller that can carry them: the connected one, since
that is the one a rider can test a mapping on right away. With no
controller around it says so rather than offering a dead link.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Every Headwind or Climb the scanner finds is connected automatically,
including one that isn't the rider's — a neighbour's fan through a wall.
Getting rid of it means putting it on the ignore list, and the only route
onto that list is "Disconnect & forget" on a device's settings page. But
accessories are excluded from controllerDevices, which is the only device
list the setup chain renders, so such a device appeared nowhere at all and
could not be dismissed.
They now get their own quiet section below the chain: one card per
accessory, no checklist, opening the settings page that already carries
the forget action. That page in turn drops the button-mapping section and
"Reset to defaults" for an accessory — a fan has no buttons, so both were
empty promises — and titles itself "Device Settings" instead of
"Controller Settings". A Headwind also stops presenting itself with the
default gamepad icon.
Auto-connecting to any accessory in range is left as it is: the rider
ignores the neighbour's fan once, and it stays gone.
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>
Watts and cadence come off the trainer, not off the bridge, so they are
just as real — and just as worth showing — before BikeControl starts
bridging it. Two gates were hiding them: the readout itself required
isBridged, and the builder only passed metrics through on a fully ready
link, so relaxing either alone would have changed nothing.
The readout moves onto ProxyDevice as liveReadout rather than being
reimplemented on the home page, because the home page's version only read
fitnessBike — in proxy mode the numbers live on ProxyBikeDefinition, so it
would have shown an empty line exactly where a proxied trainer's values
belong. It now mirrors showMetaInformation: proxy definition first, then
the fitness bike, plus the gear or ERG target when BikeControl computes
one.
Showing the numbers exposed a contradiction in the status line: "Not
connected · 250 W · 90 rpm" asks the rider to resolve something the app
should have resolved for them. A trainer whose Bluetooth link is up but
which isn't bridged now reads "Connected", which is true, and the Connect
action carries the rest. "Not connected" is left to mean a trainer that
genuinely isn't there. The bridged states keep onboarding's wording.
The metrics ticker was gated on isBridged too, so the numbers would have
been frozen in precisely the state this change exists to show.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
"Waiting for MyWhoosh to pick it up" opened the trainer picker, whose
bridged branch renders "Trainer connected" — an answer to a question the
rider wasn't asking. The trainer IS connected; the app hasn't picked the
bridge up. The connection step's pairing block is extracted as
OnboardingPairAsTrainerCard — bridge entry, the power/controllable/cadence
slot rows, the warning about pairing the bare trainer — and both the
wizard and the sheet render it. Routing is on the card's active step, so
the three trainer problems get three answers: not bridged opens the
picker, bridged-but-unclaimed opens the pairing instructions, ready opens
troubleshooting.
Auditing the rest against onboarding turned up two more.
isBridged now lives on ProxyDevice as a single getter that onboarding and
the home screen both call, so the definition cannot drift again. Three
places here were still keyed on the Bluetooth link rather than the bridge:
choosing which trainer the card shows, gating the metrics ticker, and
deciding whether the trial's virtual-shifting meter applies. Each was
measuring or picking the wrong thing.
The worse one: a remembered trainer mapped to amber, and on an optional
card amber blocks "Ready to ride" — so a trainer that was not in the room
would have held the banner hostage. Because the card inferred "bridged"
back out of its own status instead of asking the device, it would also
have claimed to be bridged and offered Edit. An uncommitted trainer now
rests at off, and bridged comes from the device.
Verified equivalent while in there: connectedTrainerConnections.isNotEmpty
is exactly onboarding's .any((c) => c.isConnected.value), since the list is
already filtered, and appHoldsBridge is the same isConnectedListenable the
onboarding summary uses to choose between "Bridged" and "Waiting for {app}".
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 home screen is being rebuilt as the setup chain: one card per link,
each carrying the same status light and the same tick-off checklist. This
lands the parts that decide *what* the screen says, ahead of the widgets
that draw it.
chain_state.dart is pure data with no Flutter, no BLE and no `core`, and
steps carry ids rather than sentences, so "which step is done or pending"
is unit-testable without a locale or a radio. chain_builder.dart turns a
plain ChainInputs snapshot into cards; deriveBanner reads the cards back,
so the banner can never contradict what is under it.
Remembered devices fix a real gap: a controller that is switched off or
out of range disappeared from the app entirely, so riders could not see
what they owned or edit a mapping away from the bike. We now store the
advertisement a device connected with — exactly the fields
BluetoothDevice.fromScanResult reads — and rebuild it into a real device
object of the right subclass, kept out of the connect queue. Trainers are
remembered as data only, since their card needs a name, not a contour.
Tracking which ids connected this session is what separates a red "lost
connection" from an amber "out of range"; a fresh launch with the
controller in a drawer must not paint the screen red.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Running BikeControl on a second device made the one next to the trainer app
unreachable. Each install now advertises its own identity.
Because that identity changes, an app that was already paired will ask to
pair once more.
Co-Authored-By: Claude Opus 5 <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>
The SRAM rear derailleur drops idle connections after ~3 minutes.
Reverse-engineering the official SRAM AXS app revealed it requests
CONNECTION_PRIORITY_HIGH immediately after connecting. This fix adds
the same priority request, subscribes to the gear-state characteristic
for additional notification traffic, and reads it every 60s as a
fallback keepalive.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The advertised serial was sliced off the raw device id. WiFi trainer ids
are `dircon://<name>` and `dircon://` is itself exactly nine characters —
the same length as the reference serial the slice was sized against — so
every WiFi-proxied trainer advertised the identical, information-free
`serial-number=dircon://`.
Strip any `scheme://` prefix before slicing, and pad short ids instead of
letting substring throw. BLE device ids keep their existing derivation,
covered by a regression test.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Fixes five review findings on the Click V2 onboarding branch:
1. "Set up again" now performs the same ClickLogic side effects
(setupHandshake / resetTimer) the connect-time flow does for an
already-connected left side, and refreshes UnlockToggle's state on
return instead of leaving it stale.
2. ClickV2OnboardingCard gained an onCompleted callback (wired to
DevicePage.onUpdate) so the device list refreshes even when no
connectionStream event fires after the onboarding page closes.
3. A connect failure in ClickV2Onboarding._connectPending() now also
surfaces a user-visible AlertNotification, not just a logged error.
New l10n key clickV2Onboarding_connectFailed added in all six
languages.
4. ClickV2OnboardingPage now builds its staggered-entrance
CurvedAnimations once in initState instead of one per row per
build, fixing an unbounded status-listener leak on _rows.
5. pendingDevices is intentionally left ungated on isPending (gating
it would break _connectPending, which needs it precisely because
isPending already flipped false) but is now correctly documented,
and _connectPending skips devices the battery saver suppressed via
the new Connection.isAutoReconnectSuppressed.
Also drops the redundant flutter/widgets.dart import from
click_v2_onboarding.dart (shadcn_flutter re-exports PageView/
PageController).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011GcRAUvS3gwjmfi2qJipcc
From the +20 field log the pod replied 04 38 0f 4b to 04 11 15 and
09 01 00 00 to 01 (on 6e400003); add both as candidates (7 frames now).
Log every inbound frame and every outbound write verbatim while probing
(WHEELTOP PROBE rx/tx <slot> <hex>) so the support log is a full
transcript, not just unparseable frames. Suppress the connect-failure
give-up guidance while the experiment runs — the 147-timeout reconnect
churn is expected and is NOT rear-derailleur contention (fixed the
misleading 'claimed by the derailleur' alert the user saw with the RD
off).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The +15 field log showed the probe auto-arming and the pod RESPONDING to
each candidate — but the response logged as empty. Cause: we subscribed
to 6e400002 only, so a reply on the second Nordic-UART slot (6e400003)
was never delivered, and the empty frames were artifacts on the write
slot. Subscribe to every notify/indicate characteristic (pressed-set
dedup absorbs any duplicated button event), and log each unexpected frame
with its slot and byte length so an empty artifact is distinguishable
from a real reply. Next field log will show which slot the pod answers on
and the actual bytes.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The probe was only reachable via a device-page toggle, but TX pods drop
so fast the user can never open the page — the one field tester couldn't
enable it. Arm the probe automatically on the first 0x10 status frame
(the moment that proves a pod needs the reply), default on; the toggle
becomes an opt-out. Move probe creation out of handleServices into a
lazy arm on that frame.
When the experiment is off, count a connect that dies within
quickDropThreshold (5s) as a failure via the same backoff, so the
endless connect/connected/disconnected loop gives up after 3 and shows
the guidance instead of spamming forever. While the experiment is on the
device opts out (keepsReconnectingWhileDropping) so the loop keeps
cycling for the probe. Extract _engageBackoff shared by both paths.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
TX pods drop the link after three unanswered 1 Hz status frames; the
derailleur's reply is unknown and undocumented anywhere public. When the
user opts in (device page > Preferences), each reconnect cycle writes
the next reply candidate (type-echo, ack, 3-byte XOR shapes, bare ACK —
on 6e400003 first, then other writable NUS slots) once after subscribe
and again per status frame, and logs the connection lifetime per
candidate. A lifetime past 5 s marks the likely answer; unexpected
frames are logged loudly as potential pod responses. Worst case per
attempt is the disconnect that already happens.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
TX firmware frames carry a sender type byte and an additive checksum
(04 type code sum), unlike the OX 3-byte XOR shape — both validate now
and route through the same opcode switch. The 1 Hz TX status frame 0x10
and any unknown/invalid frame log once per connection instead of
flooding the support log.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Once a Wheeltop shifter gives up (backoff), each 90s cooldown round was
still emitting a "Connecting to:" toast and a "...disconnected" WARNING +
OS notification, defeating the "one clear alert, then quiet" goal. Add
Connection._isInBackoff and gate both the auto-connect queue's notify
toast and the connection-state listener's disconnected toast/OS
notification on it.
The cooldown timer scheduled by _recordConnectFailure was anonymous and
shared _suppressedAutoReconnect with the battery saver, so a stale timer
from an earlier round could lift a later (even unrelated) suppression
early. Track timers per device id, cancel-and-replace on each new round,
cancel on Retry, and cancel all on disconnectAll().
Also correct a comment in _connect's catch block that described only the
fake platform's failure ordering (throw before the disconnected event) —
real Android delivers the event before or after the exception depending
on the device, and both orderings depend on _connectionSubscriptions
staying attached.
Extend the "successful connect resets the failure counter" integration
test to also cover Retry clearing the counter and the give-up alert
firing only once per session across a second suppression round.
Post-threshold rounds no longer toast, so tests now count attempts via a
new FakePeripheral.connectAttempts platform-level counter where needed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds per-device consecutive-failure tracking, suppression with a cooldown,
and a one-shot guidance alert (log-only on later rounds) when a device's
maxAutoConnectAttempts is exhausted. Also fixes Connection._connect's
failure path: it was cancelling the per-device connectionStream
subscription synchronously on a failed connect, before the platform's
disconnected event (delivered a radio-roundtrip later) could reach it —
silently breaking the rediscovery-driven retry loop for any failed first
connect, not just backoff-tracked devices.
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>
Gesture engine: a repeat of the SAME lever inside the 90ms combo window
can't be a combo, so flush the pending click instead of overwriting it —
rapid double-taps now deliver both shifts. The old press-swallowing was
accidentally doing multishift suppression, so bring back the explicit §7
guard (forward the first two rapid triggers, drop the 3rd+ within 350ms)
that the discrete-click rework removed.
Test fixes for the rest of the failing suite:
- review_prompt_service_test: derive seeds from sessionThreshold /
snoozeSessions instead of hardcoding the old threshold of 3
- controller_settings_signal_change_test: persist a session key and run
handleServices so the device is bonded and the Restore branch renders
- emulated SRAM AXS profile: send real 1-byte 0xFF edges (0x01 is now
filtered as a read-response echo), expect the generic 'SRAM Button'
name, and wait for the app's trigger subscription before tapping so
the press can't land mid-connect and get wiped by the gesture reset
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>