mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
Use a function in gps.c to initate the posHold activity on new GPS data
This commit is contained in:
parent
4c9fa613ff
commit
9a80b75abe
3 changed files with 11 additions and 14 deletions
|
@ -78,13 +78,10 @@ void posHoldUpdateTargetLocation(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void posHoldUpdate(timeUs_t currentTimeUs) {
|
void posHoldNewGpsData(void) {
|
||||||
UNUSED(currentTimeUs);
|
|
||||||
// check for enabling Alt Hold, otherwise do as little as possible while inactive
|
|
||||||
posHoldProcessTransitions();
|
|
||||||
if (posHold.isPosHoldRequested) {
|
if (posHold.isPosHoldRequested) {
|
||||||
posHoldUpdateTargetLocation();
|
posHoldUpdateTargetLocation();
|
||||||
if (getIsNewDataForPosHold() && posHold.posHoldIsOK) {
|
if (posHold.posHoldIsOK) {
|
||||||
posHold.posHoldIsOK = positionControl(posHold.useStickAdjustment, posHold.deadband);
|
posHold.posHoldIsOK = positionControl(posHold.useStickAdjustment, posHold.deadband);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -93,6 +90,12 @@ void posHoldUpdate(timeUs_t currentTimeUs) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void posHoldUpdate(timeUs_t currentTimeUs) {
|
||||||
|
UNUSED(currentTimeUs);
|
||||||
|
// check for enabling Alt Hold, otherwise do as little as possible while inactive
|
||||||
|
posHoldProcessTransitions();
|
||||||
|
}
|
||||||
|
|
||||||
bool posHoldFailure(void) {
|
bool posHoldFailure(void) {
|
||||||
return (posHold.isPosHoldRequested && !posHold.posHoldIsOK);
|
return (posHold.isPosHoldRequested && !posHold.posHoldIsOK);
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,6 @@ GPS_svinfo_t GPS_svinfo[GPS_SV_MAXSATS_M8N];
|
||||||
|
|
||||||
static serialPort_t *gpsPort;
|
static serialPort_t *gpsPort;
|
||||||
static float gpsDataIntervalSeconds;
|
static float gpsDataIntervalSeconds;
|
||||||
static bool newDataForPosHold = false;
|
|
||||||
|
|
||||||
typedef struct gpsInitData_s {
|
typedef struct gpsInitData_s {
|
||||||
uint8_t index;
|
uint8_t index;
|
||||||
|
@ -2613,13 +2612,9 @@ void onGpsNewData(void)
|
||||||
gpsLapTimerNewGpsData();
|
gpsLapTimerNewGpsData();
|
||||||
#endif // USE_GPS_LAP_TIMER
|
#endif // USE_GPS_LAP_TIMER
|
||||||
|
|
||||||
newDataForPosHold = true;
|
#ifdef USE_POS_HOLD
|
||||||
}
|
posHoldNewGpsData();
|
||||||
|
#endif
|
||||||
bool getIsNewDataForPosHold(void) {
|
|
||||||
bool currentState = newDataForPosHold; // true only when new data arrives
|
|
||||||
newDataForPosHold = false; // clear flag once new data has been handled
|
|
||||||
return currentState;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpsSetFixState(bool state)
|
void gpsSetFixState(bool state)
|
||||||
|
|
|
@ -392,6 +392,5 @@ void GPS_distance_cm_bearing(const gpsLocation_t *from, const gpsLocation_t *to,
|
||||||
|
|
||||||
void gpsSetFixState(bool state);
|
void gpsSetFixState(bool state);
|
||||||
float getGpsDataIntervalSeconds(void); // sends GPS Nav Data interval to GPS Rescue
|
float getGpsDataIntervalSeconds(void); // sends GPS Nav Data interval to GPS Rescue
|
||||||
bool getIsNewDataForPosHold(void);
|
|
||||||
|
|
||||||
baudRate_e getGpsPortActualBaudRateIndex(void);
|
baudRate_e getGpsPortActualBaudRateIndex(void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue