Virtual gearing, trainer-speed blend, and cadence decode
Gears are expressed as an offset to the commanded gradient, leaving the physics on the route's true gradient so shifting changes effort, not speed. Neutral gear commands exactly the route gradient, so an un-shifted ride is unchanged. Cadence is not in FTMS on this trainer but is on its Zwift channel, decoded against captured frames. The undeclared FTMS trailing bytes were ruled out: wheel RPM restated at a fixed 73.8x speed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+11
-1
@@ -9,6 +9,7 @@ use serde::Serialize;
|
||||
|
||||
use crate::devices::DeviceInfo;
|
||||
use crate::profile_view::ProfileView;
|
||||
use crate::trainer::TrainerStatus;
|
||||
|
||||
/// `RideSnapshot`, pushed at [`crate::engine::TICK_HZ`].
|
||||
pub const RIDE_SNAPSHOT: &str = "ride://snapshot";
|
||||
@@ -24,6 +25,11 @@ pub const DEVICE_CONNECTION: &str = "devices://connection";
|
||||
pub const APP_NOTICE: &str = "app://notice";
|
||||
/// Acknowledgement that an input registered, so the UI can flash (FR-9.9).
|
||||
pub const INPUT_ACK: &str = "app://input-ack";
|
||||
/// A Zwift Click button edge. The webview routes these to the same intents as
|
||||
/// the equivalent keypress, so controller and keyboard cannot drift apart.
|
||||
pub const CONTROLLER_INPUT: &str = "controller://input";
|
||||
/// Controller link state and battery.
|
||||
pub const CONTROLLER_STATUS: &str = "controller://status";
|
||||
|
||||
/// Ride lifecycle, mirroring `bikecontrol_core::session::RideStatus` but
|
||||
/// serialisable across the IPC boundary.
|
||||
@@ -52,8 +58,12 @@ pub struct RideState {
|
||||
pub lap: u32,
|
||||
pub laps: Vec<LapSummary>,
|
||||
pub profile: Option<ProfileView>,
|
||||
/// Which backend is driving the ride — `"mock"` until `crates/ble` lands.
|
||||
/// Which backend is driving the ride: `"ftms"` (the real trainer) or
|
||||
/// `"mock"` (the synthetic rider, only reachable via `BIKECONTROL_DEMO`).
|
||||
pub source: &'static str,
|
||||
/// Trainer link, so the ride screen can say when the numbers stopped being
|
||||
/// real rather than quietly showing zeros (FR-1.8, FR-9.3).
|
||||
pub trainer: TrainerStatus,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Serialize)]
|
||||
|
||||
Reference in New Issue
Block a user