DataFlash: move _initialised into DataFlash_Backend

This commit is contained in:
Peter Barker 2017-06-30 14:42:31 +10:00 committed by Francisco Ferreira
parent 999a5e6cda
commit 4234f4ef7a
6 changed files with 5 additions and 10 deletions

View File

@ -268,6 +268,9 @@ bool DataFlash_Backend::WritesOK() const
if (!_front.vehicle_is_armed() && !_front.log_while_disarmed()) { if (!_front.vehicle_is_armed() && !_front.log_while_disarmed()) {
return false; return false;
} }
if (!_initialised) {
return false;
}
return true; return true;
} }

View File

@ -157,6 +157,8 @@ protected:
// must be called when a new log is being started: // must be called when a new log is being started:
virtual void start_new_log_reset_variables(); virtual void start_new_log_reset_variables();
bool _initialised;
private: private:
uint32_t _last_periodic_1Hz; uint32_t _last_periodic_1Hz;

View File

@ -53,7 +53,6 @@ DataFlash_File::DataFlash_File(DataFlash_Class &front,
_read_fd_log_num(0), _read_fd_log_num(0),
_read_offset(0), _read_offset(0),
_write_offset(0), _write_offset(0),
_initialised(false),
_open_error(false), _open_error(false),
_log_directory(log_directory), _log_directory(log_directory),
_cached_oldest_log(0), _cached_oldest_log(0),
@ -520,9 +519,6 @@ bool DataFlash_File::WritesOK() const
if (_write_fd == -1) { if (_write_fd == -1) {
return false; return false;
} }
if (!_initialised) {
return false;
}
if (_open_error) { if (_open_error) {
return false; return false;
} }

View File

@ -83,7 +83,6 @@ private:
uint16_t _read_fd_log_num; uint16_t _read_fd_log_num;
uint32_t _read_offset; uint32_t _read_offset;
uint32_t _write_offset; uint32_t _write_offset;
volatile bool _initialised;
volatile bool _open_error; volatile bool _open_error;
const char *_log_directory; const char *_log_directory;

View File

@ -124,9 +124,6 @@ bool DataFlash_MAVLink::WritesOK() const
if (!DataFlash_Backend::WritesOK()) { if (!DataFlash_Backend::WritesOK()) {
return false; return false;
} }
if (!_initialised) {
return false;
}
if (!_sending_to_client) { if (!_sending_to_client) {
return false; return false;
} }

View File

@ -131,8 +131,6 @@ private:
uint8_t _target_system_id; uint8_t _target_system_id;
uint8_t _target_component_id; uint8_t _target_component_id;
bool _initialised;
// this controls the maximum number of blocks we will push from // this controls the maximum number of blocks we will push from
// the pending and send queues in any call to push_log_blocks. // the pending and send queues in any call to push_log_blocks.
// push_log_blocks is called by periodic_tasks. Each block is 200 // push_log_blocks is called by periodic_tasks. Each block is 200