Skip to content

Gate KICKR gear and inclination commands on device ACK - #4917

Draft
cagnulein wants to merge 1 commit into
masterfrom
codex/kickr-command-gate
Draft

Gate KICKR gear and inclination commands on device ACK#4917
cagnulein wants to merge 1 commit into
masterfrom
codex/kickr-command-gate

Conversation

@cagnulein

Copy link
Copy Markdown
Owner

Summary

  • Serialize dynamic KICKR gear and inclination commands behind the trainer's real device response.
  • Coalesce pending gear commands so only the latest wheel-circumference value is sent.
  • Coalesce pending inclination commands so only the latest grade value is sent.
  • Keep gear and inclination pending values independent while sharing one output gate.
  • Log the ACK value, per-command response latency, and cumulative average latency.

Motivation

The BLE characteristicWritten callback only confirms that the local BLE stack accepted the write. KICKR logs show the trainer later sends a command response on the Wahoo characteristic:

01 46 01 00 <grade-lo> <grade-hi>
01 48 01 00 <circumference-lo> <circumference-hi>

A captured log measured 16 setSimGrade responses with an average latency of approximately 537 ms (min 278 ms, max 841 ms). Sending commands on local write completion can therefore queue intermediate grades/gears inside the trainer.

Implementation

  • Dynamic setSimGrade and setWheelCircumference writes wait for the matching Wahoo response opcode.
  • A single command is allowed in flight.
  • New pending values replace only the previous pending value from the same command group.
  • A local timeout no longer opens the KICKR command gate; the next command waits for the actual ACK.
  • Runtime logs report the decoded response grade/circumference and moving average latency.

Validation

  • git diff --check
  • Reviewed against real KICKR debug logs and measured ACK latency.
  • Qt build not run in this environment because qmake is unavailable.
  • Hardware validation still needed with a KICKR v5, especially rapid Zwift gear changes and rapid grade changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant