diff --git a/flight/modules/GPS/GPS.c b/flight/modules/GPS/GPS.c index 5bd2c9061..71080f97d 100644 --- a/flight/modules/GPS/GPS.c +++ b/flight/modules/GPS/GPS.c @@ -109,12 +109,14 @@ void updateGpsSettings(__attribute__((unused)) UAVObjEvent *ev); // GPS_READ_BUFFER is defined a few lines below in this file. // // 57600 bps = 5760 bytes per second +// // For 32 bytes buffer: this is a maximum of 5760/32 = 180 buffers per second -// that is 1/180 = 0.0056 seconds per packet -// We must never wait more than 5ms since packet was last drained or it may overflow +// that is 1/180 = 0.0056 seconds per packet +// We must never wait more than 5ms since packet was last drained or it may overflow +// // For 128 bytes buffer: this is a maximum of 5760/128 = 45 buffers per second -// that is 1/45 = 0.022 seconds per packet -// We must never wait more than 22ms since packet was last drained or it may overflow +// that is 1/45 = 0.022 seconds per packet +// We must never wait more than 22ms since packet was last drained or it may overflow // There are two delays in play for the GPS task: // - GPS_BLOCK_ON_NO_DATA_MS is the time to block while waiting to receive serial data from the GPS @@ -124,31 +126,31 @@ void updateGpsSettings(__attribute__((unused)) UAVObjEvent *ev); // are run often enough. // GPS_LOOP_DELAY_MS on the other hand, should be less then 5.55 ms. A value set too high will cause data to be dropped. -#define GPS_LOOP_DELAY_MS 5 -#define GPS_BLOCK_ON_NO_DATA_MS 20 +#define GPS_LOOP_DELAY_MS 5 +#define GPS_BLOCK_ON_NO_DATA_MS 20 #ifdef PIOS_GPS_SETS_HOMELOCATION // Unfortunately need a good size stack for the WMM calculation - #define STACK_SIZE_BYTES 1024 + #define STACK_SIZE_BYTES 1024 #else #if defined(PIOS_GPS_MINIMAL) - #define GPS_READ_BUFFER 32 + #define GPS_READ_BUFFER 32 #ifdef PIOS_INCLUDE_GPS_NMEA_PARSER - #define STACK_SIZE_BYTES 580 // NMEA -#else // PIOS_INCLUDE_GPS_NMEA_PARSER - #define STACK_SIZE_BYTES 440 // UBX + #define STACK_SIZE_BYTES 580 // NMEA +#else // PIOS_INCLUDE_GPS_NMEA_PARSER + #define STACK_SIZE_BYTES 440 // UBX #endif // PIOS_INCLUDE_GPS_NMEA_PARSER -#else // PIOS_GPS_MINIMAL - #define STACK_SIZE_BYTES 650 +#else // PIOS_GPS_MINIMAL + #define STACK_SIZE_BYTES 650 #endif // PIOS_GPS_MINIMAL #endif // PIOS_GPS_SETS_HOMELOCATION #ifndef GPS_READ_BUFFER -#define GPS_READ_BUFFER 128 +#define GPS_READ_BUFFER 128 #endif -#define TASK_PRIORITY (tskIDLE_PRIORITY + 1) +#define TASK_PRIORITY (tskIDLE_PRIORITY + 1) // **************** // Private variables @@ -304,8 +306,7 @@ MODULE_INITCALL(GPSInitialize, GPSStart); static void gpsTask(__attribute__((unused)) void *parameters) { - - uint32_t timeNowMs = xTaskGetTickCount() * portTICK_RATE_MS; + uint32_t timeNowMs = xTaskGetTickCount() * portTICK_RATE_MS; #ifdef PIOS_GPS_SETS_HOMELOCATION portTickType homelocationSetDelay = 0; diff --git a/flight/modules/GPS/UBX.c b/flight/modules/GPS/UBX.c index 06170977f..e8a79a3b5 100644 --- a/flight/modules/GPS/UBX.c +++ b/flight/modules/GPS/UBX.c @@ -192,8 +192,8 @@ int parse_ubx_stream(uint8_t *rx, uint16_t len, char *gps_rx_buffer, GPSPosition The recommendation is to limit the maximum number of simultaneously used GNSS to a value of 2. This will help keep the number of tracked satellites in line. - */ - if ( (ubx->header.class == 0x01) && ( (ubx->header.id == 0x30) || (ubx->header.id == 0x35) ) ) { + */ + if ((ubx->header.class == 0x01) && ((ubx->header.id == 0x30) || (ubx->header.id == 0x35))) { restart_state = RESTART_NO_ERROR; } else { restart_state = RESTART_WITH_ERROR; diff --git a/flight/modules/StateEstimation/filterlla.c b/flight/modules/StateEstimation/filterlla.c index ebb6be449..e0f6c4c35 100644 --- a/flight/modules/StateEstimation/filterlla.c +++ b/flight/modules/StateEstimation/filterlla.c @@ -104,7 +104,7 @@ static filterResult filter(__attribute__((unused)) stateFilter *self, stateEstim // check if we have a valid GPS signal (not checked by StateEstimation istelf) if ((gpsdata.PDOP < this->settings.MaxPDOP) && (gpsdata.Satellites >= this->settings.MinSatellites) && - ((gpsdata.Status == GPSPOSITIONSENSOR_STATUS_FIX3D) || (gpsdata.Status == GPSPOSITIONSENSOR_STATUS_FIX3DDGNSS))&& + ((gpsdata.Status == GPSPOSITIONSENSOR_STATUS_FIX3D) || (gpsdata.Status == GPSPOSITIONSENSOR_STATUS_FIX3DDGNSS)) && (gpsdata.Latitude != 0 || gpsdata.Longitude != 0)) { int32_t LLAi[3] = { gpsdata.Latitude,