mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 06:43:34 +08:00
Dataman: Store sizes of all containers and reset file if any of them changes.
This commit is contained in:
committed by
Lorenz Meier
parent
c340974991
commit
db774798fa
@@ -956,7 +956,26 @@ task_main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
#else
|
||||
// Read the mission state and check the hash
|
||||
struct dataman_compat_s compat_state;
|
||||
int ret = dm_read(DM_KEY_COMPAT, 0, &compat_state, sizeof(compat_state));
|
||||
|
||||
bool incompat = true;
|
||||
|
||||
if (ret == sizeof(compat_state)) {
|
||||
|
||||
if (compat_state.key == DM_COMPAT_KEY) {
|
||||
incompat = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
close(g_task_fd);
|
||||
|
||||
if (incompat) {
|
||||
unlink(k_data_manager_device_path);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -977,6 +996,15 @@ task_main(int argc, char *argv[])
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Write current compat info */
|
||||
struct dataman_compat_s compat_state;
|
||||
compat_state.key = DM_COMPAT_KEY;
|
||||
int ret = dm_write(DM_KEY_COMPAT, 0, DM_PERSIST_POWER_ON_RESET, &compat_state, sizeof(compat_state));
|
||||
|
||||
if (ret != sizeof(compat_state)) {
|
||||
PX4_ERR("Failed writing compat.");
|
||||
}
|
||||
|
||||
fsync(g_task_fd);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user