1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +03:00

Merge pull request #5905 from etracer65/rc_interp_task

Break out rc interpolation as a separate task and run before pid controller and motor update
This commit is contained in:
Michael Keller 2018-05-18 13:51:53 +12:00 committed by GitHub
commit a14302afe2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -905,8 +905,6 @@ static NOINLINE void subTaskMainSubprocesses(timeUs_t currentTimeUs)
rcCommand[THROTTLE] += calculateThrottleAngleCorrection(throttleCorrectionConfig()->throttle_correction_value);
}
processRcCommand();
#ifdef USE_SDCARD
afatfs_poll();
#endif
@ -958,6 +956,12 @@ static void subTaskMotorUpdate(timeUs_t currentTimeUs)
DEBUG_SET(DEBUG_PIDLOOP, 2, micros() - startTime);
}
static void subTaskRcCommand(timeUs_t currentTimeUs)
{
processRcCommand();
UNUSED(currentTimeUs);
}
// Function for loop trigger
FAST_CODE void taskMainPidLoop(timeUs_t currentTimeUs)
{
@ -976,6 +980,7 @@ FAST_CODE void taskMainPidLoop(timeUs_t currentTimeUs)
DEBUG_SET(DEBUG_PIDLOOP, 0, micros() - currentTimeUs);
if (pidUpdateCounter++ % pidConfig()->pid_process_denom == 0) {
subTaskRcCommand(currentTimeUs);
subTaskPidController(currentTimeUs);
subTaskMotorUpdate(currentTimeUs);
subTaskMainSubprocesses(currentTimeUs);