DataFlash: make EnableWrites a frontend thing

This commit is contained in:
Peter Barker 2017-06-15 11:21:17 +10:00 committed by Francisco Ferreira
parent b57a4e9685
commit 6a03af8f3e
4 changed files with 9 additions and 12 deletions

View File

@ -109,6 +109,8 @@ void DataFlash_Class::Init(const struct LogStructure *structures, uint8_t num_ty
Prep();
EnableWrites(true);
GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_INFO, "Prepared log system");
}
@ -458,10 +460,6 @@ bool DataFlash_Class::logging_started(void) {
return false;
}
void DataFlash_Class::EnableWrites(bool enable) {
FOR_EACH_BACKEND(EnableWrites(enable));
}
// for DataFlash_MAVLink
void DataFlash_Class::remote_log_block_status_msg(mavlink_channel_t chan,
mavlink_message_t* msg) {

View File

@ -104,7 +104,8 @@ public:
/* poke backends to start if they're not already started */
void StartUnstartedLogging(void);
void EnableWrites(bool enable);
void EnableWrites(bool enable) { _writes_enabled = enable; }
bool WritesEnabled() const { return _writes_enabled; }
void StopLogging();
@ -288,4 +289,7 @@ private:
// possibly expensive calls to start log system:
void Prep();
bool _writes_enabled;
};

View File

@ -262,7 +262,7 @@ bool DataFlash_Backend::Log_Write(const uint8_t msg_type, va_list arg_list, bool
bool DataFlash_Backend::WritesOK() const
{
if (!_writes_enabled) {
if (!_front.WritesEnabled()) {
return false;
}
if (!_front.vehicle_is_armed() && !_front.log_while_disarmed()) {

View File

@ -51,12 +51,9 @@ public:
virtual void ShowDeviceInfo(AP_HAL::BetterStream *port) = 0;
virtual void ListAvailableLogs(AP_HAL::BetterStream *port) = 0;
void EnableWrites(bool enable) { _writes_enabled = enable; }
virtual bool logging_started(void) const { return log_write_started; }
virtual void Init() {
_writes_enabled = true;
}
virtual void Init() { }
void set_mission(const AP_Mission *mission);
@ -142,8 +139,6 @@ protected:
virtual bool WritesOK() const;
bool _writes_enabled = false;
/*
read a block
*/