Commit Graph

108 Commits

Author SHA1 Message Date
Jonas Bark
8a2d83139b feat(trainer): cycle the bridge connection when the control protocol changes
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>
2026-08-20 15:33:57 +02:00
Jonas Bark
0191fcc990 feat(trainer): control-protocol selector in VS options, persisted per trainer
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 13:38:32 +02:00
Jonas Bark
510a85ac20 Merge branch '6.4' of github.com:OpenBikeControl/bikecontrol into 6.4 2026-08-16 14:35:31 +02:00
Jonas Bark
4df41bdece fix(rouvy): keep the bridge connection stable 2026-08-16 14:13:09 +02:00
Jonas Bark
f0d2d1253b feat(home): make the gear overlay an optional checklist step, not a toast
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>
2026-08-16 13:03:56 +02:00
Jonas Bark
55d35b0add fix(rouvy): restore Virtual Shifting on the bridged trainer 2026-08-16 12:44:23 +02:00
Jonas Bark
27462b1c58 fix(rouvy): adjust the bridge's advertised services 2026-08-16 12:44:22 +02:00
Jonas Bark
9ade43d060 feat: label WiFi vs Bluetooth trainer entries
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>
2026-08-15 08:43:26 +02:00
Jonas Bark
f4c8aba982 feat: overlay hint when trainer app first connects
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>
2026-08-14 14:06:24 +02:00
Jonas Bark
c66cac4591 feat(home): the Click V2 setup step, status warning glyphs, and an unused trainer's pitch
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>
2026-08-11 19:41:37 +02:00
Jonas Bark
70f0532da1 feat(home): show the trainer's live values whenever it is connected
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>
2026-08-11 13:50:26 +02:00
Jonas Bark
16ad75336d fix(home): pair-as-trainer instructions, and finish the onboarding audit
"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>
2026-08-11 13:26:14 +02:00
Jonas Bark
24f5da596d fix(home): device-testing fixes, and drop the VS takeover dialog
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>
2026-08-11 12:02:24 +02:00
jonas.bark@gmx.de
599e2e644d fix: let trainer apps on the network find BikeControl again
Retires the Windows IPv6 workaround instructions along with it — they no
longer apply.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 14:33:34 +02:00
Jonas Bark
2e63bf580a fix(dircon): derive a real mDNS serial-number for WiFi trainers
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>
2026-08-07 11:30:12 +02:00
Jonas Bark
8634db7dbc refactor(bluetooth): lift shouldAutoConnect onto BaseDevice 2026-08-03 09:15:13 +02:00
Jonas Bark
db5cc74a12 fix(erg,sram): shared ERG stepping with boundary guards; scope §7 guard to shifting-enabled; coalesce iOS echo presses
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>
2026-07-09 17:51:35 +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
ff57b005d5 feat(shifting): show 2×N gear position when the front derailleur is active
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>
2026-06-26 15:02:40 +02:00
Jonas Bark
1549c4c73c feat(proxy): show transport icon to disambiguate same-named trainers
When the same trainer is discovered over both WiFi (DirCon) and Bluetooth,
two proxy entries appear with an identical name (both already Beta). Add a
small WiFi/Bluetooth icon left of the Beta pill, shown only when a same-named
sibling exists, so the duplicates can be told apart.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25 09:39:38 +02:00
Jonas Bark
42c246799d Merge feat/screen-recording into 6.2: screen recording action (Android + macOS) + changelog 2026-06-24 20:21:47 +02:00
Jonas Bark
e0cdd71e28 feat: route frontShift to FitnessBikeDefinition (direct path)
Add frontShift case to handleTrainerAction: ERG mode returns Ignored,
disabled returns Ignored, sim mode toggles front ring and returns
Success with large/small ring message. Add 3 ARB keys (6 locales) and
4 TDD tests in the consolidated test file.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 15:52:00 +02:00
Jonas Bark
e8d2599809 feat: seed chainring config into FitnessBikeDefinition
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 15:46:25 +02:00
Jonas Bark
843f798537 cleanup 2026-06-18 16:30:01 +02:00
Jonas Bark
b201cb3e53 Generate localized store screenshots (golden_screenshot 11)
- 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>
2026-06-18 11:22:56 +02:00
Jonas Bark
fb84ffbcf1 Merge remote-tracking branch 'origin/6.0.0' into custom-mdns-responder
# Conflicts:
#	lib/bluetooth/devices/openbikecontrol/obc_mdns_emulator.dart
2026-06-11 21:56:19 +02:00
Jonas Bark
736d0d515e Route ProxyDevice detach errors through recordError
The _detachLogged teardown helper now reports failures via the app's
recordError (console in debug + crash persistence), matching the
convention used elsewhere (e.g. ZwiftClickV2.detach), instead of a bare
debugPrint.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 15:27:44 +02:00
Jonas Bark
120f80b9bb cleanup 2026-06-10 15:19:35 +02:00
Jonas Bark
60817dabee Smart Trainer card: stable keys, reconnect rebinding, awaited mDNS stop, No-connection UX
- 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>
2026-06-10 14:06:12 +02:00
Jonas Bark
f8b9e6db62 fix 2026-06-10 11:15:45 +02:00
Jonas Bark
e79edf4809 UI adjustments 2026-06-10 08:53:30 +02:00
Jonas Bark
51747eb4f4 feat: ProxyDevice.wifi — bridge DirCon trainers through TrainerTransport seams
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 07:10:40 +02:00
Jonas Bark
a68b68a1b4 fix button mapping popup 2026-06-01 11:53:55 +02:00
Jonas Bark
bd7cb80014 feat: reload emulator advertisement when trainer app changes
- Settings.trainerAppListenable fires from setTrainerApp.
- Connection.initialize listens and restarts ftmsEmulator + each
  ProxyDevice's _proxyEmulator so the new advertisement name (e.g.
  "Zwift Hub" for Rouvy) appears on the wire without reconnect.
- ProxyDevice.restartProxyEmulator no-ops in VS mode (ftmsEmulator
  handles itself).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-31 18:33:33 +02:00
Jonas Bark
218a7e2e98 zwift adjustments 2026-05-21 22:01:14 +02:00
Jonas Bark
cfadaff94e adjustments 2026-05-21 12:27:37 +02:00
Jonas Bark
82519b8497 refactor: delegate advertisementName back to DirconEmulator
ProxyDevice sets trainerApp / isTrial / deviceName callbacks on the
emulator instead of computing the name itself. ProxyDevice.advertisementName
now reads through emulator.advertisementName. startServer no longer
takes the name as a parameter.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 00:16:31 +02:00
Jonas Bark
0a76de870a refactor: ProxyDevice owns trainer identity and def construction
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>
2026-05-21 00:08:33 +02:00
Jonas Bark
823a323218 fix(proxy): respect saved retrofit mode at connect time
handleServices was always driving _proxyEmulator.startServer, even
when the saved mode for the trainer was wifi or bluetooth. The
per-instance proxy emulator now only starts in proxy mode; for VS
modes the FBD attaches to the shared ftmsEmulator, mirroring what
switchRetrofitMode does for mid-session swaps.
2026-05-20 23:37:40 +02:00
Jonas Bark
9fb8d63f9a refactor: collapse to a single shared DirconEmulator for VS mode
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>
2026-05-20 23:05:40 +02:00
Jonas Bark
822c929b09 refactor: drop EmulatorRegistry, use DirconEmulator.companionProvider
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>
2026-05-20 22:36:54 +02:00
Jonas Bark
9c272f698b feat: ProxyDevice registers its emulator in EmulatorRegistry
Lets companion devices (Zwift Click V2) attach their definitions to
the trainer's emulator instead of using a separate one. The registry
slot is reclaimed by ProxyDevice's emulator on construction and
released on teardown.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 18:06:50 +02:00
Jonas Bark
a795b3c681 refactor: route FBD-specific callers through emulator.fitnessBike
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>
2026-05-20 17:55:53 +02:00
Jonas Bark
57295d0e66 config: surface cadenceFilterEnabled on ShiftingConfig
Default off; forwarded to FitnessBikeDefinition in the proxy seed path.
The UI affordance is intentionally not added here — observe in-the-wild
behaviour before exposing a knob most users won't need.
2026-05-13 08:35:32 +02:00
Jonas Bark
4cf347580d warn when connecting smart trainer 2026-05-07 15:57:02 +02:00
Jonas Bark
eea1644df9 Treat FE-C-only trainers as smart trainers + bump prop submodule
Widens ProxyDevice._isSmartTrainer to also return true when the scan
result advertises the ANT+ FE-C-over-BLE service (6e40fec1) so a
FE-C-only trainer like the ThinkRider X2Max routes into Virtual
Shifting via defaultRetrofitMode instead of falling through to Proxy.

Bumps the prop submodule which now carries the FE-C frame builder,
the FE-C write path in FitnessBikeDefinition, and CPS-derived cadence
for the sim recompute when no FTMS Indoor Bike Data is available.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 08:45:58 +02:00
Jonas Bark
b87056c20b support imperial / metric 2026-05-05 14:15:27 +02:00
Jonas Bark
e0e4494d02 fix grade logic 2026-05-04 12:02:33 +02:00
Jonas Bark
6712a5803c fix reported issues 2026-04-28 10:38:04 +02:00
Jonas Bark
43cf9482bd UI fixes 2026-04-28 08:39:48 +02:00