FrSky GPS code size and de-duplication improvements.
I noticed this after merging 593db0ce1e
.
If the telemetry screen shows no fix when the fix is lost then perhaps
the intention was to make localGPS_coord static in the original code,
but if GPS_coord retains it's value when a fix is lost then this is ok,
please test!
This commit is contained in:
parent
4f752ea946
commit
69292fc966
|
@ -302,28 +302,6 @@ static void sendLatLong(int32_t coord[2])
|
|||
serialize16(coord[LON] < 0 ? 'W' : 'E');
|
||||
}
|
||||
|
||||
#ifdef GPS
|
||||
static void sendGPSLatLong(void)
|
||||
{
|
||||
int32_t localGPS_coord[2] = {0,0};
|
||||
// Don't set dummy GPS data, if we already had a GPS fix
|
||||
// it can be usefull to keep last valid coordinates
|
||||
static uint8_t gpsFixOccured = 0;
|
||||
|
||||
//Dummy data if no 3D fix, this way we can display heading in Taranis
|
||||
if (STATE(GPS_FIX) || gpsFixOccured == 1) {
|
||||
localGPS_coord[LAT] = GPS_coord[LAT];
|
||||
localGPS_coord[LON] = GPS_coord[LON];
|
||||
gpsFixOccured = 1;
|
||||
} else {
|
||||
// Send dummy GPS Data in order to display compass value
|
||||
localGPS_coord[LAT] = (telemetryConfig->gpsNoFixLatitude * GPS_DEGREES_DIVIDER);
|
||||
localGPS_coord[LON] = (telemetryConfig->gpsNoFixLongitude * GPS_DEGREES_DIVIDER);
|
||||
}
|
||||
|
||||
sendLatLong(localGPS_coord);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void sendFakeLatLong(void)
|
||||
{
|
||||
|
@ -334,6 +312,24 @@ static void sendFakeLatLong(void)
|
|||
sendLatLong(coord);
|
||||
}
|
||||
|
||||
#ifdef GPS
|
||||
static void sendGPSLatLong(void)
|
||||
{
|
||||
// Don't set dummy GPS data, if we already had a GPS fix
|
||||
// it can be usefull to keep last valid coordinates
|
||||
static uint8_t gpsFixOccured = 0;
|
||||
|
||||
//Dummy data if no 3D fix, this way we can display heading in Taranis
|
||||
if (STATE(GPS_FIX) || gpsFixOccured == 1) {
|
||||
gpsFixOccured = 1;
|
||||
sendLatLong(GPS_coord);
|
||||
} else {
|
||||
// Send dummy GPS Data in order to display compass value
|
||||
sendFakeLatLong();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Send vertical speed for opentx. ID_VERT_SPEED
|
||||
* Unit is cm/s
|
||||
|
|
Loading…
Reference in New Issue