multiwii/multiwii-firmware

Ublox protocol support not working

nsadding opened this issue · 0 comments

Firstly, Thank you to everyone who contributed to the development and maintenance of this software. The generous nature of the open source community never ceases to impress!
Anyhow, I was experiencing some issues trying to compile the source ver 2.4 with support for UBLOX GPS protocol enabled in the config.h file, using arduino IDE., see following excerpt from the file:-


/* GPS protocol
NMEA - Standard NMEA protocol GGA, GSA and RMC sentences are needed
UBLOX - U-Blox binary protocol, use the ublox config file (u-blox-config.ublox.txt) from the source tree
MTK_BINARY16 and MTK_BINARY19 - MTK3329 chipset based GPS with DIYDrones binary firmware (v1.6 or v1.9)
With UBLOX and MTK_BINARY you don't have to use GPS_FILTERING in multiwii code !!! */

//#define NMEA
#define UBLOX
//#define MTK_BINARY16
//#define MTK_BINARY19
//#define INIT_MTK_GPS        // initialize MTK GPS for using selected speed, 5Hz update rate and GGA & RMC sentence or binary settings

The compiler kept throwing back an error message :-


Arduino: 1.8.13 (Linux), TD: 1.53, Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

GPS.cpp:1177:17: error: flexible array member in union
uint8_t bytes[];
^
exit status 1
flexible array member in union


at line 1177 in GPS.cpp, I changed the source from uint8_t bytes[]; to uint8_t bytes[32];
Apparently Arduino and CPP don't allow an array of undefined size in data structures.

This change seemed to allow the code to compile and my UBLOX NEO 6M GPS data was being transmitted to and reported by, MultiwiiConf.
I'm not sure that this is a good fix but it seems to work for me.

Hopefully someone more skilled than I can decipher this info and adjust the source code to make a robust solution to the problems I have experienced.
Thank you again for your excellent work in making this software available to the community. My hat goes off to you all!