Skip to content

Commit

Permalink
DataFlash: take log messages after putting FMTs out
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker authored and tridge committed Sep 17, 2015
1 parent a15d271 commit 63a4500
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions libraries/DataFlash/DFMessageWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ void DFMessageWriter_DFLogStart::reset()
{
DFMessageWriter::reset();

_fmt_done = false;
_writesysinfo.reset();
_writeentiremission.reset();

Expand All @@ -43,6 +44,7 @@ void DFMessageWriter_DFLogStart::process()
_DataFlash.WroteStartupFormat();
next_format_to_send++;
}
_fmt_done = true;
stage = ls_blockwriter_stage_parms;
// fall through

Expand Down
5 changes: 4 additions & 1 deletion libraries/DataFlash/DFMessageWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class DFMessageWriter {
virtual bool finished() { return _finished; };

protected:
bool _finished;
bool _finished = false;
DataFlash_Class &_DataFlash;
};

Expand Down Expand Up @@ -79,6 +79,7 @@ class DFMessageWriter_DFLogStart : public DFMessageWriter {

void reset();
void process();
bool fmt_done() { return _fmt_done; };

void set_mission(const AP_Mission *mission);

Expand All @@ -94,6 +95,8 @@ class DFMessageWriter_DFLogStart : public DFMessageWriter {
ls_blockwriter_stage_done,
};

bool _fmt_done = false;

log_start_blockwriter_stage stage;

uint16_t next_format_to_send;
Expand Down
8 changes: 4 additions & 4 deletions libraries/DataFlash/DataFlash_Backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ void DataFlash_Backend::push_log_blocks() {
WriteMoreStartupMessages();
}

// returns true if all startup messages have been written (and thus it
// is OK for other messages to go to the log)
// returns true if all format messages have been written, and thus it is OK
// for other messages to go out to the log
bool DataFlash_Backend::WriteBlockCheckStartupMessages()
{
if (_front._startup_messagewriter.finished()) {
if (_front._startup_messagewriter.fmt_done()) {
return true;
}

Expand All @@ -59,7 +59,7 @@ bool DataFlash_Backend::WriteBlockCheckStartupMessages()
// caller hoping to write blocks out. Push out log blocks - we
// might end up clearing the buffer.....
push_log_blocks();
if (_front._startup_messagewriter.finished()) {
if (_front._startup_messagewriter.fmt_done()) {
return true;
}

Expand Down

0 comments on commit 63a4500

Please sign in to comment.