Skip to content

feat: Configurable ERG mode resistance smoothing #149

@MaximumTrainer

Description

@MaximumTrainer

Summary

Add a configurable rolling-average smoothing applied to ERG setpoint commands sent to the trainer, reducing the jarring resistance steps that occur when transitioning between intervals with very different power targets.

Motivation

A hard step from, say, 150 W to 350 W causes a mechanical jolt and a brief period where the trainer briefly over- or under-shoots target. Ramping the resistance command over a user-configurable duration (e.g. 5 s) creates a smooth transition that is physically easier and reduces drivetrain stress.

Acceptance Criteria

  • A ERG transition ramp duration setting (0 s = off, 2 s, 5 s, 10 s; default: 5 s) is present in the Trainer preferences tab
  • When the ramp is active, setLoad() is called on every timer tick during the ramp period with linearly-interpolated wattage between old and new targets
  • Ramp is applied only at interval transitions, not during steady-state ERG adjustments
  • The ramp is skipped for rest-to-work transitions shorter than the ramp duration (i.e. ramp duration is clamped to the interval duration)
  • The real-time power target display reflects the ramping target so the rider can see progress
  • Setting ramp to 0 s disables the feature and reverts to the original step-change behaviour
  • Unit tests cover linear interpolation correctness, clamping, and the 0-second passthrough case

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions