mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
ahrscomms: use relative delays to avoid slipping
Change from using vTaskDelay to using vTaskDelayUntil to ensure that we're trying to stay periodic rather than just waiting a fixed amount of time after each loop of processing. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1580 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
929f7dd5d8
commit
93ef510946
@ -156,6 +156,7 @@ static uint16_t algorithm_errors = 0;
|
|||||||
static void ahrscommsTask(void* parameters)
|
static void ahrscommsTask(void* parameters)
|
||||||
{
|
{
|
||||||
enum opahrs_result result;
|
enum opahrs_result result;
|
||||||
|
portTickType lastSysTime;
|
||||||
|
|
||||||
GPSGoodUpdates = 0;
|
GPSGoodUpdates = 0;
|
||||||
|
|
||||||
@ -191,6 +192,7 @@ static void ahrscommsTask(void* parameters)
|
|||||||
AlarmsClear(SYSTEMALARMS_ALARM_AHRSCOMMS);
|
AlarmsClear(SYSTEMALARMS_ALARM_AHRSCOMMS);
|
||||||
|
|
||||||
/* We're in sync with the AHRS, spin here until an error occurs */
|
/* We're in sync with the AHRS, spin here until an error occurs */
|
||||||
|
lastSysTime = xTaskGetTickCount();
|
||||||
while (1) {
|
while (1) {
|
||||||
AHRSSettingsData settings;
|
AHRSSettingsData settings;
|
||||||
|
|
||||||
@ -308,7 +310,7 @@ static void ahrscommsTask(void* parameters)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Wait for the next update interval */
|
/* Wait for the next update interval */
|
||||||
vTaskDelay( settings.UpdatePeriod / portTICK_RATE_MS );
|
vTaskDelayUntil(&lastSysTime, settings.UpdatePeriod / portTICK_RATE_MS );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user