Skip to content

Python: never write the FIT invalid value as a measurement. - #46

Open
sanderroosendaal wants to merge 1 commit into
mainfrom
python/invalid-values
Open

sanderroosendaal wants to merge 1 commit into
mainfrom
python/invalid-values

Conversation

@sanderroosendaal

Copy link
Copy Markdown
Collaborator

Implements the Python side of #38 (spec §7.2).

  • encode clips a value that would encode to the base type's invalid value (255, 65535, 32767, and the 32-bit equivalents) to the next valid one. Values beyond the type limit still raise CodecError.
  • decode returns None for the invalid value, so the reader treats it as missing.
  • StrokeWork at 65535 now encodes as 65534; a raw 65535 in a file reads as missing.

Note for #34: AverageBoatSpeed at its maximum of 655.35 m/s encodes to 65535 at scale 100 and is clipped to 65534.

🤖 Generated with Claude Code

encode clips a value that would encode to the base type's invalid value to the
next valid one, and decode returns None for the invalid value. Values beyond
the type limit still raise.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.

2 participants