mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-09 17:38:32 -04:00
DataFlash: force messagewriters to completion
Setting a dataflash-file buffer size of less than or equal to 2kiB would cause the startup-messagewriter to never push any messages other than FMT out to the logs. This is a combination of the return values of critical_message_reserved_space and non_messagewriter_message_reserved_space This patch forces the startup messages out to the logs by ignoring the space constraints every 100ms
This commit is contained in:
parent
765e00faf1
commit
50a53ae28a
@ -554,11 +554,15 @@ bool DataFlash_File::_WritePrioritisedBlock(const void *pBuffer, uint16_t size,
|
|||||||
// writing format messages out. It can always get back to us
|
// writing format messages out. It can always get back to us
|
||||||
// with more messages later, so let's leave room for other
|
// with more messages later, so let's leave room for other
|
||||||
// things:
|
// things:
|
||||||
if (space < non_messagewriter_message_reserved_space()) {
|
const uint32_t now = AP_HAL::millis();
|
||||||
|
const bool must_dribble = (now - last_messagewrite_message_sent) > 100;
|
||||||
|
if (!must_dribble &&
|
||||||
|
space < non_messagewriter_message_reserved_space()) {
|
||||||
// this message isn't dropped, it will be sent again...
|
// this message isn't dropped, it will be sent again...
|
||||||
semaphore->give();
|
semaphore->give();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
last_messagewrite_message_sent = now;
|
||||||
} else {
|
} else {
|
||||||
// we reserve some amount of space for critical messages:
|
// we reserve some amount of space for critical messages:
|
||||||
if (!is_critical && space < critical_message_reserved_space()) {
|
if (!is_critical && space < critical_message_reserved_space()) {
|
||||||
|
@ -136,6 +136,7 @@ private:
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
uint32_t last_messagewrite_message_sent;
|
||||||
|
|
||||||
// free-space checks; filling up SD cards under NuttX leads to
|
// free-space checks; filling up SD cards under NuttX leads to
|
||||||
// corrupt filesystems which cause loss of data, failure to gather
|
// corrupt filesystems which cause loss of data, failure to gather
|
||||||
|
Loading…
Reference in New Issue
Block a user