Skip to content

Commit c4a935c

Browse files
committed
AP_GPS: priortise F9P with 3D lock over M8
1 parent 591ef85 commit c4a935c

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed

libraries/AP_GPS/AP_GPS.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,25 @@ void AP_GPS::update_primary(void)
945945
if (i == primary_instance) {
946946
continue;
947947
}
948+
949+
// if primary is not a F9 and altternative is a F9 with 3D fix then use the F9
950+
if (state[i].status >= GPS_OK_FIX_3D &&
951+
strcmp(drivers[i]->name(), "u-blox") == 0 && drivers[i]->hardware_generation() == AP_GPS_UBLOX::UBLOX_F9 &&
952+
strcmp(drivers[primary_instance]->name(), "u-blox") == 0 && drivers[primary_instance]->hardware_generation() != AP_GPS_UBLOX::UBLOX_F9) {
953+
primary_instance = i;
954+
_last_instance_swap_ms = now;
955+
continue;
956+
}
957+
958+
// if primary F9 has 3D lock, and 2nd GPS is a M8, don't switch
959+
if (state[primary_instance].status >= GPS_OK_FIX_3D &&
960+
strcmp(drivers[primary_instance]->name(), "u-blox") == 0 && drivers[primary_instance]->hardware_generation() == AP_GPS_UBLOX::UBLOX_F9 &&
961+
strcmp(drivers[i]->name(), "u-blox") == 0 && drivers[i]->hardware_generation() != AP_GPS_UBLOX::UBLOX_F9) {
962+
// don't switch away from a F9 with 3D lock to a M8
963+
continue;
964+
}
965+
966+
948967
if (state[i].status > state[primary_instance].status) {
949968
// we have a higher status lock, or primary is set to the blended GPS, change GPS
950969
primary_instance = i;

libraries/AP_GPS/AP_GPS_UBLOX.h

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,17 @@ class AP_GPS_UBLOX : public AP_GPS_Backend
144144

145145
// ublox specific healthy checks
146146
bool is_healthy(void) const override;
147+
148+
enum ubx_hardware_version {
149+
ANTARIS = 0,
150+
UBLOX_5,
151+
UBLOX_6,
152+
UBLOX_7,
153+
UBLOX_M8,
154+
UBLOX_F9 = 0x80, // comes from MON_VER hwVersion string
155+
UBLOX_UNKNOWN_HARDWARE_GENERATION = 0xff // not in the ublox spec used for
156+
// flagging state in the driver
157+
};
147158

148159
private:
149160
// u-blox UBX protocol essentials
@@ -620,16 +631,6 @@ class AP_GPS_UBLOX : public AP_GPS_Backend
620631
NAV_STATUS_FIX_VALID = 1,
621632
NAV_STATUS_DGPS_USED = 2
622633
};
623-
enum ubx_hardware_version {
624-
ANTARIS = 0,
625-
UBLOX_5,
626-
UBLOX_6,
627-
UBLOX_7,
628-
UBLOX_M8,
629-
UBLOX_F9 = 0x80, // comes from MON_VER hwVersion string
630-
UBLOX_UNKNOWN_HARDWARE_GENERATION = 0xff // not in the ublox spec used for
631-
// flagging state in the driver
632-
};
633634

634635
enum config_step {
635636
STEP_PVT = 0,

0 commit comments

Comments
 (0)