本文整理汇总了C++中DataFlash_Class::get_log_data方法的典型用法代码示例。如果您正苦于以下问题:C++ DataFlash_Class::get_log_data方法的具体用法?C++ DataFlash_Class::get_log_data怎么用?C++ DataFlash_Class::get_log_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataFlash_Class
的用法示例。
在下文中一共展示了DataFlash_Class::get_log_data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle_log_send_data
/**
trigger sending of log data if there are some pending
*/
bool GCS_MAVLINK::handle_log_send_data(DataFlash_Class &dataflash)
{
int16_t payload_space = comm_get_txspace(chan) - MAVLINK_NUM_NON_PAYLOAD_BYTES;
if (payload_space < MAVLINK_MSG_ID_LOG_DATA_LEN) {
// no space
return false;
}
if (hal.scheduler->millis() - last_heartbeat_time > 3000) {
// give a heartbeat a chance
return false;
}
int16_t ret = 0;
uint32_t len = _log_data_remaining;
uint8_t data[90];
if (len > 90) {
len = 90;
}
ret = dataflash.get_log_data(_log_num_data, _log_data_page, _log_data_offset, len, data);
if (ret < 0) {
// report as EOF on error
ret = 0;
}
if (ret < 90) {
memset(&data[ret], 0, 90-ret);
}
mavlink_msg_log_data_send(chan, _log_num_data, _log_data_offset, ret, data);
_log_data_offset += len;
_log_data_remaining -= len;
if (ret < 90 || _log_data_remaining == 0) {
_log_sending = false;
}
return true;
}
示例2: handle_log_send_data
/**
trigger sending of log data if there are some pending
*/
bool GCS_MAVLINK::handle_log_send_data(DataFlash_Class &dataflash)
{
if (!HAVE_PAYLOAD_SPACE(chan, LOG_DATA)) {
// no space
return false;
}
if (AP_HAL::millis() - last_heartbeat_time > 3000) {
// give a heartbeat a chance
return false;
}
int16_t ret = 0;
uint32_t len = _log_data_remaining;
mavlink_log_data_t packet;
if (len > 90) {
len = 90;
}
ret = dataflash.get_log_data(_log_num_data, _log_data_page, _log_data_offset, len, packet.data);
if (ret < 0) {
// report as EOF on error
ret = 0;
}
if (ret < 90) {
memset(&packet.data[ret], 0, 90-ret);
}
packet.ofs = _log_data_offset;
packet.id = _log_num_data;
packet.count = ret;
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_DATA, (const char *)&packet,
MAVLINK_MSG_ID_LOG_DATA_MIN_LEN,
MAVLINK_MSG_ID_LOG_DATA_LEN,
MAVLINK_MSG_ID_LOG_DATA_CRC);
_log_data_offset += len;
_log_data_remaining -= len;
if (ret < 90 || _log_data_remaining == 0) {
_log_sending = false;
}
return true;
}