Browse Source

GCS_MAVLink: correct gcs_out_of_space_to_send methodname

the "_count" is incorrect given the method which this calles on the link object
apm_2208
Peter Barker 3 years ago committed by Peter Barker
parent
commit
38119e17c7
  1. 2
      libraries/GCS_MAVLink/GCS.cpp
  2. 6
      libraries/GCS_MAVLink/GCS.h
  3. 2
      libraries/GCS_MAVLink/GCS_MAVLink.cpp

2
libraries/GCS_MAVLink/GCS.cpp

@ -348,7 +348,7 @@ bool GCS::out_of_time() const
return true; return true;
} }
void gcs_out_of_space_to_send_count(mavlink_channel_t chan) void gcs_out_of_space_to_send(mavlink_channel_t chan)
{ {
gcs().chan(chan)->out_of_space_to_send(); gcs().chan(chan)->out_of_space_to_send();
} }

6
libraries/GCS_MAVLink/GCS.h

@ -39,7 +39,7 @@
// macros used to determine if a message will fit in the space available. // macros used to determine if a message will fit in the space available.
void gcs_out_of_space_to_send_count(mavlink_channel_t chan); void gcs_out_of_space_to_send(mavlink_channel_t chan);
// important note: despite the names, these messages do NOT check to // important note: despite the names, these messages do NOT check to
// see if the payload will fit in the buffer. They check to see if // see if the payload will fit in the buffer. They check to see if
@ -56,14 +56,14 @@ void gcs_out_of_space_to_send_count(mavlink_channel_t chan);
// anywhere in the code to determine if the mavlink message with ID id // anywhere in the code to determine if the mavlink message with ID id
// can currently fit in the output of _chan. Note the use of the "," // can currently fit in the output of _chan. Note the use of the ","
// operator here to increment a counter. // operator here to increment a counter.
#define HAVE_PAYLOAD_SPACE(_chan, id) (comm_get_txspace(_chan) >= PAYLOAD_SIZE(_chan, id) ? true : (gcs_out_of_space_to_send_count(_chan), false)) #define HAVE_PAYLOAD_SPACE(_chan, id) (comm_get_txspace(_chan) >= PAYLOAD_SIZE(_chan, id) ? true : (gcs_out_of_space_to_send(_chan), false))
// CHECK_PAYLOAD_SIZE - macro which may only be used within a // CHECK_PAYLOAD_SIZE - macro which may only be used within a
// GCS_MAVLink object's methods. It inserts code which will // GCS_MAVLink object's methods. It inserts code which will
// immediately return false from the current function if there is no // immediately return false from the current function if there is no
// room to fit the mavlink message with id id on the current object's // room to fit the mavlink message with id id on the current object's
// output // output
#define CHECK_PAYLOAD_SIZE(id) if (txspace() < unsigned(packet_overhead()+MAVLINK_MSG_ID_ ## id ## _LEN)) { gcs_out_of_space_to_send_count(chan); return false; } #define CHECK_PAYLOAD_SIZE(id) if (txspace() < unsigned(packet_overhead()+MAVLINK_MSG_ID_ ## id ## _LEN)) { gcs_out_of_space_to_send(chan); return false; }
// CHECK_PAYLOAD_SIZE2 - macro which inserts code which will // CHECK_PAYLOAD_SIZE2 - macro which inserts code which will
// immediately return false from the current function if there is no // immediately return false from the current function if there is no

2
libraries/GCS_MAVLink/GCS_MAVLink.cpp

@ -127,7 +127,7 @@ void comm_send_lock(mavlink_channel_t chan_m, uint16_t size)
chan_locks[chan].take_blocking(); chan_locks[chan].take_blocking();
if (mavlink_comm_port[chan]->txspace() < size) { if (mavlink_comm_port[chan]->txspace() < size) {
chan_discard[chan] = true; chan_discard[chan] = true;
gcs_out_of_space_to_send_count(chan_m); gcs_out_of_space_to_send(chan_m);
} }
} }

Loading…
Cancel
Save