Browse Source

HAL_PX4: writing more than 512 bytes at a time can cause IO errors

the vfat fs in NuttX is really very picky!
mission-4.1.18
Andrew Tridgell 12 years ago
parent
commit
c9799fb2b7
  1. 2
      libraries/AP_HAL_PX4/Storage.cpp
  2. 2
      libraries/AP_HAL_PX4/Storage.h

2
libraries/AP_HAL_PX4/Storage.cpp

@ -28,7 +28,7 @@ void PX4Storage::_storage_create(void)
{ {
mkdir(STORAGE_DIR, 0777); mkdir(STORAGE_DIR, 0777);
unlink(STORAGE_FILE); 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) { if (_fd == -1) {
hal.scheduler->panic("Failed to create " STORAGE_FILE); hal.scheduler->panic("Failed to create " STORAGE_FILE);
} }

2
libraries/AP_HAL_PX4/Storage.h

@ -7,7 +7,7 @@
#include "AP_HAL_PX4_Namespace.h" #include "AP_HAL_PX4_Namespace.h"
#define PX4_STORAGE_SIZE 4096 #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_SHIFT 7
#define PX4_STORAGE_LINE_SIZE (1<<PX4_STORAGE_LINE_SHIFT) #define PX4_STORAGE_LINE_SIZE (1<<PX4_STORAGE_LINE_SHIFT)
#define PX4_STORAGE_NUM_LINES (PX4_STORAGE_SIZE/PX4_STORAGE_LINE_SIZE) #define PX4_STORAGE_NUM_LINES (PX4_STORAGE_SIZE/PX4_STORAGE_LINE_SIZE)

Loading…
Cancel
Save