Browse Source

dataman: add silence flag for _file_initialize

master
Igor Mišić 3 years ago committed by Beat Küng
parent
commit
3c09448daf
  1. 11
      src/modules/dataman/dataman.cpp

11
src/modules/dataman/dataman.cpp

@ -113,6 +113,7 @@ static struct { @@ -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) @@ -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) @@ -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) @@ -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;

Loading…
Cancel
Save