From a058bb38433fec3ead2fac410f34043cbe603f30 Mon Sep 17 00:00:00 2001 From: borisbstyle Date: Wed, 2 Mar 2016 14:54:44 +0100 Subject: [PATCH] Fix debug calculation in motor cycletime --- src/main/mw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/mw.c b/src/main/mw.c index dae33bc959..56c5c5b3c1 100644 --- a/src/main/mw.c +++ b/src/main/mw.c @@ -730,10 +730,10 @@ void subTasksMainPidLoop(void) { void taskMotorUpdate(void) { if (debugMode == DEBUG_CYCLETIME) { static uint32_t previousMotorUpdateTime; - uint32_t currentDeltaTime = getTaskDeltaTime(TASK_SELF); + uint32_t currentDeltaTime = micros() - previousMotorUpdateTime; debug[2] = currentDeltaTime; - debug[3] = currentDeltaTime - previousMotorUpdateTime; - previousMotorUpdateTime = currentDeltaTime; + debug[3] = currentDeltaTime - targetPidLooptime; + previousMotorUpdateTime = micros(); } #ifdef USE_SERVOS