aboutsummaryrefslogtreecommitdiff
path: root/src/modules/sdlog2
diff options
context:
space:
mode:
authorBan Siesta <bansiesta@gmail.com>2015-01-04 19:13:27 +0000
committerBan Siesta <bansiesta@gmail.com>2015-01-04 19:13:27 +0000
commit0265885a39282cf9aa34cf1647cf9b260f9f41cc (patch)
tree81a544a8761b157c85756d33f24bfa9ebea99b5a /src/modules/sdlog2
parente8eff3061f5e9c451c94d081932cac0e62e1a9b9 (diff)
downloadpx4-firmware-0265885a39282cf9aa34cf1647cf9b260f9f41cc.tar.gz
px4-firmware-0265885a39282cf9aa34cf1647cf9b260f9f41cc.tar.bz2
px4-firmware-0265885a39282cf9aa34cf1647cf9b260f9f41cc.zip
sdlog2: check every 20MiB if we're running out of space, moved the threshold to 50MiB
Diffstat (limited to 'src/modules/sdlog2')
-rw-r--r--src/modules/sdlog2/sdlog2.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/modules/sdlog2/sdlog2.c b/src/modules/sdlog2/sdlog2.c
index 1bf7d7198..31cdff306 100644
--- a/src/modules/sdlog2/sdlog2.c
+++ b/src/modules/sdlog2/sdlog2.c
@@ -178,6 +178,7 @@ static char log_dir[32];
/* statistics counters */
static uint64_t start_time = 0;
static unsigned long log_bytes_written = 0;
+static unsigned long last_checked_bytes_written = 0;
static unsigned long log_msgs_written = 0;
static unsigned long log_msgs_skipped = 0;
@@ -604,11 +605,15 @@ static void *logwriter_thread(void *arg)
fsync(log_fd);
poll_count = 0;
+ }
+
+ if (log_bytes_written - last_checked_bytes_written > 20*1024*1024) {
/* check if space is available, if not stop everything */
if (check_free_space() != OK) {
logwriter_should_exit = true;
main_thread_should_exit = true;
}
+ last_checked_bytes_written = log_bytes_written;
}
}
@@ -1858,8 +1863,8 @@ int check_free_space()
errx(ERROR, "ERR: statfs");
}
- /* use a threshold of 10 MiB */
- if (statfs_buf.f_bavail < (int)(10 * 1024 * 1024 / statfs_buf.f_bsize)) {
+ /* use a threshold of 50 MiB */
+ if (statfs_buf.f_bavail < (int)(50 * 1024 * 1024 / statfs_buf.f_bsize)) {
mavlink_and_console_log_critical(mavlink_fd,
"[sdlog2] no space on MicroSD: %u MiB",
(unsigned int)(statfs_buf.f_bavail * statfs_buf.f_bsize) / (1024U * 1024U));