From f92eba93ef8c9287955f28b8e4d9ff7113487721 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Sat, 7 Feb 2015 17:02:59 +0100 Subject: [PATCH] OP-1601 Ubx only, more efficient to save Ram on CC/CC3D --- flight/modules/GPS/GPS.c | 14 ++++++++++---- .../coptercontrol/firmware/inc/pios_config.h | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/flight/modules/GPS/GPS.c b/flight/modules/GPS/GPS.c index 642a00268..8f78f9061 100644 --- a/flight/modules/GPS/GPS.c +++ b/flight/modules/GPS/GPS.c @@ -91,7 +91,12 @@ void updateGpsSettings(UAVObjEvent *ev); #else #if defined(PIOS_GPS_MINIMAL) #define GPS_READ_BUFFER 32 - #define STACK_SIZE_BYTES 580 + +#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 #define STACK_SIZE_BYTES 650 #endif // PIOS_GPS_MINIMAL @@ -203,9 +208,11 @@ int32_t GPSInitialize(void) GPSSettingsInitialize(); GPSSettingsDataProtocolGet(&gpsProtocol); switch (gpsProtocol) { +#if defined(PIOS_INCLUDE_GPS_NMEA_PARSER) case GPSSETTINGS_DATAPROTOCOL_NMEA: gps_rx_buffer = pios_malloc(NMEA_MAX_PACKET_LENGTH); break; +#endif case GPSSETTINGS_DATAPROTOCOL_UBX: gps_rx_buffer = pios_malloc(sizeof(struct UBXPacket)); 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) { load_mag_settings(); } -#if defined(PIOS_INCLUDE_GPS_UBX_PARSER) && !defined(PIOS_GPS_MINIMAL) + void updateGpsSettings(__attribute__((unused)) UAVObjEvent *ev) { uint8_t ubxAutoConfig; @@ -537,7 +544,6 @@ void updateGpsSettings(__attribute__((unused)) UAVObjEvent *ev) ubx_autoconfig_set(newconfig); } #endif /* if defined(PIOS_INCLUDE_GPS_UBX_PARSER) && !defined(PIOS_GPS_MINIMAL) */ -#endif /* ifdef PIOS_INCLUDE_GPS_UBX_PARSER */ /** * @} * @} diff --git a/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h b/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h index 34547ff66..aabc651a7 100644 --- a/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h +++ b/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h @@ -142,7 +142,7 @@ /* #define PIOS_TELEM_PRIORITY_QUEUE */ #define PIOS_INCLUDE_GPS #define PIOS_GPS_MINIMAL -#define PIOS_INCLUDE_GPS_NMEA_PARSER +/* #define PIOS_INCLUDE_GPS_NMEA_PARSER */ #define PIOS_INCLUDE_GPS_UBX_PARSER /* #define PIOS_GPS_SETS_HOMELOCATION */