Files
swiftcontrol/lib/utils/gear_readout.dart
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

17 lines
677 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/// Formats the compact gear readout shown in the proxy card, desktop overlay,
/// PiP, and live-gear surfaces.
///
/// Without front shift it's the familiar rear `gear/total` (e.g. `14/25`).
/// With the virtual front derailleur on, it switches to head-unit-style
/// position notation `front×rear` — small ring is position 1, large ring is
/// position 2 (e.g. `2×14`), matching how Garmin/Wahoo show Di2/AXS gearing.
String formatGearReadout({
required int currentGear,
required int maxGear,
required bool frontShiftEnabled,
required bool largeRing,
}) {
if (!frontShiftEnabled) return '$currentGear/$maxGear';
return '${largeRing ? 2 : 1}×$currentGear';
}