本文整理汇总了C++中DataFlash_Class::should_log方法的典型用法代码示例。如果您正苦于以下问题:C++ DataFlash_Class::should_log方法的具体用法?C++ DataFlash_Class::should_log怎么用?C++ DataFlash_Class::should_log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataFlash_Class
的用法示例。
在下文中一共展示了DataFlash_Class::should_log方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: should_df_log
bool AP_GPS_Backend::should_df_log() const
{
DataFlash_Class *instance = DataFlash_Class::instance();
if (instance == nullptr) {
return false;
}
if (gps._log_gps_bit == (uint32_t)-1) {
return false;
}
if (!instance->should_log(gps._log_gps_bit)) {
return false;
}
return true;
}
示例2:
// read - read the voltage and current for all instances
void
AP_BattMonitor::read()
{
for (uint8_t i=0; i<_num_instances; i++) {
if (drivers[i] != nullptr && _params[i].type() != AP_BattMonitor_Params::BattMonitor_TYPE_NONE) {
drivers[i]->read();
drivers[i]->update_resistance_estimate();
}
}
DataFlash_Class *df = DataFlash_Class::instance();
if (df->should_log(_log_battery_bit)) {
df->Log_Write_Current();
df->Log_Write_Power();
}
check_failsafes();
}
示例3: Log_Write_Optflow
void OpticalFlow::Log_Write_Optflow()
{
DataFlash_Class *instance = DataFlash_Class::instance();
if (instance == nullptr) {
return;
}
if (_log_bit != (uint32_t)-1 &&
!instance->should_log(_log_bit)) {
return;
}
struct log_Optflow pkt = {
LOG_PACKET_HEADER_INIT(LOG_OPTFLOW_MSG),
time_us : AP_HAL::micros64(),
surface_quality : _state.surface_quality,
flow_x : _state.flowRate.x,
flow_y : _state.flowRate.y,
body_x : _state.bodyRate.x,
body_y : _state.bodyRate.y
};
instance->WriteBlock(&pkt, sizeof(pkt));
}
示例4:
bool AP_InertialSensor::BatchSampler::should_log(uint8_t _instance, IMU_SENSOR_TYPE _type)
{
if (_sensor_mask == 0) {
return false;
}
if (!initialised) {
return false;
}
if (_instance != instance) {
return false;
}
if (_type != type) {
return false;
}
if (data_write_offset >= _required_count) {
return false;
}
DataFlash_Class *dataflash = DataFlash_Class::instance();
#define MASK_LOG_ANY 0xFFFF
if (!dataflash->should_log(MASK_LOG_ANY)) {
return false;
}
return true;
}