Skip to content

CrossTrainerData: 2-byte flags field causes 1-byte offset in all data fields #71

Description

@pafernanr

RealtimeData._deserialize_asdict always reads a 2-byte (16-bit) flags field. For Cross Trainer Data (0x2ACE), this causes a 1-byte offset in all subsequent data fields, producing corrupt values for distance, time, energy, and other sensors.

Reading 3 bytes instead of 2 fixes the issue. Other implementations also use 3 bytes for Cross Trainer flags — see qdomyos-zwift (index += 3 for Cross Trainer vs index += 2 for other machine types).

We could not find an explicit "3-octet flags" statement in the FTMS service specification (Section 4.5.1.1, Table 4.6 shows 16 flag bits), but the fix works on a real BH cross trainer device. Other machine types (Treadmill, Indoor Bike, Rower) correctly use 16-bit flags.

Fix available at pafernanr/python-pyftms:upstream-fix — would you like me to open a PR?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions