mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
gps: add GPS_{1,2}_PROTOCOL param to select protocol, default to u-blox
u-blox is the most widely used GPS, so module detection should be a bit faster in general.
This commit is contained in:
parent
ab43a94224
commit
e6ad321ab2
@ -279,7 +279,25 @@ GPS::GPS(const char *path, gps_driver_mode_t mode, GPSHelper::Interface interfac
|
||||
memset(_p_report_sat_info, 0, sizeof(*_p_report_sat_info));
|
||||
}
|
||||
|
||||
_mode_auto = mode == GPS_DRIVER_MODE_NONE;
|
||||
if (_mode == GPS_DRIVER_MODE_NONE) {
|
||||
// use parameter to select mode if not provided via CLI
|
||||
char protocol_param_name[16];
|
||||
snprintf(protocol_param_name, sizeof(protocol_param_name), "GPS_%i_PROTOCOL", (int)_instance + 1);
|
||||
int32_t protocol = 0;
|
||||
param_get(param_find(protocol_param_name), &protocol);
|
||||
|
||||
switch (protocol) {
|
||||
case 1: _mode = GPS_DRIVER_MODE_UBX; break;
|
||||
|
||||
case 2: _mode = GPS_DRIVER_MODE_MTK; break;
|
||||
|
||||
case 3: _mode = GPS_DRIVER_MODE_ASHTECH; break;
|
||||
|
||||
case 4: _mode = GPS_DRIVER_MODE_EMLIDREACH; break;
|
||||
}
|
||||
}
|
||||
|
||||
_mode_auto = _mode == GPS_DRIVER_MODE_NONE;
|
||||
}
|
||||
|
||||
GPS::~GPS()
|
||||
|
||||
@ -107,3 +107,42 @@ PARAM_DEFINE_INT32(GPS_UBX_MODE, 0);
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(GPS_YAW_OFFSET, 0.f);
|
||||
|
||||
/**
|
||||
* Protocol for Main GPS
|
||||
*
|
||||
* Select the GPS protocol over serial.
|
||||
*
|
||||
* Auto-detection will probe all protocols, and thus is a bit slower.
|
||||
*
|
||||
* @min 0
|
||||
* @max 4
|
||||
* @value 0 Auto detect
|
||||
* @value 1 u-blox
|
||||
* @value 2 MTK
|
||||
* @value 3 Ashtech / Trimble
|
||||
* @value 4 Emlid Reach
|
||||
*
|
||||
* @reboot_required true
|
||||
* @group GPS
|
||||
*/
|
||||
PARAM_DEFINE_INT32(GPS_1_PROTOCOL, 1);
|
||||
|
||||
/**
|
||||
* Protocol for Secondary GPS
|
||||
*
|
||||
* Select the GPS protocol over serial.
|
||||
*
|
||||
* Auto-detection will probe all protocols, and thus is a bit slower.
|
||||
*
|
||||
* @min 0
|
||||
* @max 4
|
||||
* @value 0 Auto detect
|
||||
* @value 1 u-blox
|
||||
* @value 2 MTK
|
||||
* @value 3 Ashtech / Trimble
|
||||
* @value 4 Emlid Reach
|
||||
*
|
||||
* @reboot_required true
|
||||
* @group GPS
|
||||
*/
|
||||
PARAM_DEFINE_INT32(GPS_2_PROTOCOL, 1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user