From c9799fb2b7969c91c0a910aecf27d12ac6ab1e6b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 23 Jan 2013 16:54:11 +1100 Subject: [PATCH] HAL_PX4: writing more than 512 bytes at a time can cause IO errors the vfat fs in NuttX is really very picky! --- libraries/AP_HAL_PX4/Storage.cpp | 2 +- libraries/AP_HAL_PX4/Storage.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AP_HAL_PX4/Storage.cpp b/libraries/AP_HAL_PX4/Storage.cpp index 420af55f0c..f7e51b4fd7 100644 --- a/libraries/AP_HAL_PX4/Storage.cpp +++ b/libraries/AP_HAL_PX4/Storage.cpp @@ -28,7 +28,7 @@ void PX4Storage::_storage_create(void) { mkdir(STORAGE_DIR, 0777); unlink(STORAGE_FILE); - _fd = open(STORAGE_FILE, O_RDWR|O_CREAT|O_TRUNC, 0666); + _fd = open(STORAGE_FILE, O_RDWR|O_CREAT, 0666); if (_fd == -1) { hal.scheduler->panic("Failed to create " STORAGE_FILE); } diff --git a/libraries/AP_HAL_PX4/Storage.h b/libraries/AP_HAL_PX4/Storage.h index 9002240b04..7d8b27bb6c 100644 --- a/libraries/AP_HAL_PX4/Storage.h +++ b/libraries/AP_HAL_PX4/Storage.h @@ -7,7 +7,7 @@ #include "AP_HAL_PX4_Namespace.h" #define PX4_STORAGE_SIZE 4096 -#define PX4_STORAGE_MAX_WRITE 1024 +#define PX4_STORAGE_MAX_WRITE 512 #define PX4_STORAGE_LINE_SHIFT 7 #define PX4_STORAGE_LINE_SIZE (1<