Hotfix: Only orb_copy items in mavlink app if the timestamp changed

This commit is contained in:
Lorenz Meier
2014-06-23 13:51:05 +02:00
parent 87857cdd48
commit a9653fa10d
@@ -44,6 +44,8 @@
#include <uORB/uORB.h> #include <uORB/uORB.h>
#include <stdio.h> #include <stdio.h>
#include <systemlib/err.h>
#include "mavlink_orb_subscription.h" #include "mavlink_orb_subscription.h"
MavlinkOrbSubscription::MavlinkOrbSubscription(const orb_id_t topic) : MavlinkOrbSubscription::MavlinkOrbSubscription(const orb_id_t topic) :
@@ -77,21 +79,23 @@ MavlinkOrbSubscription::update(uint64_t *time, void* data)
time_topic = 0; time_topic = 0;
} }
if (orb_copy(_topic, _fd, data)) { if (time_topic != *time) {
/* error copying topic data */
memset(data, 0, _topic->o_size);
return false;
} else { if (orb_copy(_topic, _fd, data)) {
/* data copied successfully */ /* error copying topic data */
_published = true; memset(data, 0, _topic->o_size);
if (time_topic != *time) { //warnx("err copy, fd: %d, obj: %s, size: %d", _fd, _topic->o_name, _topic->o_size);
*time = time_topic; return false;
return true;
} else { } else {
return false; /* data copied successfully */
_published = true;
*time = time_topic;
return true;
} }
} else {
return false;
} }
} }