Skip to content

Commit 04eeb44

Browse files
fix crc calculation
1 parent 89b59a5 commit 04eeb44

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

AGENTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
Read `README.md` for general information about the library, and `CONTRIBUTING.md` for development-related notes.
44
Read all README files in all subdirectories except for `lib/`.
55

6+
The applicable specifications can be found here:
7+
- **Cyphal v1**: https://github.com/OpenCyphal/specification
8+
- **UAVCAN v0**, aka DroneCAN: https://dronecan.github.io/Specification/4.1_CAN_bus_transport_layer
9+
610
Project layout:
711

812
- `libcanard`: the library itself; the shippable code.

libcanard/canard.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,8 +1366,8 @@ static void rx_session_accept(rx_session_t* const ses, const canard_us_t ts_fram
13661366
// The CRC initial state is constant for v1, data-type-dependent for v0; this is managed outside of this scope.
13671367
const canard_bytes_t crc_input =
13681368
((canard_kind_version(sub->kind) == 0) && fr->start)
1369-
? fr->payload
1370-
: (canard_bytes_t){ .size = fr->payload.size - 2, .data = ((byte_t*)fr->payload.data) + 2 };
1369+
? (canard_bytes_t){ .size = fr->payload.size - 2, .data = ((byte_t*)fr->payload.data) + 2 }
1370+
: fr->payload;
13711371
slot->crc = crc_add(slot->crc, crc_input.size, crc_input.data);
13721372
}
13731373
if (fr->end) {

0 commit comments

Comments
 (0)