DataFlash: add a should_log method

This commit is contained in:
Peter Barker 2017-06-14 22:45:54 +10:00 committed by Francisco Ferreira
parent 001d3a7118
commit 07e37281ef
2 changed files with 15 additions and 0 deletions

View File

@ -305,6 +305,18 @@ void DataFlash_Class::StartUnstartedLogging(void)
}
}
bool DataFlash_Class::should_log() const
{
if (!vehicle_is_armed() && !log_while_disarmed()) {
return false;
}
if (_next_backend == 0) {
return false;
}
return true;
}
#define FOR_EACH_BACKEND(methodcall) \
do { \
for (uint8_t i=0; i<_next_backend; i++) { \

View File

@ -167,6 +167,9 @@ public:
void Log_Write_PID(uint8_t msg_type, const PID_Info &info);
// returns true of logging of a message should be attempted
bool should_log() const;
bool logging_started(void);
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL || CONFIG_HAL_BOARD == HAL_BOARD_LINUX