mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-19 06:15:14 +03:00
Merge pull request #167 from iNavFlight/ltm-send-gframe-without-gps
Allow LTM to send G-frame even when there's no GPS
This commit is contained in:
commit
aea68f51a1
1 changed files with 19 additions and 16 deletions
|
@ -130,28 +130,31 @@ static void ltm_finalise(void)
|
|||
static void ltm_gframe(void)
|
||||
{
|
||||
uint8_t gps_fix_type = 0;
|
||||
int32_t ltm_alt;
|
||||
int32_t ltm_lat = 0, ltm_lon = 0, ltm_alt = 0, ltm_gs = 0;
|
||||
|
||||
if (!sensors(SENSOR_GPS))
|
||||
return;
|
||||
if (sensors(SENSOR_GPS)) {
|
||||
if (gpsSol.fixType == GPS_NO_FIX)
|
||||
gps_fix_type = 1;
|
||||
else if (gpsSol.fixType == GPS_FIX_2D)
|
||||
gps_fix_type = 2;
|
||||
else if (gpsSol.fixType == GPS_FIX_3D)
|
||||
gps_fix_type = 3;
|
||||
|
||||
if (gpsSol.fixType == GPS_NO_FIX)
|
||||
gps_fix_type = 1;
|
||||
else if (gpsSol.fixType == GPS_FIX_2D)
|
||||
gps_fix_type = 2;
|
||||
else if (gpsSol.fixType == GPS_FIX_3D)
|
||||
gps_fix_type = 3;
|
||||
|
||||
ltm_initialise_packet('G');
|
||||
ltm_serialise_32(gpsSol.llh.lat);
|
||||
ltm_serialise_32(gpsSol.llh.lon);
|
||||
ltm_serialise_8((uint8_t)(gpsSol.groundSpeed / 100));
|
||||
ltm_lat = gpsSol.llh.lat;
|
||||
ltm_lon = gpsSol.llh.lon;
|
||||
ltm_gs = gpsSol.groundSpeed / 100;
|
||||
}
|
||||
|
||||
#if defined(NAV)
|
||||
ltm_alt = (sensors(SENSOR_SONAR) || sensors(SENSOR_BARO)) ? getEstimatedActualPosition(Z) : gpsSol.llh.alt; // cm
|
||||
ltm_alt = getEstimatedActualPosition(Z); // cm
|
||||
#else
|
||||
ltm_alt = gpsSol.llh.alt; // cm
|
||||
ltm_alt = sensors(SENSOR_GPS) ? gpsSol.llh.alt : 0; // cm
|
||||
#endif
|
||||
|
||||
ltm_initialise_packet('G');
|
||||
ltm_serialise_32(ltm_lat);
|
||||
ltm_serialise_32(ltm_lon);
|
||||
ltm_serialise_8((uint8_t)ltm_gs);
|
||||
ltm_serialise_32(ltm_alt);
|
||||
ltm_serialise_8((gpsSol.numSat << 2) | gps_fix_type);
|
||||
ltm_finalise();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue