mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
LP-457 Call set_fc_baud_from_settings only from/to DJI == avoid trouble for Ubxautoconfig.
This commit is contained in:
parent
7c9f04d87c
commit
1279352a95
@ -382,6 +382,8 @@ uint32_t parse_dji_message(struct DJIPacket *dji, GPSPositionSensorData *gpsPosi
|
|||||||
gpsPosition->HDOP = 99.99f;
|
gpsPosition->HDOP = 99.99f;
|
||||||
gpsPosition->PDOP = 99.99f;
|
gpsPosition->PDOP = 99.99f;
|
||||||
gpsPosition->VDOP = 99.99f;
|
gpsPosition->VDOP = 99.99f;
|
||||||
|
// clear out satellite data because DJI doesn't provide it
|
||||||
|
GPSSatellitesSetDefaults(GPSSatellitesHandle(), 0);
|
||||||
djiInitialized = true;
|
djiInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,15 +571,14 @@ static void gps_set_fc_baud_from_settings()
|
|||||||
uint8_t speed;
|
uint8_t speed;
|
||||||
|
|
||||||
// Retrieve settings
|
// Retrieve settings
|
||||||
|
HwSettingsGPSSpeedGet(&speed);
|
||||||
|
|
||||||
#if defined(PIOS_INCLUDE_GPS_DJI_PARSER) && !defined(PIOS_GPS_MINIMAL)
|
#if defined(PIOS_INCLUDE_GPS_DJI_PARSER) && !defined(PIOS_GPS_MINIMAL)
|
||||||
if (gpsSettings.DataProtocol == GPSSETTINGS_DATAPROTOCOL_DJI) {
|
if (gpsSettings.DataProtocol == GPSSETTINGS_DATAPROTOCOL_DJI) {
|
||||||
speed = HWSETTINGS_GPSSPEED_115200;
|
speed = HWSETTINGS_GPSSPEED_115200;
|
||||||
} else {
|
}
|
||||||
#endif
|
|
||||||
HwSettingsGPSSpeedGet(&speed);
|
|
||||||
#if defined(PIOS_INCLUDE_GPS_DJI_PARSER) && !defined(PIOS_GPS_MINIMAL)
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// set fc baud
|
// set fc baud
|
||||||
gps_set_fc_baud_from_arg(speed);
|
gps_set_fc_baud_from_arg(speed);
|
||||||
}
|
}
|
||||||
@ -663,16 +662,19 @@ void AuxMagSettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
|
|||||||
#if defined(ANY_FULL_GPS_PARSER)
|
#if defined(ANY_FULL_GPS_PARSER)
|
||||||
void updateGpsSettings(__attribute__((unused)) UAVObjEvent *ev)
|
void updateGpsSettings(__attribute__((unused)) UAVObjEvent *ev)
|
||||||
{
|
{
|
||||||
|
GPSSettingsDataProtocolOptions previous_data_protocol = gpsSettings.DataProtocol;
|
||||||
ubx_autoconfig_settings_t newconfig;
|
ubx_autoconfig_settings_t newconfig;
|
||||||
|
|
||||||
GPSSettingsGet(&gpsSettings);
|
GPSSettingsGet(&gpsSettings);
|
||||||
|
|
||||||
#if defined(PIOS_INCLUDE_GPS_DJI_PARSER)
|
#if defined(PIOS_INCLUDE_GPS_DJI_PARSER)
|
||||||
// each time there is a protocol change, set the baud rate
|
|
||||||
// so that DJI can be forced to 115200, but changing to another protocol will change the baud rate to the user specified value
|
|
||||||
// note that changes to HwSettings GPS baud rate are detected in the HwSettings callback,
|
// note that changes to HwSettings GPS baud rate are detected in the HwSettings callback,
|
||||||
// but changing to/from DJI is effectively a baud rate change because DJI is forced to be 115200
|
// but changing to/from DJI in GPSSettings is effectively a baud rate change because DJI is forced to be 115200
|
||||||
gps_set_fc_baud_from_settings(); // knows to force 115200 for DJI
|
if (((gpsSettings.DataProtocol == GPSSETTINGS_DATAPROTOCOL_DJI) && (previous_data_protocol != GPSSETTINGS_DATAPROTOCOL_DJI)) ||
|
||||||
|
((gpsSettings.DataProtocol != GPSSETTINGS_DATAPROTOCOL_DJI) && (previous_data_protocol == GPSSETTINGS_DATAPROTOCOL_DJI))) {
|
||||||
|
// knows to force 115200 for DJI
|
||||||
|
gps_set_fc_baud_from_settings();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// it's OK that ubx auto config is inited and ready to go, when GPS is disabled or running another protocol
|
// it's OK that ubx auto config is inited and ready to go, when GPS is disabled or running another protocol
|
||||||
@ -791,12 +793,6 @@ void updateGpsSettings(__attribute__((unused)) UAVObjEvent *ev)
|
|||||||
gps_ubx_autoconfig_set(&newconfig);
|
gps_ubx_autoconfig_set(&newconfig);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(PIOS_INCLUDE_GPS_DJI_PARSER)
|
|
||||||
if (gpsSettings.DataProtocol == GPSSETTINGS_DATAPROTOCOL_DJI) {
|
|
||||||
// clear out satellite data because DJI doesn't provide it
|
|
||||||
GPSSatellitesSetDefaults(GPSSatellitesHandle(), 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif /* defined(ANY_FULL_GPS_PARSER) */
|
#endif /* defined(ANY_FULL_GPS_PARSER) */
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user