Browse Source

DataFlash: add a should_log method

mission-4.1.18
Peter Barker 8 years ago committed by Francisco Ferreira
parent
commit
07e37281ef
  1. 12
      libraries/DataFlash/DataFlash.cpp
  2. 3
      libraries/DataFlash/DataFlash.h

12
libraries/DataFlash/DataFlash.cpp

@ -305,6 +305,18 @@ void DataFlash_Class::StartUnstartedLogging(void) @@ -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++) { \

3
libraries/DataFlash/DataFlash.h

@ -167,6 +167,9 @@ public: @@ -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

Loading…
Cancel
Save