Merge pull request #855 from samcook/frsky-heading
Frsky telemetry heading without GPS
This commit is contained in:
commit
d58387c44a
|
@ -302,12 +302,18 @@ static void sendLatLong(int32_t coord[2])
|
|||
serialize16(coord[LON] < 0 ? 'W' : 'E');
|
||||
}
|
||||
|
||||
|
||||
static void sendFakeLatLong(void)
|
||||
static void sendFakeLatLong(bool useGpsNoFixValues)
|
||||
{
|
||||
// Heading is only displayed on OpenTX if non-zero lat/long is also sent
|
||||
int32_t coord[2] = {0,0};
|
||||
coord[LAT] = (telemetryConfig->gpsNoFixLatitude * GPS_DEGREES_DIVIDER);
|
||||
coord[LON] = (telemetryConfig->gpsNoFixLongitude * GPS_DEGREES_DIVIDER);
|
||||
|
||||
if (useGpsNoFixValues) {
|
||||
coord[LAT] = (telemetryConfig->gpsNoFixLatitude * GPS_DEGREES_DIVIDER);
|
||||
coord[LON] = (telemetryConfig->gpsNoFixLongitude * GPS_DEGREES_DIVIDER);
|
||||
} else {
|
||||
coord[LAT] = (1 * GPS_DEGREES_DIVIDER);
|
||||
coord[LON] = (1 * GPS_DEGREES_DIVIDER);
|
||||
}
|
||||
|
||||
sendLatLong(coord);
|
||||
}
|
||||
|
@ -315,17 +321,15 @@ static void sendFakeLatLong(void)
|
|||
#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) {
|
||||
// If we have ever had a fix, send the last known lat/long
|
||||
gpsFixOccured = 1;
|
||||
sendLatLong(GPS_coord);
|
||||
} else {
|
||||
// Send dummy GPS Data in order to display compass value
|
||||
sendFakeLatLong();
|
||||
// otherwise send fake lat/long in order to display compass value
|
||||
sendFakeLatLong(true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -521,14 +525,11 @@ void handleFrSkyTelemetry(rxConfig_t *rxConfig, uint16_t deadband3d_throttle)
|
|||
sendSatalliteSignalQualityAsTemperature2();
|
||||
sendGPSLatLong();
|
||||
}
|
||||
else if (telemetryConfig->gpsNoFixLatitude != 0 && telemetryConfig->gpsNoFixLongitude != 0) {
|
||||
sendFakeLatLong();
|
||||
else {
|
||||
sendFakeLatLong(false);
|
||||
}
|
||||
#else
|
||||
// Send GPS information to display compass information
|
||||
if (telemetryConfig->gpsNoFixLatitude != 0 && telemetryConfig->gpsNoFixLongitude != 0) {
|
||||
sendFakeLatLong();
|
||||
}
|
||||
sendFakeLatLong(false);
|
||||
#endif
|
||||
|
||||
sendTelemetryTail();
|
||||
|
|
Loading…
Reference in New Issue