MultiWii 2.2 compiling : errors

This forum is dedicated to all issues and questions related to your individual setups and configurations
Post Reply
confrey
Posts: 6
Joined: Sun Jun 09, 2013 12:36 pm

MultiWii 2.2 compiling : errors

Post by confrey »

Hi everybody,
first time trying to use MultiWii software; i bought e HobbyKing flight controller, inegrated board, with a Arduino PRO 5V ATMega328 and a FREEIMUv_035BMP, the board worked 'out of the box' (never used it for flying, only attached to PC) with a Quad+ configuration; I tryed to put in the 2.2 version with QuadX configuration, but when I try to verify and/or compile the code, I get these errors :


MultiWii.ino:67:21: error: variable or field ‘SerialGpsPrint’ declared void
MultiWii.ino:67:21: error: ‘prog_char’ was not declared in this scope
MultiWii.ino:67:32: error: ‘str’ was not declared in this scope

the malformed line isn't the nr 67, but (I suppose) the nr. 212 line of GPS.ino;

I followed these instructions :

5. Select the config.h tab and uncomment (remove “//”) the parameters as
below, be sure to comment (“//”) the unused ones in each group:
a. Select the Min throttle for your ESCs..this is the lowest value the
controller sends to any motor during flight...you want them still
spinning at this value or you run out of control.
b. Choose the copter configuration
c. Reverse the yaw sense if needed
d. Use : #define I2C_SPEED 400000L
e. Use: #define INTERNAL_I2C_PULLUPS
f. Use: #define RCAUXPIN8 or #define RCAUXPIN12 if you want to
use AUX2 for mode selection in addition to AUX1
g. Use: #define FREEIMUv035_BMP
h. Use: #define MAG_ORIENTATION(X, Y, Z) {magADC[ROLL] = -Y;
magADC[PITCH] = X; magADC[YAW] = Z;} note this has to be
entered manually, not already there but commented out...else
compass heading is off 90deg
Everything else is left as is....

as read by a .pdf found on HobbyKing site.

I can assume the problem is not regarding the hardware itself, because I can't veify adn/os compile the sketch even if I have not referenced any board or sensor.

Please tell me what can I do, I've a quad ready to test (and to fly, I hope... ) but I'd like tu use 2.2; I loaded 2.1 without problems, but I have trouble to configuring it : the grid portion of GUI, reporting which features are on or off (LEVEL, GPS, BAro and so on) is not visible unless I detach receivers cables from the board... but it's an other type of problem, I'd like to use 2.2 first.

Thanks to all, and excuse my English

Regards

Tvixen
Posts: 18
Joined: Sun Jun 02, 2013 7:10 pm
Location: Tune - Denmark

Re: MultiWii 2.2 compiling : errors

Post by Tvixen »

confrey wrote:Hi everybody,
first time trying to use MultiWii software; i bought e HobbyKing flight controller, inegrated board, with a Arduino PRO 5V ATMega328 and a FREEIMUv_035BMP, the board worked 'out of the box' (never used it for flying, only attached to PC) with a Quad+ configuration; I tryed to put in the 2.2 version with QuadX configuration, but when I try to verify and/or compile the code, I get these errors :


MultiWii.ino:67:21: error: variable or field ‘SerialGpsPrint’ declared void
MultiWii.ino:67:21: error: ‘prog_char’ was not declared in this scope
MultiWii.ino:67:32: error: ‘str’ was not declared in this scope

the malformed line isn't the nr 67, but (I suppose) the nr. 212 line of GPS.ino;

Thanks to all, and excuse my English

Regards



Hi there
U have to read all the (non existing) doc there is on the net. Ok there is some info, but not enough. First of all, u havt learn Arduino. Read the howto on anduino's homepage. Next- read threads in forum (with out asking) read this http://www.rcgroups.com/forums/showthre ... ight=gps+5 and u will get a god understanding of what needs to be done. Although this thread is not about your hardware.

Only then, u will see why u have this error. There's no shortcut to these projects :) and u will learn alot by reading the net, hours after hours, about this.

Happy hovering /Tvixen :)

confrey
Posts: 6
Joined: Sun Jun 09, 2013 12:36 pm

Re: MultiWii 2.2 compiling : errors

Post by confrey »

Tvixen wrote:Hi there
U have to read all the (non existing) doc there is on the net. Ok there is some info, but not enough. First of all, u havt learn Arduino. Read the howto on anduino's homepage. Next- read threads in forum (with out asking) read this http://www.rcgroups.com/forums/showthre ... ight=gps+5 and u will get a god understanding of what needs to be done. Although this thread is not about your hardware.

Only then, u will see why u have this error. There's no shortcut to these projects :) and u will learn alot by reading the net, hours after hours, about this.

Happy hovering /Tvixen :)


I don't know how much time I spent to read and to learn, but I think it's enough... if I try to verify and/or compile a simple example of one of several sketches, simply I don't get errors, so I can think the software is good... and so I have to think the contrary about 2.2 source code, for that I tried to ask here, after searching many many times to solve this problem; so, the simple question is :

1) dowload the 2.2 source code
2) open it into the arduino-ide
3) choose the appropriate arduino board
3) click on the 'Verify' button

what's happen? if are there errors, why?

thanks

Tvixen
Posts: 18
Joined: Sun Jun 02, 2013 7:10 pm
Location: Tune - Denmark

Re: MultiWii 2.2 compiling : errors

Post by Tvixen »

confrey wrote:
I don't know how much time I spent to read and to learn, but I think it's enough... if I try to verify and/or compile a simple example of one of several sketches, simply I don't get errors, so I can think the software is good... and so I have to think the contrary about 2.2 source code, for that I tried to ask here, after searching many many times to solve this problem; so, the simple question is :

1) dowload the 2.2 source code
2) open it into the arduino-ide
3) choose the appropriate arduino board
3) click on the 'Verify' button

what's happen? if are there errors, why?

thanks


I can tell u that I've spend 100 hours reading on this multiwii stuff, and am still a novice :D So u haven't read enough :shock:

MultiWii.ino:67:21: error: variable or field ‘SerialGpsPrint’ declared void U get a error from the config.h because u defined a GPS.

Apparently you have no gps on that board ! .... So go back to the config.h and remove ur "#definision GPS " (and all the other things u don't have) Go through the whole code in config.h and remove this code.

Code: Select all

    #define GPS_SERIAL 2 // should be 2 for flyduino v2. It's the serial port number on arduino MEGA
    //#define GPS_BAUD   57600
    #define GPS_BAUD   115200


   /* 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


Lets say that u don't want GPS. Go into config.h find some GPS code.

Code: Select all

  #define GPS_SERIAL 2 // should be 2 for flyduino v2. It's the serial port number on arduino MEGA
//#define GPS_BAUD   57600
  #define GPS_BAUD   115200

OK u found something here. See the difference in the code... // means "dont compile this code for my board"
So u do the following

Code: Select all

   //#define GPS_SERIAL 2 // should be 2 for flyduino v2. It's the serial port number on arduino MEGA
   //#define GPS_BAUD   57600
   //#define GPS_BAUD   115200



Go through the whole code in config.h ... Remove things u don't want. Compile and lets see if it has solved ur problem.

/Tvixen

squid10
Posts: 20
Joined: Sun May 12, 2013 8:24 pm

Re: MultiWii 2.2 compiling : errors

Post by squid10 »

i don't understand which board is this,
paste here the exact link to the board and i"ll modify the sketch for you.
any way, something there is stink cause usually you don't need to change so many things in the config.h file
which ESC do you have?

User avatar
elf128
Posts: 11
Joined: Sun Jun 23, 2013 8:35 pm

Re: MultiWii 2.2 compiling : errors

Post by elf128 »

Just got the same error, while compile of V2.2
Day of source reading shows that it's simply bug.
In V2.1 there was not such function as SerialGpsPrint in GPS.ino, since V2.2 they add it and have hidden under #if ... #endif, so if you're trying to build it without GPS, SerialGpsPrint(prog_char* str) is not defined.
However, because arduino doesn't use .h files preprocessor generate one big cpp file from all your .ino and put predeclaration of functions, classes, variables and other global stuff. Seems like preprocessor of Arduino simply ignore the fact that this function isn't defined in some cases. You can open pregenerated .cpp file ( It's in your temp directory ) and notice predeclaration in line #71:

Code: Select all

void SerialGpsPrint(prog_char* str);


Bottom line, It's limitation of Arduino IDE. I think, authors are using something else ( cause it's just awful from perspective of developer ) that's why they didn't hit that problem.
Unfortunately, I'm new here and I don't know the way of reporting of the bug.
If you remove this line and try to build it manually, code are building just fine.
I'll try to find normal fix or workaround.

User avatar
elf128
Posts: 11
Joined: Sun Jun 23, 2013 8:35 pm

Re: MultiWii 2.2 compiling : errors

Post by elf128 »

Ok, my bad. The issue was not in declaration of the function, but in prog_char type itself.
It's deprecated type and if you're using avr-libc v1.8 it's not defined any more.

The fix is simple.
1. put additional line into very end of def.h

Code: Select all

typedef char PROGMEM prog_char;


2. make sure you're including def.h AFTER avr/pgmspace.h
Modify beginning of your MultiWii.ino from this:

Code: Select all

#include "config.h"
#include "def.h"

#include <avr/pgmspace.h>
#define  VERSION  220

to this:

Code: Select all

#include "config.h"
#include <avr/pgmspace.h>
#include "def.h"
#define  VERSION  220


Good luck everybody.

User avatar
elf128
Posts: 11
Joined: Sun Jun 23, 2013 8:35 pm

Re: MultiWii 2.2 compiling : errors

Post by elf128 »

Hehehe, even more simple:
Just put

Code: Select all

#define __PROG_TYPES_COMPAT__ 
in the end of def.h

Enjoy.

jdwang
Posts: 1
Joined: Mon Jan 18, 2016 2:59 am

Re: MultiWii 2.2 compiling : errors

Post by jdwang »

elf128 wrote:Hehehe, even more simple:
Just put

Code: Select all

#define __PROG_TYPES_COMPAT__ 
in the end of def.h

Enjoy.



Thanks for elf128

Finally I compile successed of 2.2 :D

Post Reply