Skip to content

Fixing bugs - #65

Merged
nilsauf merged 10 commits into
mainfrom
fixing-bugs
Aug 6, 2026
Merged

Fixing bugs#65
nilsauf merged 10 commits into
mainfrom
fixing-bugs

Conversation

@nilsauf

@nilsauf nilsauf commented Aug 6, 2026

Copy link
Copy Markdown
Owner

No description provided.

nilsauf added 10 commits August 6, 2026 21:35
Bit positions were mapped with pos/7 and pos%7, misreading every flag at
bit position >= 7 (e.g. treadmill Heart Rate at bit 8, Fitness Machine
Feature bits 7-16). Map with pos/8 and pos%8 in both the byte[] and
ReadOnlySpan<byte> overloads.

Replace the tests that encoded the 7-bit packing with standard bit
numbering, and add an integration test proving a treadmill frame with
Heart Rate present (bit 8) parses correctly.
UInt24 is not a primitive type, so ExecuteWithValue<T> rejected it before
writing anything to the device. Handle UInt24 explicitly in GetBytes(),
writing the 3-byte little-endian (LSO...MSO) encoding required by the
FTMS spec (op code 0x0C, UINT24 meters, resolution 1).
ControlExtensions.GetBytes() re-derived the 3-byte little-endian
(LSO...MSO) split that UInt24 already owns, duplicating the byte-order
logic and reaching into another type's data. UInt24 now exposes the
encoding directly and the control path delegates to it.
Decode Target Incline as SINT16 instead of UINT16 so negative (downhill)
values are read correctly, and decode Targeted Distance as the full UINT24
using the UInt24 byte constructor instead of truncating to 2 octets via
ToUInt16.
Execute awaited a matching response with no bound; a server that never
indicates a response caused Execute to hang forever. Add an injectable
response timeout (default 5s) applied via the Rx Timeout operator after
FirstAsync, scheduled on the injected scheduler so tests drive it with a
TestScheduler. Timeout surfaces as ControlRequestException, keeping the
public contract unchanged.
@nilsauf
nilsauf merged commit 5470b36 into main Aug 6, 2026
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