diff options
author | Anton Babushkin <anton.babushkin@me.com> | 2014-06-29 14:10:04 +0200 |
---|---|---|
committer | Anton Babushkin <anton.babushkin@me.com> | 2014-06-29 14:10:04 +0200 |
commit | 8a442c2125502ef4b8c33bea85ac4a5d0c82906e (patch) | |
tree | 4cdeffcbf1d86d1b93d3a1d74533621d19b1ab90 /src/modules/mavlink/mavlink_messages.cpp | |
parent | 0bf9c2a9b262a4c8569031f0f7e9ded432d2d4b3 (diff) | |
parent | 5db51bd704a4493fe3a53010b84bede19c980dfc (diff) | |
download | px4-firmware-8a442c2125502ef4b8c33bea85ac4a5d0c82906e.tar.gz px4-firmware-8a442c2125502ef4b8c33bea85ac4a5d0c82906e.tar.bz2 px4-firmware-8a442c2125502ef4b8c33bea85ac4a5d0c82906e.zip |
Merge branch 'navigator_rewrite' into navigator_rewrite_drton
Diffstat (limited to 'src/modules/mavlink/mavlink_messages.cpp')
-rw-r--r-- | src/modules/mavlink/mavlink_messages.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/modules/mavlink/mavlink_messages.cpp b/src/modules/mavlink/mavlink_messages.cpp index fef7a5c89..884713479 100644 --- a/src/modules/mavlink/mavlink_messages.cpp +++ b/src/modules/mavlink/mavlink_messages.cpp @@ -254,8 +254,15 @@ protected: struct position_setpoint_triplet_s pos_sp_triplet; /* always send the heartbeat, independent of the update status of the topics */ - (void)status_sub->update(&status); - (void)pos_sp_triplet_sub->update(&pos_sp_triplet); + if (!status_sub->update(&status)) { + /* 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_base_mode = 0; |