mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
OP-1330 Delay SetHomeLocation call from GPS module to be able to save HomeLocation.Set=false
This commit is contained in:
parent
3f5f77d878
commit
8462adb579
@ -64,7 +64,10 @@ static float GravityAccel(float latitude, float longitude, float altitude);
|
||||
// Private constants
|
||||
|
||||
#define GPS_TIMEOUT_MS 500
|
||||
|
||||
// delay from detecting HomeLocation.Set == False before setting new homelocation
|
||||
// this prevent that a save with homelocation.Set = false triggered by gps ends saving
|
||||
// the new location with Set = true.
|
||||
#define HOMELOCATIONSETDELAY 5000
|
||||
|
||||
#ifdef PIOS_GPS_SETS_HOMELOCATION
|
||||
// Unfortunately need a good size stack for the WMM calculation
|
||||
@ -199,7 +202,7 @@ static void gpsTask(__attribute__((unused)) void *parameters)
|
||||
{
|
||||
portTickType xDelay = 100 / portTICK_RATE_MS;
|
||||
uint32_t timeNowMs = xTaskGetTickCount() * portTICK_RATE_MS;
|
||||
|
||||
portTickType homelocationSetDelay = 0;
|
||||
GPSPositionSensorData gpspositionsensor;
|
||||
GPSSettingsData gpsSettings;
|
||||
|
||||
@ -260,7 +263,13 @@ static void gpsTask(__attribute__((unused)) void *parameters)
|
||||
HomeLocationGet(&home);
|
||||
|
||||
if (home.Set == HOMELOCATION_SET_FALSE) {
|
||||
setHomeLocation(&gpspositionsensor);
|
||||
if(homelocationSetDelay == 0){
|
||||
homelocationSetDelay = xTaskGetTickCount();
|
||||
}
|
||||
if(xTaskGetTickCount() - homelocationSetDelay > HOMELOCATIONSETDELAY){
|
||||
setHomeLocation(&gpspositionsensor);
|
||||
homelocationSetDelay = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else if ((gpspositionsensor.Status == GPSPOSITIONSENSOR_STATUS_FIX3D) &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user