diff --git a/fitparser/header.go b/fitparser/header.go index 3cf4fb7..f2824a7 100644 --- a/fitparser/header.go +++ b/fitparser/header.go @@ -54,10 +54,12 @@ func ParseHeader(data []byte) (*Header, error) { if h.Size == HeaderWithCRCSize { h.CRC = binary.LittleEndian.Uint16(data[12:14]) - // Validate header CRC - calculatedCRC := CalculateCRC(data[0:12]) - if calculatedCRC != h.CRC { - return nil, fmt.Errorf("header CRC mismatch: got 0x%04X, expected 0x%04X", h.CRC, calculatedCRC) + // Validate header CRC (skip if CRC is 0x0000, which means "no validation") + if h.CRC != 0x0000 { + calculatedCRC := CalculateCRC(data[0:12]) + if calculatedCRC != h.CRC { + return nil, fmt.Errorf("header CRC mismatch: got 0x%04X, expected 0x%04X", h.CRC, calculatedCRC) + } } }