mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 14:07:34 +08:00
Sim: Keep MAVLink parse status persistent, because that is the frickin state machine
This commit is contained in:
@@ -530,6 +530,9 @@ void Simulator::pollForMAVLinkMessages(bool publish)
|
||||
pthread_create(&sender_thread, &sender_thread_attr, Simulator::sending_trampoline, NULL);
|
||||
pthread_attr_destroy(&sender_thread_attr);
|
||||
|
||||
mavlink_status_t udp_status = {};
|
||||
mavlink_status_t serial_status = {};
|
||||
|
||||
// wait for new mavlink messages to arrive
|
||||
while (true) {
|
||||
|
||||
@@ -555,10 +558,9 @@ void Simulator::pollForMAVLinkMessages(bool publish)
|
||||
|
||||
if (len > 0) {
|
||||
mavlink_message_t msg;
|
||||
mavlink_status_t status;
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (mavlink_parse_char(MAVLINK_COMM_0, _buf[i], &msg, &status)) {
|
||||
if (mavlink_parse_char(MAVLINK_COMM_0, _buf[i], &msg, &udp_status)) {
|
||||
// have a message, handle it
|
||||
handle_message(&msg, publish);
|
||||
}
|
||||
@@ -572,10 +574,9 @@ void Simulator::pollForMAVLinkMessages(bool publish)
|
||||
|
||||
if (len > 0) {
|
||||
mavlink_message_t msg;
|
||||
mavlink_status_t status;
|
||||
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (mavlink_parse_char(MAVLINK_COMM_1, serial_buf[i], &msg, &status)) {
|
||||
if (mavlink_parse_char(MAVLINK_COMM_1, serial_buf[i], &msg, &serial_status)) {
|
||||
// have a message, handle it
|
||||
handle_message(&msg, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user