forked from Archive/PX4-Autopilot
microRTPS: transport: make seq_number non-atomic
This commit is contained in:
parent
08e72b29b3
commit
3db9307dfb
|
@ -232,13 +232,12 @@ ssize_t Transport_node::write(const uint8_t topic_ID, char buffer[], size_t leng
|
|||
}
|
||||
|
||||
static struct Header header = {{'>', '>', '>'}, 0u, 0u, 0u, 0u, 0u, 0u};
|
||||
static uint8_t seq = 0;
|
||||
|
||||
// [>,>,>,topic_ID,seq,payload_length,CRCHigh,CRCLow,payload_start, ... ,payload_end]
|
||||
uint16_t crc = crc16((uint8_t *)&buffer[sizeof(header)], length);
|
||||
|
||||
header.topic_ID = topic_ID;
|
||||
header.seq = seq++;
|
||||
header.seq = _seq_number++;
|
||||
header.payload_len_h = (length >> 8) & 0xff;
|
||||
header.payload_len_l = length & 0xff;
|
||||
header.crc_h = (crc >> 8) & 0xff;
|
||||
|
|
|
@ -78,6 +78,8 @@ protected:
|
|||
protected:
|
||||
uint32_t rx_buff_pos;
|
||||
char rx_buffer[BUFFER_SIZE] = {};
|
||||
bool debug = false;
|
||||
uint8_t _seq_number{0};
|
||||
|
||||
private:
|
||||
struct __attribute__((packed)) Header {
|
||||
|
|
Loading…
Reference in New Issue