AP_Terrain: use HAVE_PAYLOAD_SPACE()

This commit is contained in:
Andrew Tridgell 2016-04-05 14:11:13 +10:00
parent ec62d8f4ca
commit 40d1a23a13

View File

@ -55,7 +55,7 @@ bool AP_Terrain::request_missing(mavlink_channel_t chan, struct grid_cache &gcac
return false; return false;
} }
if (comm_get_txspace(chan) < MAVLINK_NUM_NON_PAYLOAD_BYTES + MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN) { if (!HAVE_PAYLOAD_SPACE(chan, TERRAIN_REQUEST)) {
// not enough buffer space // not enough buffer space
return false; return false;
} }
@ -232,7 +232,7 @@ void AP_Terrain::send_terrain_report(mavlink_channel_t chan, const Location &loc
} }
current_height += home_terrain_height - terrain_height; current_height += home_terrain_height - terrain_height;
if (comm_get_txspace(chan) >= MAVLINK_NUM_NON_PAYLOAD_BYTES + MAVLINK_MSG_ID_TERRAIN_REPORT_LEN) { if (HAVE_PAYLOAD_SPACE(chan, TERRAIN_REPORT)) {
mavlink_msg_terrain_report_send(chan, loc.lat, loc.lng, spacing, mavlink_msg_terrain_report_send(chan, loc.lat, loc.lng, spacing,
terrain_height, current_height, terrain_height, current_height,
pending, loaded); pending, loaded);