コード例 #1
0
ファイル: ltm.c プロジェクト: mmiers/betaflight
/*
 * GPS G-frame 5Hhz at > 2400 baud
 * LAT LON SPD ALT SAT/FIX
 */
static void ltm_gframe(void)
{
#if defined(GPS)
    uint8_t gps_fix_type = 0;
    int32_t ltm_alt;

    if (!sensors(SENSOR_GPS))
        return;

    if (!STATE(GPS_FIX))
        gps_fix_type = 1;
    else if (GPS_numSat < 5)
        gps_fix_type = 2;
    else
        gps_fix_type = 3;

    ltm_initialise_packet('G');
    ltm_serialise_32(GPS_coord[LAT]);
    ltm_serialise_32(GPS_coord[LON]);
    ltm_serialise_8((uint8_t)(GPS_speed / 100));

#if defined(BARO) || defined(SONAR)
    ltm_alt = (sensors(SENSOR_SONAR) || sensors(SENSOR_BARO)) ? altitudeHoldGetEstimatedAltitude() : GPS_altitude * 100;
#else
    ltm_alt = GPS_altitude * 100;
#endif
    ltm_serialise_32(ltm_alt);
    ltm_serialise_8((GPS_numSat << 2) | gps_fix_type);
    ltm_finalise();
#endif
}
コード例 #2
0
ファイル: ltm.c プロジェクト: Ravenholm14/inav
/*
 * GPS G-frame 5Hhz at > 2400 baud
 * LAT LON SPD ALT SAT/FIX
 */
static void ltm_gframe(void)
{
    uint8_t gps_fix_type = 0;
    int32_t ltm_lat = 0, ltm_lon = 0, ltm_alt = 0, ltm_gs = 0;

    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;

        ltm_lat = gpsSol.llh.lat;
        ltm_lon = gpsSol.llh.lon;
        ltm_gs = gpsSol.groundSpeed / 100;
    }

#if defined(NAV)
    ltm_alt = getEstimatedActualPosition(Z); // cm
#else
    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();
}
コード例 #3
0
ファイル: ltm.c プロジェクト: damdam2/inav
/*
 * GPS G-frame 5Hhz at > 2400 baud
 * LAT LON SPD ALT SAT/FIX
 */
static void ltm_gframe(void)
{
    uint8_t gps_fix_type = 0;
    int32_t ltm_alt;

    if (!sensors(SENSOR_GPS))
        return;

    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));

#if defined(NAV)
    ltm_alt = (sensors(SENSOR_SONAR) || sensors(SENSOR_BARO)) ? getEstimatedActualPosition(Z) : gpsSol.llh.alt; // cm
#else
    ltm_alt = gpsSol.llh.alt; // cm
#endif
    ltm_serialise_32(ltm_alt);
    ltm_serialise_8((gpsSol.numSat << 2) | gps_fix_type);
    ltm_finalise();
}
コード例 #4
0
ファイル: ltm.c プロジェクト: rotcehdnih/betaflight
/*
 * GPS G-frame 5Hhz at > 2400 baud
 * LAT LON SPD ALT SAT/FIX
 */
static void ltm_gframe(void)
{
#if defined(USE_GPS)
    uint8_t gps_fix_type = 0;
    int32_t ltm_alt;

    if (!sensors(SENSOR_GPS))
        return;

    if (!STATE(GPS_FIX))
        gps_fix_type = 1;
    else if (gpsSol.numSat < 5)
        gps_fix_type = 2;
    else
        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));

#if defined(USE_BARO) || defined(USE_RANGEFINDER)
    ltm_alt = (sensors(SENSOR_RANGEFINDER) || sensors(SENSOR_BARO)) ? getEstimatedAltitude() : gpsSol.llh.alt * 100;
#else
    ltm_alt = gpsSol.llh.alt * 100;
#endif
    ltm_serialise_32(ltm_alt);
    ltm_serialise_8((gpsSol.numSat << 2) | gps_fix_type);
    ltm_finalise();
#endif
}
コード例 #5
0
ファイル: ltm.c プロジェクト: night-ghost/inav
/*
 * OSD additional data frame, 1 Hz rate
 *  This frame will be ignored by Ghettostation, but processed by GhettOSD if it is used as standalone onboard OSD
 *  home pos, home alt, direction to home
 */
void ltm_oframe(sbuf_t *dst)
{
    sbufWriteU8(dst, 'O');
    ltm_serialise_32(dst, GPS_home.lat);
    ltm_serialise_32(dst, GPS_home.lon);
    ltm_serialise_32(dst, GPS_home.alt);
    ltm_serialise_8(dst, 1);                 // OSD always ON
    ltm_serialise_8(dst, STATE(GPS_FIX_HOME) ? 1 : 0);
}
コード例 #6
0
ファイル: ltm.c プロジェクト: Ravenholm14/inav
/*
 * OSD additional data frame, 1 Hz rate
 *  This frame will be ignored by Ghettostation, but processed by GhettOSD if it is used as standalone onboard OSD
 *  home pos, home alt, direction to home
 */
static void ltm_oframe()
{
    ltm_initialise_packet('O');
    ltm_serialise_32(GPS_home.lat);
    ltm_serialise_32(GPS_home.lon);
    ltm_serialise_32(GPS_home.alt);
    ltm_serialise_8(1);                 // OSD always ON
    ltm_serialise_8(STATE(GPS_FIX_HOME) ? 1 : 0);
    ltm_finalise();
}
コード例 #7
0
ファイル: ltm.c プロジェクト: mmiers/betaflight
/*
 * OSD additional data frame, 1 Hz rate
 *  This frame will be ignored by Ghettostation, but processed by GhettOSD if it is used as standalone onboard OSD
 *  home pos, home alt, direction to home
 */
static void ltm_oframe()
{
    ltm_initialise_packet('O');
#if defined(GPS)
    ltm_serialise_32(GPS_home[LAT]);
    ltm_serialise_32(GPS_home[LON]);
#else
    ltm_serialise_32(0);
    ltm_serialise_32(0);
#endif
    ltm_serialise_32(0);                // Don't have GPS home altitude
    ltm_serialise_8(1);                 // OSD always ON
    ltm_serialise_8(STATE(GPS_FIX_HOME) ? 1 : 0);
    ltm_finalise();
}