mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-20 20:03:54 +08:00
dataman: add silence flag for _file_initialize
This commit is contained in:
@@ -113,6 +113,7 @@ static struct {
|
||||
} ram;
|
||||
};
|
||||
bool running;
|
||||
bool silence = false;
|
||||
} dm_operations_data;
|
||||
|
||||
/** Types of function calls supported by the worker task */
|
||||
@@ -565,12 +566,12 @@ _file_read(dm_item_t item, unsigned index, void *buf, size_t count)
|
||||
for (int i = 0; i < 2; i++) {
|
||||
int ret_seek = lseek(dm_operations_data.file.fd, offset, SEEK_SET);
|
||||
|
||||
if (ret_seek < 0) {
|
||||
if ((ret_seek < 0) && !dm_operations_data.silence) {
|
||||
PX4_ERR("file read lseek failed %d", errno);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ret_seek != offset) {
|
||||
if ((ret_seek != offset) && !dm_operations_data.silence) {
|
||||
PX4_ERR("file read lseek failed, incorrect offset %d vs %d", ret_seek, offset);
|
||||
continue;
|
||||
}
|
||||
@@ -584,7 +585,9 @@ _file_read(dm_item_t item, unsigned index, void *buf, size_t count)
|
||||
break;
|
||||
|
||||
} else {
|
||||
PX4_ERR("file read failed %d", errno);
|
||||
if (!dm_operations_data.silence) {
|
||||
PX4_ERR("file read failed %d", errno);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -700,7 +703,9 @@ _file_initialize(unsigned max_offset)
|
||||
if (dm_operations_data.file.fd >= 0) {
|
||||
// Read the mission state and check the hash
|
||||
struct dataman_compat_s compat_state;
|
||||
dm_operations_data.silence = true;
|
||||
int ret = g_dm_ops->read(DM_KEY_COMPAT, 0, &compat_state, sizeof(compat_state));
|
||||
dm_operations_data.silence = false;
|
||||
|
||||
bool incompat = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user