diff --git a/libraries/DataFlash/DataFlash.h b/libraries/DataFlash/DataFlash.h index 3ff0211570..5b4454e1c8 100644 --- a/libraries/DataFlash/DataFlash.h +++ b/libraries/DataFlash/DataFlash.h @@ -212,6 +212,7 @@ public: bool logging_failed() const; void set_vehicle_armed(bool armed_state); + bool vehicle_is_armed() const { return _armed; } protected: diff --git a/libraries/DataFlash/DataFlash_Backend.cpp b/libraries/DataFlash/DataFlash_Backend.cpp index e579ec813a..81b6418ff4 100644 --- a/libraries/DataFlash/DataFlash_Backend.cpp +++ b/libraries/DataFlash/DataFlash_Backend.cpp @@ -265,5 +265,9 @@ bool DataFlash_Backend::WritesOK() const if (!_writes_enabled) { return false; } + if (!_front.vehicle_is_armed() && !_front.log_while_disarmed()) { + return false; + } + return true; }