Skip to main content

Module subfields

Module subfields 

Source
Expand description

SubField selection — pick the correct semantic interpretation of a field based on the value of another field in the same message.

Reference: guide/fit_binary_learning_notes.md §“SubField 选择算法(重要)”.

Worked example: the event message’s data field (u32) takes on different meanings depending on event_type:

  event_type = 0x10 (rear_gear_change)  →  data is gear_change_data
  event_type = 0x2A (rider_position)    →  data is rider_position
  ...                                   →  data stays as a generic u32

Functions§

select
Inspect a parent field’s sub_fields and return the first one whose condition matches the parent message. Returns None when no SubField applies (in which case the parent field keeps its default semantics).