mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-14 13:47:35 +08:00
parameters: fix export shutdown locking
- in NuttX bchlib keeps a sector sized buffer that might not be written out to RAMTRON until the file is closed
This commit is contained in:
@@ -59,17 +59,13 @@ FactoryCalibrationStorage::FactoryCalibrationStorage()
|
||||
|
||||
int FactoryCalibrationStorage::open()
|
||||
{
|
||||
if (_fd >= 0) {
|
||||
cleanup();
|
||||
}
|
||||
|
||||
if (!_enabled) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
_fd = ::open(CALIBRATION_STORAGE, O_RDWR);
|
||||
int ret = ::access(CALIBRATION_STORAGE, R_OK | W_OK);
|
||||
|
||||
if (_fd == -1) {
|
||||
if (ret != 0) {
|
||||
return -errno;
|
||||
}
|
||||
|
||||
@@ -84,7 +80,7 @@ int FactoryCalibrationStorage::store()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ret = param_export(_fd, filter_calibration_params);
|
||||
int ret = param_export(CALIBRATION_STORAGE, filter_calibration_params);
|
||||
|
||||
if (ret != 0) {
|
||||
PX4_ERR("param export failed (%i)", ret);
|
||||
@@ -98,10 +94,5 @@ void FactoryCalibrationStorage::cleanup()
|
||||
if (_enabled) {
|
||||
param_control_autosave(true);
|
||||
}
|
||||
|
||||
if (_fd >= 0) {
|
||||
close(_fd);
|
||||
_fd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,5 +60,4 @@ private:
|
||||
void cleanup();
|
||||
|
||||
bool _enabled{false};
|
||||
int _fd{-1};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user