From f5ee6cfd0852ad5adfb7ec33f305587eb8d555e0 Mon Sep 17 00:00:00 2001 From: Steve Evans Date: Wed, 5 Jan 2022 21:09:30 +0000 Subject: [PATCH] Ignore time taken to update profile with stick commands --- src/main/config/config.c | 3 +++ src/main/fc/tasks.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/config/config.c b/src/main/config/config.c index 4a9f96494a..071c6bd9f8 100644 --- a/src/main/config/config.c +++ b/src/main/config/config.c @@ -816,6 +816,9 @@ void changePidProfileFromCellCount(uint8_t cellCount) void changePidProfile(uint8_t pidProfileIndex) { + // The config switch will cause a big enough delay in the current task to upset the scheduler + schedulerIgnoreTaskExecTime(); + if (pidProfileIndex < PID_PROFILE_COUNT) { systemConfigMutable()->pidProfileIndex = pidProfileIndex; loadPidProfile(); diff --git a/src/main/fc/tasks.c b/src/main/fc/tasks.c index 2de90bf05f..a8a41c945e 100644 --- a/src/main/fc/tasks.c +++ b/src/main/fc/tasks.c @@ -115,7 +115,7 @@ // taskUpdateRxMain() has occasional peaks in execution time so normal moving average duration estimation doesn't work // Decay the estimated max task duration by 1/(1 << RX_TASK_DECAY_SHIFT) on every invocation -#define RX_TASK_DECAY_SHIFT 5 +#define RX_TASK_DECAY_SHIFT 7 // Add a margin to the task duration estimation #define RX_TASK_MARGIN 1