From db6b96caa0346619c032657919b7d99c6c956ac1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 2 May 2014 21:52:26 +1000 Subject: [PATCH] Revert "HAL_PX4: read from FRAM in 128 byte chunks" This reverts commit a92366c4552851719cbdd0e5a92789f99f8bda6d. This commit may be associated with FRAM corruption on Pixhawk. Revert until we understand why --- libraries/AP_HAL_PX4/Storage.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/libraries/AP_HAL_PX4/Storage.cpp b/libraries/AP_HAL_PX4/Storage.cpp index 898483593e..4d7b10716c 100644 --- a/libraries/AP_HAL_PX4/Storage.cpp +++ b/libraries/AP_HAL_PX4/Storage.cpp @@ -154,15 +154,8 @@ void PX4Storage::_storage_open(void) if (fd == -1) { hal.scheduler->panic("Failed to open " MTD_PARAMS_FILE); } - const uint16_t chunk_size = 128; - for (uint16_t ofs=0; ofspanic("Failed to read " MTD_PARAMS_FILE); - } - ofs += chunk_size; + if (read(fd, _buffer, sizeof(_buffer)) != sizeof(_buffer)) { + hal.scheduler->panic("Failed to read " MTD_PARAMS_FILE); } close(fd); _initialised = true;