Add Svelte GUI, FIT encoder and README
Standalone binary embeds the frontend, avoiding the dev-server dependency that made the window fail to load. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -236,6 +236,30 @@ fn transmit(_app: &AppHandle, target: ControlTarget) {
|
||||
tracing::debug!(?target, "control target (no trainer attached — mock backend)");
|
||||
}
|
||||
|
||||
/// Load the bundled GPX and start riding it. Development only — see the
|
||||
/// `BIKECONTROL_DEMO` check in `lib.rs`.
|
||||
pub fn start_demo(app: &AppHandle) {
|
||||
let Some(sample) = crate::samples::all().into_iter().find(|s| s.is_gpx) else {
|
||||
return;
|
||||
};
|
||||
let profile = match bikecontrol_core::gpx::import(
|
||||
&sample.text,
|
||||
&sample.name,
|
||||
&bikecontrol_core::gpx::SmoothingConfig::default(),
|
||||
) {
|
||||
Ok(p) => p,
|
||||
Err(e) => {
|
||||
tracing::warn!(%e, "demo profile failed to import");
|
||||
return;
|
||||
}
|
||||
};
|
||||
let (view, geom) = crate::profile_view::build(&profile, "demo");
|
||||
let state = app.state::<AppState>();
|
||||
let mut inner = state.lock();
|
||||
inner.set_profile(profile, view, geom);
|
||||
inner.inputs.status = RideStatus::Running;
|
||||
}
|
||||
|
||||
/// SAF-2: never leave the trainer loaded. Called on ride end and on app exit.
|
||||
pub fn release_trainer(app: &AppHandle) {
|
||||
let state = app.state::<AppState>();
|
||||
|
||||
Reference in New Issue
Block a user