mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-17 20:17:34 +08:00
param: add param_control_autosave to enable/disable autosave
This commit is contained in:
@@ -639,6 +639,21 @@ static void param_autosave(void)
|
||||
autosave_scheduled = true;
|
||||
work_queue(LPWORK, &autosave_work, (worker_t)&autosave_worker, NULL, USEC2TICK(delay));
|
||||
}
|
||||
|
||||
void
|
||||
param_control_autosave(bool enable)
|
||||
{
|
||||
param_lock_writer();
|
||||
|
||||
if (!enable && autosave_scheduled) {
|
||||
work_cancel(LPWORK, &autosave_work);
|
||||
autosave_scheduled = false;
|
||||
}
|
||||
|
||||
autosave_disabled = !enable;
|
||||
param_unlock_writer();
|
||||
}
|
||||
|
||||
static int
|
||||
param_set_internal(param_t param, const void *val, bool mark_saved, bool notify_changes)
|
||||
{
|
||||
|
||||
@@ -383,6 +383,14 @@ __EXPORT int param_load_default(void);
|
||||
*/
|
||||
__EXPORT uint32_t param_hash_check(void);
|
||||
|
||||
|
||||
/**
|
||||
* Enable/disable the param autosaving.
|
||||
* Re-enabling with changed params will not cause an autosave.
|
||||
* @param enable true: enable autosaving, false: disable autosaving
|
||||
*/
|
||||
__EXPORT void param_control_autosave(bool enable);
|
||||
|
||||
/*
|
||||
* Macros creating static parameter definitions.
|
||||
*
|
||||
|
||||
@@ -640,6 +640,21 @@ static void param_autosave(void)
|
||||
autosave_scheduled = true;
|
||||
work_queue(LPWORK, &autosave_work, (worker_t)&autosave_worker, NULL, USEC2TICK(delay));
|
||||
}
|
||||
|
||||
void
|
||||
param_control_autosave(bool enable)
|
||||
{
|
||||
param_lock();
|
||||
|
||||
if (!enable && autosave_scheduled) {
|
||||
work_cancel(LPWORK, &autosave_work);
|
||||
autosave_scheduled = false;
|
||||
}
|
||||
|
||||
autosave_disabled = !enable;
|
||||
param_unlock();
|
||||
}
|
||||
|
||||
static int
|
||||
param_set_internal(param_t param, const void *val, bool mark_saved, bool notify_changes)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user