From c723ae37208b87f129b89d8996ce67d9aec9165a Mon Sep 17 00:00:00 2001 From: James Cotton Date: Tue, 8 May 2012 00:26:22 -0500 Subject: [PATCH] Reduce the CPU usage of OSX simuluator --- flight/PiOS.osx/osx/Libraries/FreeRTOS/Source/task.c | 6 +++++- flight/Revolution/Makefile.osx | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/flight/PiOS.osx/osx/Libraries/FreeRTOS/Source/task.c b/flight/PiOS.osx/osx/Libraries/FreeRTOS/Source/task.c index d47b81a48..9a32ec7ff 100644 --- a/flight/PiOS.osx/osx/Libraries/FreeRTOS/Source/task.c +++ b/flight/PiOS.osx/osx/Libraries/FreeRTOS/Source/task.c @@ -62,6 +62,8 @@ #include #include #include +#include +#include /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining all the API functions to use the MPU wrappers. That should only be done when @@ -1943,7 +1945,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) { /* Stop warnings. */ ( void ) pvParameters; - + int last_idle_time = clock(); for( ;; ) { /* See if any tasks have been deleted. */ @@ -1986,6 +1988,8 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) without the overhead of a separate task. NOTE: vApplicationIdleHook() MUST NOT, UNDER ANY CIRCUMSTANCES, CALL A FUNCTION THAT MIGHT BLOCK. */ + while(clock() < (last_idle_time + 1)); + last_idle_time = clock(); vApplicationIdleHook(); } #endif diff --git a/flight/Revolution/Makefile.osx b/flight/Revolution/Makefile.osx index 8088c36d2..ca7d5a5c8 100644 --- a/flight/Revolution/Makefile.osx +++ b/flight/Revolution/Makefile.osx @@ -54,9 +54,9 @@ USE_THUMB_MODE = YES # List of modules to include MODULES += Actuator ManualControl Stabilization -MODULES += AltitudeHold Guidance PathPlanner +MODULES += AltitudeHold VtolPathFollower PathPlanner MODULES += Attitude/revolution -MODULES += OveroSync/simulated +#MODULES += OveroSync/simulated # To run simulation instead of connect to SITL MODULES += Sensors/simulated