cocktailyogi / EggDuino

Arduino Firmware for Spherebot / Eggbot integration in Inkscape
MIT License
91 stars 138 forks source link

Compatibility for Arduino IDE 1.5+ #13

Open spaelectronics opened 8 years ago

spaelectronics commented 8 years ago

Arduino no longer handles inline functions the same.

To make this code work, I had to add the following to the EggDuino.ino

// Function prototypes void sendAck(void); void sendError(void); void loadPenPosFromEE(void); void storePenUpPosInEE(void); void storePenDownPosInEE(void);

krikz commented 8 years ago

rename functions.ino to _functions.ino

spaelectronics commented 8 years ago

Tried that, it still threw errors.

krikz commented 8 years ago

and reorder methot loadPenPosFromEE body before initHardware in Hepler_Functions.ino

spaelectronics commented 8 years ago

Okay, well I'm going to stick with my method, as it's a more "future proof" way of doing it.

I was just throwing out there that you should fix the code for IDE 1.5+

caravanserei commented 8 years ago

I encountered the same problems with the latest IDE 1.6.7 and could get rid of the compiler error messages by simply swapping every "void inline" to "inline void". This method is not as future-proof as spaelectronics', but provides a smooth compilation, too ;-)

spaelectronics commented 8 years ago

Interesting.. I'll have to check that out.

caravanserei commented 8 years ago

By the way: I get similar problems with different error messages when I try to simply activate the outcommented button defines in IDE 1.6.7. The Compiler runs smooth again, when a prototype for the called functions (setprgButtonState etc.) is added just above the object creation or, better, in button.h ...

urs8000 commented 8 years ago

using 1.6.7: I just deleted all "inline" in Helper_Functions; "inline void" also works

Viper-Gtr commented 8 years ago

@caravanserei I have this problem too. But how do you resolve exactly?

caravanserei commented 8 years ago

@Viper-Gtr As I wrote: simply declare a prototype before the function is called first time. You can do this either in button.h (where a vintage C-programmer most likely would place it ;-) or, alternatively, do it immediately before the C++ function creation is called like this. A prototype is not a real function call (you will not find this line in the µC-code) but a sort of structuring help for the compiler/linker.

Usually the Arduino environment keeps those formalistic details of the real C-world away from you; but obviously something has changed recently...

ifdef prgButton

void setprgButtonState(void); Button prgButtonToggle(prgButton, setprgButtonState);

endif