Merge pull request #1081 from PX4/hb_fix2

mavlink: init structs for HEARTBEAT if uORB topic copy failed
This commit is contained in:
Lorenz Meier 2014-06-29 11:48:44 +02:00
commit aa7781d09b
1 changed files with 9 additions and 2 deletions

View File

@ -227,8 +227,15 @@ protected:
struct position_setpoint_triplet_s pos_sp_triplet; struct position_setpoint_triplet_s pos_sp_triplet;
/* always send the heartbeat, independent of the update status of the topics */ /* always send the heartbeat, independent of the update status of the topics */
(void)status_sub->update(&status); if (!status_sub->update(&status)) {
(void)pos_sp_triplet_sub->update(&pos_sp_triplet); /* if topic update failed fill it with defaults */
memset(&status, 0, sizeof(status));
}
if (!pos_sp_triplet_sub->update(&pos_sp_triplet)) {
/* if topic update failed fill it with defaults */
memset(&pos_sp_triplet, 0, sizeof(pos_sp_triplet));
}
uint8_t mavlink_state = 0; uint8_t mavlink_state = 0;
uint8_t mavlink_base_mode = 0; uint8_t mavlink_base_mode = 0;