forked from Archive/PX4-Autopilot
events interface: chance uORB 'sequence' to 'event_sequence'
The reason is that sequence is an IDL reserved keyword, which results on failure when parsing with FastRTPSGen.
This commit is contained in:
parent
5a370bf575
commit
e39e3b3418
|
@ -2,10 +2,9 @@
|
|||
uint64 timestamp # time since system start (microseconds)
|
||||
|
||||
uint32 id # Event ID
|
||||
uint16 sequence # Sequence number
|
||||
uint16 event_sequence # Event sequence number
|
||||
uint8[25] arguments # (optional) arguments, depend on event id
|
||||
|
||||
uint8 log_levels # Log levels: 4 bits MSB: internal, 4 bits LSB: external
|
||||
|
||||
uint8 ORB_QUEUE_LENGTH = 8
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ void send(EventType &event)
|
|||
// - we need to ensure ordering of the sequence numbers: the sequence we set here
|
||||
// has to be the one published next.
|
||||
pthread_mutex_lock(&publish_event_mutex);
|
||||
event.sequence = ++event_sequence; // Set the sequence here so we're able to detect uORB queue overflows
|
||||
event.event_sequence = ++event_sequence; // Set the sequence here so we're able to detect uORB queue overflows
|
||||
|
||||
if (orb_event_pub != nullptr) {
|
||||
orb_publish(ORB_ID(event), orb_event_pub, &event);
|
||||
|
|
|
@ -947,9 +947,9 @@ bool Logger::handle_event_updates(uint32_t &total_bytes)
|
|||
} else {
|
||||
// adjust sequence number
|
||||
uint16_t updated_sequence;
|
||||
memcpy(&updated_sequence, &orb_event->sequence, sizeof(updated_sequence));
|
||||
memcpy(&updated_sequence, &orb_event->event_sequence, sizeof(updated_sequence));
|
||||
updated_sequence -= _event_sequence_offset;
|
||||
memcpy(&orb_event->sequence, &updated_sequence, sizeof(updated_sequence));
|
||||
memcpy(&orb_event->event_sequence, &updated_sequence, sizeof(updated_sequence));
|
||||
|
||||
size_t msg_size = sizeof(ulog_message_data_header_s) + _event_subscription.get_topic()->o_size_no_padding;
|
||||
uint16_t write_msg_size = static_cast<uint16_t>(msg_size - ULOG_MSG_HEADER_LEN);
|
||||
|
@ -974,9 +974,9 @@ bool Logger::handle_event_updates(uint32_t &total_bytes)
|
|||
// mission log: only warnings or higher
|
||||
if (events::internalLogLevel(orb_event->log_levels) <= events::LogLevelInternal::Warning) {
|
||||
if (_writer.is_started(LogType::Mission)) {
|
||||
memcpy(&updated_sequence, &orb_event->sequence, sizeof(updated_sequence));
|
||||
memcpy(&updated_sequence, &orb_event->event_sequence, sizeof(updated_sequence));
|
||||
updated_sequence -= _event_sequence_offset_mission;
|
||||
memcpy(&orb_event->sequence, &updated_sequence, sizeof(updated_sequence));
|
||||
memcpy(&orb_event->event_sequence, &updated_sequence, sizeof(updated_sequence));
|
||||
|
||||
if (write_message(LogType::Mission, _msg_buffer, msg_size)) {
|
||||
data_written = true;
|
||||
|
|
|
@ -2473,7 +2473,7 @@ Mavlink::task_main(int argc, char *argv[])
|
|||
events::Event e;
|
||||
e.id = orb_event.id;
|
||||
e.timestamp_ms = orb_event.timestamp / 1000;
|
||||
e.sequence = orb_event.sequence - event_sequence_offset;
|
||||
e.sequence = orb_event.event_sequence - event_sequence_offset;
|
||||
e.log_levels = orb_event.log_levels;
|
||||
static_assert(sizeof(e.arguments) == sizeof(orb_event.arguments),
|
||||
"uorb message event: arguments size mismatch");
|
||||
|
|
Loading…
Reference in New Issue