mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 08:53:34 +08:00
gps: add generic nmea driver
This commit is contained in:
+19
-2
@@ -68,6 +68,7 @@
|
||||
# include "devices/src/emlid_reach.h"
|
||||
# include "devices/src/mtk.h"
|
||||
# include "devices/src/femtomes.h"
|
||||
# include "devices/src/nmea.h"
|
||||
#endif // CONSTRAINED_FLASH
|
||||
#include "devices/src/ubx.h"
|
||||
|
||||
@@ -85,7 +86,8 @@ enum class gps_driver_mode_t {
|
||||
MTK,
|
||||
ASHTECH,
|
||||
EMLIDREACH,
|
||||
FEMTOMES
|
||||
FEMTOMES,
|
||||
NMEA
|
||||
};
|
||||
|
||||
enum class gps_dump_comm_mode_t : int32_t {
|
||||
@@ -321,6 +323,8 @@ GPS::GPS(const char *path, gps_driver_mode_t mode, GPSHelper::Interface interfac
|
||||
case 4: _mode = gps_driver_mode_t::EMLIDREACH; break;
|
||||
|
||||
case 5: _mode = gps_driver_mode_t::FEMTOMES; break;
|
||||
|
||||
case 6: _mode = gps_driver_mode_t::NMEA; break;
|
||||
#endif // CONSTRAINED_FLASH
|
||||
}
|
||||
}
|
||||
@@ -793,6 +797,11 @@ GPS::run()
|
||||
_helper = new GPSDriverFemto(&GPS::callback, this, &_report_gps_pos, _p_report_sat_info, heading_offset);
|
||||
set_device_type(DRV_GPS_DEVTYPE_FEMTOMES);
|
||||
break;
|
||||
|
||||
case gps_driver_mode_t::NMEA:
|
||||
_helper = new GPSDriverNMEA(&GPS::callback, this, &_report_gps_pos, _p_report_sat_info, heading_offset);
|
||||
set_device_type(DRV_GPS_DEVTYPE_NMEA);
|
||||
break;
|
||||
#endif // CONSTRAINED_FLASH
|
||||
|
||||
default:
|
||||
@@ -953,6 +962,7 @@ GPS::run()
|
||||
break;
|
||||
|
||||
case gps_driver_mode_t::FEMTOMES:
|
||||
case gps_driver_mode_t::NMEA: // skip NMEA for auto-detection to avoid false positive matching
|
||||
#endif // CONSTRAINED_FLASH
|
||||
_mode = gps_driver_mode_t::UBX;
|
||||
px4_usleep(500000); // tried all possible drivers. Wait a bit before next round
|
||||
@@ -1009,6 +1019,10 @@ GPS::print_status()
|
||||
case gps_driver_mode_t::FEMTOMES:
|
||||
PX4_INFO("protocol: FEMTOMES");
|
||||
break;
|
||||
|
||||
case gps_driver_mode_t::NMEA:
|
||||
PX4_INFO("protocol: NMEA");
|
||||
break;
|
||||
#endif // CONSTRAINED_FLASH
|
||||
|
||||
default:
|
||||
@@ -1175,7 +1189,7 @@ $ gps reset warm
|
||||
|
||||
PRINT_MODULE_USAGE_PARAM_STRING('i', "uart", "spi|uart", "GPS interface", true);
|
||||
PRINT_MODULE_USAGE_PARAM_STRING('j', "uart", "spi|uart", "secondary GPS interface", true);
|
||||
PRINT_MODULE_USAGE_PARAM_STRING('p', nullptr, "ubx|mtk|ash|eml|fem", "GPS Protocol (default=auto select)", true);
|
||||
PRINT_MODULE_USAGE_PARAM_STRING('p', nullptr, "ubx|mtk|ash|eml|fem|nmea", "GPS Protocol (default=auto select)", true);
|
||||
|
||||
PRINT_MODULE_USAGE_DEFAULT_COMMANDS();
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("reset", "Reset GPS device");
|
||||
@@ -1319,6 +1333,9 @@ GPS *GPS::instantiate(int argc, char *argv[], Instance instance)
|
||||
|
||||
} else if (!strcmp(myoptarg, "fem")) {
|
||||
mode = gps_driver_mode_t::FEMTOMES;
|
||||
|
||||
} else if (!strcmp(myoptarg, "nmea")) {
|
||||
mode = gps_driver_mode_t::NMEA;
|
||||
#endif // CONSTRAINED_FLASH
|
||||
} else {
|
||||
PX4_ERR("unknown protocol: %s", myoptarg);
|
||||
|
||||
Reference in New Issue
Block a user