Skip to content

Commit 30f2064

Browse files
fixes
1 parent 04eeb44 commit 30f2064

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

libcanard/canard.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,8 +1333,8 @@ static void rx_session_complete(rx_session_t* const ses, const canard_us_t ts_fr
13331333
CANARD_ASSERT(!fr->start && fr->end);
13341334
CANARD_ASSERT((slot->transfer_id == fr->transfer_id) && (slot->iface_index == ses->iface_index));
13351335
ses->slots[fr->priority] = NULL; // Slot memory ownership transferred to the application, or destroyed.
1336-
const bool v1 = canard_kind_version(sub->kind) == 1;
1337-
const bool crc_ref = v1 ? CRC_RESIDUE : (uint16_t)(slot->payload[0] | (((unsigned)slot->payload[1]) << 8U));
1336+
const bool v1 = canard_kind_version(sub->kind) == 1;
1337+
const uint16_t crc_ref = v1 ? CRC_RESIDUE : (uint16_t)(slot->payload[0] | (((unsigned)slot->payload[1]) << 8U));
13381338
CANARD_ASSERT(v1 || (sub->extent >= 2)); // In v0, the CRC size is included in the extent.
13391339
if (slot->crc == crc_ref) {
13401340
const size_t size = smaller(slot->total_size - 2, sub->extent - (v1 ? 0 : 2));
@@ -1459,7 +1459,7 @@ static bool rx_session_update(canard_subscription_t* const sub,
14591459
{
14601460
CANARD_ASSERT((sub != NULL) && (frame != NULL) && (frame->payload.data != NULL) && (ts >= 0));
14611461
CANARD_ASSERT(frame->end || (frame->payload.size >= 7));
1462-
CANARD_ASSERT(!frame->start || (frame->toggle != canard_kind_version(sub->kind)));
1462+
CANARD_ASSERT(!frame->start || (frame->toggle == canard_kind_version(sub->kind)));
14631463
CANARD_ASSERT((frame->dst == CANARD_NODE_ID_ANONYMOUS) || (frame->dst == sub->owner->node_id));
14641464

14651465
// Only start frames may create new states.

libcanard/canard.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ typedef struct canard_subscription_vtable_t canard_subscription_vtable_t;
231231
struct canard_subscription_vtable_t
232232
{
233233
/// A new message is received on a subscription.
234-
/// The handler takes ownership of the payload; it must free it after use using the rx_payload memory resource.
234+
/// For the payload ownership notes refer to canard_payload_t.
235+
/// The timestamp is the arrival timestamp of the first frame of the transfer.
235236
void (*on_message)(canard_subscription_t* self,
236237
canard_us_t timestamp,
237238
canard_prio_t priority,
@@ -251,7 +252,7 @@ struct canard_subscription_t
251252
canard_us_t transfer_id_timeout;
252253
uint32_t port_id; ///< Represents subjects, services, and legacy message- and service type IDs.
253254
size_t extent; ///< Must not be altered after initialization!
254-
uint16_t crc_seed; ///< For v0 this is set explicitly, for v1 this is always 0xFFFF.
255+
uint16_t crc_seed; ///< For v0 this is set at subscription time, for v1 this is always 0xFFFF.
255256
canard_kind_t kind;
256257

257258
canard_filter_t filter; ///< Precomputed for quick acceptance filter configuration.

0 commit comments

Comments
 (0)