1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-19 09:54:15 +01:00

OP-315: Display run time as a percentage

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2944 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2011-03-03 04:28:45 +00:00 committed by peabody124
parent 97163d2193
commit e4d9ef98a5
2 changed files with 4 additions and 24 deletions

View File

@ -84,27 +84,6 @@ int32_t TaskMonitorRemove(TaskInfoRunningElem task)
}
}
/**
* Temporarily put function here for configuring RTC for task timing
* Only used in debug mode
*/
void TaskTimerConfigure( void )
{
RCC_APB1PeriphClockCmd(RCC_APB1Periph_BKP | RCC_APB1Periph_PWR,
ENABLE);
PWR_BackupAccessCmd(ENABLE);
RCC_RTCCLKConfig(RCC_RTCCLKSource_HSE_Div128);
RCC_RTCCLKCmd(ENABLE);
RTC_WaitForLastTask();
RTC_WaitForSynchro();
RTC_WaitForLastTask();
RTC_SetPrescaler(0); // counting at 8e6 / 128
RTC_WaitForLastTask();
RTC_SetCounter(0);
RTC_WaitForLastTask();
}
/**
* Update the status of all tasks
*/
@ -126,9 +105,9 @@ void TaskMonitorUpdateAll(void)
data.StackRemaining[n] = 10000;
#else
data.StackRemaining[n] = uxTaskGetStackHighWaterMark(handles[n]) * 4;
#if ( configGENERATE_RUN_TIME_STATS == 1 )
#if ( configGENERATE_RUN_TIME_STATS == 1 )
/* Generate run time stats */
data.RunningTime[n] = uxTaskGetRunTime(handles[n]);
data.RunningTime[n] = 100 * (float) uxTaskGetRunTime(handles[n]) / portGET_RUN_TIME_COUNTER_VALUE();
#endif
#endif
@ -137,6 +116,7 @@ void TaskMonitorUpdateAll(void)
{
data.Running[n] = TASKINFO_RUNNING_FALSE;
data.StackRemaining[n] = 0;
data.RunningTime[n] = 0;
}
}

View File

@ -3,7 +3,7 @@
<description>Task information</description>
<field name="StackRemaining" units="bytes" type="uint16" elementnames="System,Actuator,Attitude,TelemetryTx,TelemetryTxPri,TelemetryRx,GPS,ManualControl,Altitude,AHRSComms,Stabilization,Guidance,FlightPlan"/>
<field name="Running" units="bool" type="enum" options="False,True" elementnames="System,Actuator,Attitude,TelemetryTx,TelemetryTxPri,TelemetryRx,GPS,ManualControl,Altitude,AHRSComms,Stabilization,Guidance,FlightPlan"/>
<field name="RunningTime" units="µs" type="uint16" elementnames="System,Actuator,Attitude,TelemetryTx,TelemetryTxPri,TelemetryRx,GPS,ManualControl,Altitude,AHRSComms,Stabilization,Guidance,FlightPlan"/>
<field name="RunningTime" units="%" type="uint8" elementnames="System,Actuator,Attitude,TelemetryTx,TelemetryTxPri,TelemetryRx,GPS,ManualControl,Altitude,AHRSComms,Stabilization,Guidance,FlightPlan"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
<telemetryflight acked="true" updatemode="periodic" period="10000"/>