1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-21 11:54:15 +01:00

Merge remote-tracking branch 'origin/laurent/OP-1601_CC3D_Ubx_only' into next

This commit is contained in:
Laurent Lalanne 2015-02-18 02:58:19 +01:00
commit 26ec24f5b1
4 changed files with 70 additions and 46 deletions

View File

@ -91,7 +91,12 @@ void updateGpsSettings(UAVObjEvent *ev);
#else #else
#if defined(PIOS_GPS_MINIMAL) #if defined(PIOS_GPS_MINIMAL)
#define GPS_READ_BUFFER 32 #define GPS_READ_BUFFER 32
#define STACK_SIZE_BYTES 500
#ifdef PIOS_INCLUDE_GPS_NMEA_PARSER
#define STACK_SIZE_BYTES 580 // NMEA
#else
#define STACK_SIZE_BYTES 440 // UBX
#endif // PIOS_INCLUDE_GPS_NMEA_PARSER
#else #else
#define STACK_SIZE_BYTES 650 #define STACK_SIZE_BYTES 650
#endif // PIOS_GPS_MINIMAL #endif // PIOS_GPS_MINIMAL
@ -203,9 +208,11 @@ int32_t GPSInitialize(void)
GPSSettingsInitialize(); GPSSettingsInitialize();
GPSSettingsDataProtocolGet(&gpsProtocol); GPSSettingsDataProtocolGet(&gpsProtocol);
switch (gpsProtocol) { switch (gpsProtocol) {
#if defined(PIOS_INCLUDE_GPS_NMEA_PARSER)
case GPSSETTINGS_DATAPROTOCOL_NMEA: case GPSSETTINGS_DATAPROTOCOL_NMEA:
gps_rx_buffer = pios_malloc(NMEA_MAX_PACKET_LENGTH); gps_rx_buffer = pios_malloc(NMEA_MAX_PACKET_LENGTH);
break; break;
#endif
case GPSSETTINGS_DATAPROTOCOL_UBX: case GPSSETTINGS_DATAPROTOCOL_UBX:
gps_rx_buffer = pios_malloc(sizeof(struct UBXPacket)); gps_rx_buffer = pios_malloc(sizeof(struct UBXPacket));
break; break;
@ -459,12 +466,12 @@ static void updateHwSettings()
} }
} }
#ifdef PIOS_INCLUDE_GPS_UBX_PARSER #if defined(PIOS_INCLUDE_GPS_UBX_PARSER) && !defined(PIOS_GPS_MINIMAL)
void AuxMagSettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) void AuxMagSettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
{ {
load_mag_settings(); load_mag_settings();
} }
#if defined(PIOS_INCLUDE_GPS_UBX_PARSER) && !defined(PIOS_GPS_MINIMAL)
void updateGpsSettings(__attribute__((unused)) UAVObjEvent *ev) void updateGpsSettings(__attribute__((unused)) UAVObjEvent *ev)
{ {
uint8_t ubxAutoConfig; uint8_t ubxAutoConfig;
@ -537,7 +544,6 @@ void updateGpsSettings(__attribute__((unused)) UAVObjEvent *ev)
ubx_autoconfig_set(newconfig); ubx_autoconfig_set(newconfig);
} }
#endif /* if defined(PIOS_INCLUDE_GPS_UBX_PARSER) && !defined(PIOS_GPS_MINIMAL) */ #endif /* if defined(PIOS_INCLUDE_GPS_UBX_PARSER) && !defined(PIOS_GPS_MINIMAL) */
#endif /* ifdef PIOS_INCLUDE_GPS_UBX_PARSER */
/** /**
* @} * @}
* @} * @}

View File

@ -40,14 +40,13 @@
#include "GPS.h" #include "GPS.h"
// #define ENABLE_DEBUG_MSG ///< define to enable debug-messages // #define ENABLE_DEBUG_MSG ///< define to enable debug-messages
#define DEBUG_PORT PIOS_COM_TELEM_RF ///< defines which serial port is ued for debug-messages #define DEBUG_PORT PIOS_COM_TELEM_RF ///< defines which serial port is used for debug-messages
// Debugging // Debugging
#ifdef ENABLE_DEBUG_MSG #ifdef ENABLE_DEBUG_MSG
// #define DEBUG_MSG_IN ///< define to display the incoming NMEA messages // #define DEBUG_MSG_IN ///< define to display the incoming NMEA messages
// #define DEBUG_PARAMS ///< define to display the incoming NMEA messages split into its parameters // #define DEBUG_PARAMS ///< define to display the incoming NMEA messages split into its parameters
// #define DEBUG_MGSID_IN ///< define to display the the names of the incoming NMEA messages // #define DEBUG_MSGID_IN ///< define to display the names of the incoming NMEA messages
// #define NMEA_DEBUG_PKT ///< define to enable debug of all NMEA messages // #define NMEA_DEBUG_PKT ///< define to enable debug of all NMEA messages
// #define NMEA_DEBUG_GGA ///< define to enable debug of GGA messages // #define NMEA_DEBUG_GGA ///< define to enable debug of GGA messages
// #define NMEA_DEBUG_VTG ///< define to enable debug of VTG messages // #define NMEA_DEBUG_VTG ///< define to enable debug of VTG messages
@ -68,40 +67,40 @@ struct nmea_parser {
bool (*handler)(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); bool (*handler)(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam);
}; };
static bool nmeaProcessGPGGA(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); static bool nmeaProcessGxGGA(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam);
static bool nmeaProcessGPRMC(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); static bool nmeaProcessGxRMC(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam);
static bool nmeaProcessGPVTG(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); static bool nmeaProcessGxVTG(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam);
static bool nmeaProcessGPGSA(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); static bool nmeaProcessGxGSA(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam);
#if !defined(PIOS_GPS_MINIMAL) #if !defined(PIOS_GPS_MINIMAL)
static bool nmeaProcessGPZDA(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); static bool nmeaProcessGxZDA(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam);
static bool nmeaProcessGPGSV(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); static bool nmeaProcessGxGSV(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam);
#endif // PIOS_GPS_MINIMAL #endif // PIOS_GPS_MINIMAL
static const struct nmea_parser nmea_parsers[] = { static const struct nmea_parser nmea_parsers[] = {
{ {
.prefix = "GPGGA", .prefix = "GGA",
.handler = nmeaProcessGPGGA, .handler = nmeaProcessGxGGA,
}, },
{ {
.prefix = "GPVTG", .prefix = "VTG",
.handler = nmeaProcessGPVTG, .handler = nmeaProcessGxVTG,
}, },
{ {
.prefix = "GPGSA", .prefix = "GSA",
.handler = nmeaProcessGPGSA, .handler = nmeaProcessGxGSA,
}, },
{ {
.prefix = "GPRMC", .prefix = "RMC",
.handler = nmeaProcessGPRMC, .handler = nmeaProcessGxRMC,
}, },
#if !defined(PIOS_GPS_MINIMAL) #if !defined(PIOS_GPS_MINIMAL)
{ {
.prefix = "GPZDA", .prefix = "ZDA",
.handler = nmeaProcessGPZDA, .handler = nmeaProcessGxZDA,
}, },
{ {
.prefix = "GPGSV", .prefix = "GSV",
.handler = nmeaProcessGPGSV, .handler = nmeaProcessGxGSV,
}, },
#endif // PIOS_GPS_MINIMAL #endif // PIOS_GPS_MINIMAL
}; };
@ -373,6 +372,8 @@ bool NMEA_update_position(char *nmea_sentence, GPSPositionSensorData *GpsData)
// Sample NMEA message: "GPRMC,000131.736,V,,,,,0.00,0.00,060180,,,N*43" // Sample NMEA message: "GPRMC,000131.736,V,,,,,0.00,0.00,060180,,,N*43"
// The first parameter starts at the beginning of the message // The first parameter starts at the beginning of the message
// Skip first two character, allow GL, GN, GP...
p += 2;
params[0] = p; params[0] = p;
nbParams = 1; nbParams = 1;
while (*p != 0) { while (*p != 0) {
@ -406,11 +407,13 @@ bool NMEA_update_position(char *nmea_sentence, GPSPositionSensorData *GpsData)
parser = NMEA_find_parser_by_prefix(params[0]); parser = NMEA_find_parser_by_prefix(params[0]);
if (!parser) { if (!parser) {
// No parser found // No parser found
#ifdef DEBUG_MSGID_IN
DEBUG_MSG(" NO PARSER (\"%s\")\n", params[0]); DEBUG_MSG(" NO PARSER (\"%s\")\n", params[0]);
#endif
return false; return false;
} }
#ifdef DEBUG_MGSID_IN #ifdef DEBUG_MSGID_IN
DEBUG_MSG("%s %d ", params[0]); DEBUG_MSG("%s %d ", params[0]);
#endif #endif
// Send the message to the parser and get it update the GpsData // Send the message to the parser and get it update the GpsData
@ -422,7 +425,9 @@ bool NMEA_update_position(char *nmea_sentence, GPSPositionSensorData *GpsData)
if (!parser->handler(GpsData, &gpsDataUpdated, params, nbParams)) { if (!parser->handler(GpsData, &gpsDataUpdated, params, nbParams)) {
// Parse failed // Parse failed
#ifdef DEBUG_MSGID_IN
DEBUG_MSG("PARSE FAILED (\"%s\")\n", params[0]); DEBUG_MSG("PARSE FAILED (\"%s\")\n", params[0]);
#endif
if (gpsDataUpdated && (GpsData->Status == GPSPOSITIONSENSOR_STATUS_NOFIX)) { if (gpsDataUpdated && (GpsData->Status == GPSPOSITIONSENSOR_STATUS_NOFIX)) {
GPSPositionSensorSet(GpsData); GPSPositionSensorSet(GpsData);
} }
@ -432,13 +437,13 @@ bool NMEA_update_position(char *nmea_sentence, GPSPositionSensorData *GpsData)
// All is fine :) Update object if data has changed // All is fine :) Update object if data has changed
if (gpsDataUpdated) { if (gpsDataUpdated) {
#ifdef DEBUG_MGSID_IN #ifdef DEBUG_MSGID_IN
DEBUG_MSG("U"); DEBUG_MSG("U");
#endif #endif
GPSPositionSensorSet(GpsData); GPSPositionSensorSet(GpsData);
} }
#ifdef DEBUG_MGSID_IN #ifdef DEBUG_MSGID_IN
DEBUG_MSG("\n"); DEBUG_MSG("\n");
#endif #endif
return true; return true;
@ -446,11 +451,11 @@ bool NMEA_update_position(char *nmea_sentence, GPSPositionSensorData *GpsData)
/** /**
* Parse an NMEA GPGGA sentence and update the given UAVObject * Parse an NMEA GxGGA sentence and update the given UAVObject
* \param[in] A pointer to a GPSPositionSensor UAVObject to be updated. * \param[in] A pointer to a GPSPositionSensor UAVObject to be updated.
* \param[in] An NMEA sentence with a valid checksum * \param[in] An NMEA sentence with a valid checksum
*/ */
static bool nmeaProcessGPGGA(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam) static bool nmeaProcessGxGGA(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam)
{ {
if (nbParam != 15) { if (nbParam != 15) {
return false; return false;
@ -499,11 +504,11 @@ static bool nmeaProcessGPGGA(GPSPositionSensorData *GpsData, bool *gpsDataUpdate
} }
/** /**
* Parse an NMEA GPRMC sentence and update the given UAVObject * Parse an NMEA GxRMC sentence and update the given UAVObject
* \param[in] A pointer to a GPSPositionSensor UAVObject to be updated. * \param[in] A pointer to a GPSPositionSensor UAVObject to be updated.
* \param[in] An NMEA sentence with a valid checksum * \param[in] An NMEA sentence with a valid checksum
*/ */
static bool nmeaProcessGPRMC(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam) static bool nmeaProcessGxRMC(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam)
{ {
if (nbParam != 13) { if (nbParam != 13) {
return false; return false;
@ -567,11 +572,11 @@ static bool nmeaProcessGPRMC(GPSPositionSensorData *GpsData, bool *gpsDataUpdate
} }
/** /**
* Parse an NMEA GPVTG sentence and update the given UAVObject * Parse an NMEA GxVTG sentence and update the given UAVObject
* \param[in] A pointer to a GPSPositionSensor UAVObject to be updated. * \param[in] A pointer to a GPSPositionSensor UAVObject to be updated.
* \param[in] An NMEA sentence with a valid checksum * \param[in] An NMEA sentence with a valid checksum
*/ */
static bool nmeaProcessGPVTG(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam) static bool nmeaProcessGxVTG(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam)
{ {
if (nbParam != 9 && nbParam != 10 /*GTOP GPS seems to gemnerate an extra parameter...*/) { if (nbParam != 9 && nbParam != 10 /*GTOP GPS seems to gemnerate an extra parameter...*/) {
return false; return false;
@ -592,11 +597,11 @@ static bool nmeaProcessGPVTG(GPSPositionSensorData *GpsData, bool *gpsDataUpdate
#if !defined(PIOS_GPS_MINIMAL) #if !defined(PIOS_GPS_MINIMAL)
/** /**
* Parse an NMEA GPZDA sentence and update the @ref GPSTime object * Parse an NMEA GxZDA sentence and update the @ref GPSTime object
* \param[in] A pointer to a GPSPositionSensor UAVObject to be updated (unused). * \param[in] A pointer to a GPSPositionSensor UAVObject to be updated (unused).
* \param[in] An NMEA sentence with a valid checksum * \param[in] An NMEA sentence with a valid checksum
*/ */
static bool nmeaProcessGPZDA(__attribute__((unused)) GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam) static bool nmeaProcessGxZDA(__attribute__((unused)) GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam)
{ {
if (nbParam != 7) { if (nbParam != 7) {
return false; return false;
@ -636,7 +641,7 @@ static uint8_t gsv_processed_mask;
static uint16_t gsv_incomplete_error; static uint16_t gsv_incomplete_error;
static uint16_t gsv_duplicate_error; static uint16_t gsv_duplicate_error;
static bool nmeaProcessGPGSV(__attribute__((unused)) GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam) static bool nmeaProcessGxGSV(__attribute__((unused)) GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam)
{ {
if (nbParam < 4) { if (nbParam < 4) {
return false; return false;
@ -723,7 +728,7 @@ static bool nmeaProcessGPGSV(__attribute__((unused)) GPSPositionSensorData *GpsD
* \param[in] A pointer to a GPSPositionSensor UAVObject to be updated. * \param[in] A pointer to a GPSPositionSensor UAVObject to be updated.
* \param[in] An NMEA sentence with a valid checksum * \param[in] An NMEA sentence with a valid checksum
*/ */
static bool nmeaProcessGPGSA(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam) static bool nmeaProcessGxGSA(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam)
{ {
if (nbParam != 18) { if (nbParam != 18) {
return false; return false;

View File

@ -30,6 +30,12 @@ USE_DSP_LIB ?= NO
# Set to YES to build a FW version that will erase data flash memory # Set to YES to build a FW version that will erase data flash memory
ERASE_FLASH ?= NO ERASE_FLASH ?= NO
# Set to yes to include Gcsreceiver module
GCSRECEIVER ?= NO
# Enable Diag tasks ?
DIAG_TASKS ?= NO
# List of mandatory modules to include # List of mandatory modules to include
MODULES += Attitude MODULES += Attitude
MODULES += Stabilization MODULES += Stabilization
@ -103,7 +109,6 @@ ifndef TESTAPP
SRC += $(OPUAVSYNTHDIR)/gyrostate.c SRC += $(OPUAVSYNTHDIR)/gyrostate.c
SRC += $(OPUAVSYNTHDIR)/attitudestate.c SRC += $(OPUAVSYNTHDIR)/attitudestate.c
SRC += $(OPUAVSYNTHDIR)/manualcontrolcommand.c SRC += $(OPUAVSYNTHDIR)/manualcontrolcommand.c
SRC += $(OPUAVSYNTHDIR)/i2cstats.c
SRC += $(OPUAVSYNTHDIR)/watchdogstatus.c SRC += $(OPUAVSYNTHDIR)/watchdogstatus.c
SRC += $(OPUAVSYNTHDIR)/manualcontrolsettings.c SRC += $(OPUAVSYNTHDIR)/manualcontrolsettings.c
SRC += $(OPUAVSYNTHDIR)/flightmodesettings.c SRC += $(OPUAVSYNTHDIR)/flightmodesettings.c
@ -116,15 +121,23 @@ ifndef TESTAPP
SRC += $(OPUAVSYNTHDIR)/gpsvelocitysensor.c SRC += $(OPUAVSYNTHDIR)/gpsvelocitysensor.c
SRC += $(OPUAVSYNTHDIR)/gpssettings.c SRC += $(OPUAVSYNTHDIR)/gpssettings.c
SRC += $(OPUAVSYNTHDIR)/hwsettings.c SRC += $(OPUAVSYNTHDIR)/hwsettings.c
SRC += $(OPUAVSYNTHDIR)/gcsreceiver.c
SRC += $(OPUAVSYNTHDIR)/receiveractivity.c SRC += $(OPUAVSYNTHDIR)/receiveractivity.c
SRC += $(OPUAVSYNTHDIR)/taskinfo.c
SRC += $(OPUAVSYNTHDIR)/callbackinfo.c
SRC += $(OPUAVSYNTHDIR)/mixerstatus.c SRC += $(OPUAVSYNTHDIR)/mixerstatus.c
SRC += $(OPUAVSYNTHDIR)/ratedesired.c SRC += $(OPUAVSYNTHDIR)/ratedesired.c
SRC += $(OPUAVSYNTHDIR)/txpidsettings.c SRC += $(OPUAVSYNTHDIR)/txpidsettings.c
SRC += $(OPUAVSYNTHDIR)/mpu6000settings.c SRC += $(OPUAVSYNTHDIR)/mpu6000settings.c
SRC += $(OPUAVSYNTHDIR)/perfcounter.c # Command line option for Gcsreceiver module
ifeq ($(GCSRECEIVER), YES)
SRC += $(OPUAVSYNTHDIR)/gcsreceiver.c
endif
# Enable Diag tasks and UAVOs needed
ifeq ($(DIAG_TASKS), YES)
CDEFS += -DDIAG_TASKS
SRC += $(OPUAVSYNTHDIR)/taskinfo.c
SRC += $(OPUAVSYNTHDIR)/callbackinfo.c
SRC += $(OPUAVSYNTHDIR)/perfcounter.c
SRC += $(OPUAVSYNTHDIR)/i2cstats.c
endif
else else
## Test Code ## Test Code
SRC += $(OPTESTS)/test_common.c SRC += $(OPTESTS)/test_common.c

View File

@ -97,10 +97,10 @@
/* PIOS receiver drivers */ /* PIOS receiver drivers */
#define PIOS_INCLUDE_PWM #define PIOS_INCLUDE_PWM
#define PIOS_INCLUDE_PPM #define PIOS_INCLUDE_PPM
#define PIOS_INCLUDE_PPM_FLEXI /* #define PIOS_INCLUDE_PPM_FLEXI */
#define PIOS_INCLUDE_DSM #define PIOS_INCLUDE_DSM
#define PIOS_INCLUDE_SBUS #define PIOS_INCLUDE_SBUS
#define PIOS_INCLUDE_GCSRCVR /* #define PIOS_INCLUDE_GCSRCVR */
/* #define PIOS_INCLUDE_OPLINKRCVR */ /* #define PIOS_INCLUDE_OPLINKRCVR */
/* PIOS abstract receiver interface */ /* PIOS abstract receiver interface */
@ -142,7 +142,7 @@
/* #define PIOS_TELEM_PRIORITY_QUEUE */ /* #define PIOS_TELEM_PRIORITY_QUEUE */
#define PIOS_INCLUDE_GPS #define PIOS_INCLUDE_GPS
#define PIOS_GPS_MINIMAL #define PIOS_GPS_MINIMAL
#define PIOS_INCLUDE_GPS_NMEA_PARSER /* #define PIOS_INCLUDE_GPS_NMEA_PARSER */
#define PIOS_INCLUDE_GPS_UBX_PARSER #define PIOS_INCLUDE_GPS_UBX_PARSER
/* #define PIOS_GPS_SETS_HOMELOCATION */ /* #define PIOS_GPS_SETS_HOMELOCATION */