From a92366c4552851719cbdd0e5a92789f99f8bda6d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 2 May 2014 12:24:43 +1000 Subject: [PATCH] HAL_PX4: read from FRAM in 128 byte chunks this fixes FRAM read on Roberts Pixhawk. We don't know why yet. --- libraries/AP_HAL_PX4/Storage.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libraries/AP_HAL_PX4/Storage.cpp b/libraries/AP_HAL_PX4/Storage.cpp index 4d7b10716c..898483593e 100644 --- a/libraries/AP_HAL_PX4/Storage.cpp +++ b/libraries/AP_HAL_PX4/Storage.cpp @@ -154,8 +154,15 @@ void PX4Storage::_storage_open(void) if (fd == -1) { hal.scheduler->panic("Failed to open " MTD_PARAMS_FILE); } - if (read(fd, _buffer, sizeof(_buffer)) != sizeof(_buffer)) { - hal.scheduler->panic("Failed to read " MTD_PARAMS_FILE); + const uint16_t chunk_size = 128; + for (uint16_t ofs=0; ofspanic("Failed to read " MTD_PARAMS_FILE); + } + ofs += chunk_size; } close(fd); _initialised = true;