GCS_MAVLink: coverity scan - computed value overwritten without use for SITL

- when building for SITL we should just skip the num_sends work instead of overwriting the value
This commit is contained in:
Tom Pittenger 2016-07-05 13:09:51 -07:00
parent bd8debdf8b
commit a74e86c234

View File

@ -151,21 +151,22 @@ void GCS_MAVLINK::handle_log_send(DataFlash_Class &dataflash)
if (!_log_sending) {
return;
}
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
// assume USB speeds in SITL for the purposes of log download
const uint8_t num_sends = 40;
#else
uint8_t num_sends = 1;
if (chan == MAVLINK_COMM_0 && hal.gpio->usb_connected()) {
// when on USB we can send a lot more data
num_sends = 40;
} else if (have_flow_control()) {
#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX
#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX
num_sends = 80;
#else
#else
num_sends = 10;
#endif
#endif
}
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
// assume USB speeds in SITL for the purposes of log download
num_sends = 40;
#endif
for (uint8_t i=0; i<num_sends; i++) {