mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 17:55:30 +03:00
Remove some logic and boolean arguments from FrSky GPS code. See
d58387c
PR #855
This commit is contained in:
parent
d58387c44a
commit
802218b77b
1 changed files with 16 additions and 10 deletions
|
@ -302,18 +302,24 @@ static void sendLatLong(int32_t coord[2])
|
||||||
serialize16(coord[LON] < 0 ? 'W' : 'E');
|
serialize16(coord[LON] < 0 ? 'W' : 'E');
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sendFakeLatLong(bool useGpsNoFixValues)
|
static void sendFakeLatLong(void)
|
||||||
{
|
{
|
||||||
// Heading is only displayed on OpenTX if non-zero lat/long is also sent
|
// Heading is only displayed on OpenTX if non-zero lat/long is also sent
|
||||||
int32_t coord[2] = {0,0};
|
int32_t coord[2] = {0,0};
|
||||||
|
|
||||||
if (useGpsNoFixValues) {
|
coord[LAT] = (telemetryConfig->gpsNoFixLatitude * GPS_DEGREES_DIVIDER);
|
||||||
coord[LAT] = (telemetryConfig->gpsNoFixLatitude * GPS_DEGREES_DIVIDER);
|
coord[LON] = (telemetryConfig->gpsNoFixLongitude * GPS_DEGREES_DIVIDER);
|
||||||
coord[LON] = (telemetryConfig->gpsNoFixLongitude * GPS_DEGREES_DIVIDER);
|
|
||||||
} else {
|
sendLatLong(coord);
|
||||||
coord[LAT] = (1 * GPS_DEGREES_DIVIDER);
|
}
|
||||||
coord[LON] = (1 * GPS_DEGREES_DIVIDER);
|
|
||||||
}
|
static void sendFakeLatLongThaAllowsHeadingDisplay(void)
|
||||||
|
{
|
||||||
|
// Heading is only displayed on OpenTX if non-zero lat/long is also sent
|
||||||
|
int32_t coord[2] = {
|
||||||
|
1 * GPS_DEGREES_DIVIDER,
|
||||||
|
1 * GPS_DEGREES_DIVIDER
|
||||||
|
};
|
||||||
|
|
||||||
sendLatLong(coord);
|
sendLatLong(coord);
|
||||||
}
|
}
|
||||||
|
@ -329,7 +335,7 @@ static void sendGPSLatLong(void)
|
||||||
sendLatLong(GPS_coord);
|
sendLatLong(GPS_coord);
|
||||||
} else {
|
} else {
|
||||||
// otherwise send fake lat/long in order to display compass value
|
// otherwise send fake lat/long in order to display compass value
|
||||||
sendFakeLatLong(true);
|
sendFakeLatLong();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -526,7 +532,7 @@ void handleFrSkyTelemetry(rxConfig_t *rxConfig, uint16_t deadband3d_throttle)
|
||||||
sendGPSLatLong();
|
sendGPSLatLong();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sendFakeLatLong(false);
|
sendFakeLatLongThaAllowsHeadingDisplay();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
sendFakeLatLong(false);
|
sendFakeLatLong(false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue