请求协助:基于11字节数据识别BLE车轮与曲柄传感器数据
Let's break down your raw hex data step by step, using the BLE Cycling Speed and Cadence (CSC) Measurement characteristic rules. Your sample data is:0x03 0x6D 0x01 0x00 0x00 0xFC 0x7E 0x2C 0x01 0xF8 0x7E
1. Decode the Flags Byte
The first byte (0x03) is the flag that tells us what data is included. Converting to 8-bit binary gives 00000011, where each bit has a specific meaning:
- Bit 0 (LSB): 1 → Wheel revolution data is present
- Bit 1: 1 → Crank revolution data is present
- Bits 2-7: 0 → All revolution counts and event times should use 16-bit formatting (though your data length suggests a 32-bit wheel count—we’ll address that quirk below)
2. Parse Wheel Revolution Data
Your data includes 6 bytes for wheel data (likely a sensor implementation oddity, even though the flag says 16-bit):
- Cumulative Wheel Revolutions: The first 4 bytes (
0x6D 0x01 0x00 0x00) are little-endian, so reverse the byte order to get0x0000016D. Converting to decimal gives 365 total wheel revolutions. - Last Wheel Event Time: Next 2 bytes (
0xFC 0x7E) → little-endian is0x7EFC. Each unit equals 1/1024 seconds, so calculate the time:32508 / 1024 ≈ 31.75 seconds since the last wheel revolution
3. Parse Crank Revolution Data
The final 4 bytes follow the 16-bit format as indicated by the flag:
- Cumulative Crank Revolutions: 2 bytes (
0x2C 0x01) → little-endian is0x012C, which converts to 300 total crank revolutions. - Last Crank Event Time: 2 bytes (
0xF8 0x7E) → little-endian is0x7EF8. Calculate the time:32504 / 1024 ≈ 31.74 seconds since the last crank revolution
Quick Note on the Data Length Discrepancy
Normally, a flag of 0x03 would result in 9 total bytes (1 flag + 2 wheel count + 2 wheel time + 2 crank count + 2 crank time). Your 11-byte data suggests the sensor is sending a 32-bit wheel count despite the flag indicating 16-bit. This is a common edge case with some BLE sensors—you can confirm the correct format by checking if the wheel count increments consistently across multiple samples using the 32-bit value.
内容的提问来源于stack exchange,提问作者Santosh Krishnan

