feat: adopt ELRS USB CRSF frame format, add skeleton modules
Switch CRC from CCITT (0x07) to DVB-S2 (0xD5) to match ELRS. Adopt ELRS USB frame format: [addr][length][type][payload][crc]. Update frame type constants to match current ELRS protocol values. New skeleton modules (stub implementations with TODO comments): - crsf_telemetry.h/.c: telemetry decoders (GPS, battery, link..) - crsf_stream.h/.c: incremental streaming frame reader - crsf_param.h/.c: parameter protocol (read/write/set_power) Retained old frame format as *_legacy functions for backward compatibility with existing telemetry tool and tests. Add cel_serial_find_elrs_port() and cel_serial_open_probe() stubs to serial module for port auto-detection and baud probing.
This commit is contained in:
@@ -131,19 +131,22 @@ Added unit tests for empty, single-byte, and known-value cases.
|
||||
|
||||
```text
|
||||
celrs/
|
||||
crsf.h / crsf.c CRSF protocol: CRC8, frame parse/build
|
||||
serial.h / serial.c Serial port abstraction (Win/POSIX stubs)
|
||||
logger.h / logger.c Level-filtering logger
|
||||
log_write.h/.c stdout log sink
|
||||
crsf.h / crsf.c CRSF protocol: CRC8/DVB-S2, frame build/parse
|
||||
crsf_telemetry.h/.c Telemetry frame decoders (GPS, battery, link..)
|
||||
crsf_stream.h/.c Incremental streaming frame reader
|
||||
crsf_param.h/.c Parameter protocol (read/write/set_power)
|
||||
serial.h / serial.c Serial port abstraction (Win/POSIX)
|
||||
logger.h / logger.c Level-filtering logger
|
||||
log_write.h/.c stdout log sink
|
||||
tools/
|
||||
telemetry.c Telemetry read tool
|
||||
telemetry.c Telemetry read tool
|
||||
tests/
|
||||
test_crsf.c CRSF CRC, parse, build tests
|
||||
test_serial.c Serial open/close/stub tests
|
||||
test_logger.c Logger level-filtering tests
|
||||
test_crsf.c CRSF CRC, parse, build tests
|
||||
test_serial.c Serial open/close/stub tests
|
||||
test_logger.c Logger level-filtering tests
|
||||
deps/
|
||||
FindUnity.cmake Fetches Unity v2.6.1 via ZIP
|
||||
FindCMock.cmake Fetches CMock v2.6.0 via ZIP
|
||||
FindUnity.cmake Fetches Unity v2.6.1 via ZIP
|
||||
FindCMock.cmake Fetches CMock v2.6.0 via ZIP
|
||||
```
|
||||
|
||||
## TDD Workflow
|
||||
@@ -239,9 +242,8 @@ The project supports Windows, Linux, macOS, Emscripten, and Android via
|
||||
|
||||
CRSF is the Crossfire Serial Protocol used by ELRS. Key points:
|
||||
|
||||
- Frame header is always `0xC8`
|
||||
- CRC8-CCITT with polynomial `0x07`, init `0x00`
|
||||
- CRC is computed over: destination + source + type + size + payload
|
||||
- Standard baud rate for ELRS CRSF is 400000 bps
|
||||
- TX modules expose CRSF over USB serial (appears as COM port on Windows,
|
||||
/dev/ttyUSB* on Linux)
|
||||
- Frame format: [addr][length][type][payload...][crc]
|
||||
- CRC8/DVB-S2 with polynomial `0xD5`, init `0x00`
|
||||
- CRC is computed over: type + payload
|
||||
- Address byte varies: `0xC8` (host), `0xEE` (module), `0xEF` (lua)
|
||||
- Standard baud rate for ELRS CRSF is 400000 bps (probe 921600 first)
|
||||
|
||||
Reference in New Issue
Block a user