Skip to content

Commit 2cfefde

Browse files
Huibeantridge
authored andcommitted
AP_Frsky_Telem: encode PPP as DGPS in passthrough telemetry
Map PPP to the supported DGPS value in the two-bit advanced GPS status field, avoiding an overflow into reserved bit 16. Preserve the existing encoding for all other fix types.
1 parent 1c6edc7 commit 2cfefde

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎libraries/AP_Frsky_Telem/AP_Frsky_SPort_Passthrough.cpp‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,12 @@ uint32_t AP_Frsky_SPort_Passthrough::calc_gps_status(void)
515515
// GPS horizontal dilution of precision in dm
516516
gps_status |= prep_number(roundf(gps.get_hdop() * 0.1f),2,1)<<GPS_HDOP_OFFSET;
517517
// GPS receiver advanced status (0: no advanced fix, 1: GPS_OK_FIX_3D_DGPS, 2: GPS_OK_FIX_3D_RTK_FLOAT, 3: GPS_OK_FIX_3D_RTK_FIXED)
518-
gps_status |= (((uint8_t)gps.status() > GPS_STATUS_LIMIT) ? (uint8_t)gps.status()-GPS_STATUS_LIMIT : 0)<<GPS_ADVSTATUS_OFFSET;
518+
if (gps.status() == AP_GPS_FixType::PPP) {
519+
// Use DGPS for PPP; the two-bit field has no PPP value.
520+
gps_status |= 1U << GPS_ADVSTATUS_OFFSET;
521+
} else {
522+
gps_status |= (((uint8_t)gps.status() > GPS_STATUS_LIMIT) ? (uint8_t)gps.status()-GPS_STATUS_LIMIT : 0)<<GPS_ADVSTATUS_OFFSET;
523+
}
519524
// Altitude MSL in dm
520525
const Location &loc = gps.location();
521526
gps_status |= prep_number(roundf(loc.alt * 0.1f),2,2)<<GPS_ALTMSL_OFFSET;

0 commit comments

Comments
 (0)