Fixing bugs - #65
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.