Skip to content
Snippets Groups Projects
Commit 65baf998 authored by Lorenz Meier's avatar Lorenz Meier
Browse files

Logger hotfix: Allocate buffer on logging

This enables to use the RAM normally consumed by the log buffer to be used for calibration and other memory-intense tasks.
These run typically only disarmed when logging is not enabled.
parent dce28454
No related branches found
No related tags found
No related merge requests found
......@@ -60,13 +60,7 @@ LogWriterFile::LogWriterFile(size_t buffer_size) :
bool LogWriterFile::init()
{
if (_buffer) {
return true;
}
_buffer = new uint8_t[_buffer_size];
return _buffer;
return true;
}
LogWriterFile::~LogWriterFile()
......@@ -91,6 +85,17 @@ void LogWriterFile::start_log(const char *filename)
return;
} else {
if (_buffer == nullptr) {
_buffer = new uint8_t[_buffer_size];
if (_buffer == nullptr) {
PX4_ERR("Can't create log buffer");
_should_run = false;
return;
}
}
PX4_INFO("Opened log file: %s", filename);
_should_run = true;
_running = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment