Arduino src not shared, cpp shared, why?

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
sorenkuula
Posts: 13
Joined: Mon Sep 30, 2013 2:17 pm

Arduino src not shared, cpp shared, why?

Post by sorenkuula »

Hi,

I have looked at the MultiWii code and gotten it to compile in Arduino too, after adding a missing alarmArray. All fine so far...

I still need to understand the reasoning behind the structure of the project: There is a MultiWii folder with .ino contents and there is a MultiWii_shared with what seems to be essentially the same code but in C++. The shared code seems not to have been generated from the .ino code (the last time I looked, Processing tossed everything into one cpp source). MultiWii is not for editing, and MultiWii_shared is.
And that's where I get confused: Why is the shared code and the "readonly" in 2 different "languages" and why is the shared code in the output language of a possible compilation/generation process? If I wanted to make and publish some change, and have it compilable in Processing, I would edit MultiWii in Arduino IDE, ignoring MultiWii_Shared. Which is what I think I am not supposed to do.

Regards
Soren

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Arduino src not shared, cpp shared, why?

Post by timecop »

MultiWIi_Shared is the current "development" branch. It has been migrated to proper c/h structure about a month ago.
It will be copied over to MultiWii once 2.3 is released. .ino stuff is/has been/will be abandoned at that point.

If you are making any changes, you should make them against multiwiI_shared branch.

The code in _Shared is NOT auto-generated - it has been carefully cleaned up of all the arduino IDE lameness.

sorenkuula
Posts: 13
Joined: Mon Sep 30, 2013 2:17 pm

Re: Arduino src not shared, cpp shared, why?

Post by sorenkuula »

Hi,
Thank you very much for the clarification. BTW I'm happy to hear about the withdrawal of Arduino.
Now there's just a makefile or similar missing. Does everybody use Eclipse or similar to generate one?
Regards
Soren

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Arduino src not shared, cpp shared, why?

Post by timecop »

The junk can still "build" inside arduino. Though I suspect most people by now use eclipse to actually edit stuff.
In the cpp/h conversion thread (somewhere in this forum), there's instructions how to load (and build) entire workspace in eclipse.

sorenkuula
Posts: 13
Joined: Mon Sep 30, 2013 2:17 pm

Re: Arduino src not shared, cpp shared, why?

Post by sorenkuula »

Hi, in eg. Alarms.cpp, there is an #include "Arduino.h" . But in the file system layout, Arduino.h is not in the same directory as Alarms.cpp.
OK I really should find that migration thread you mentioned there, maybe there is a solution. But till then, what was the intension - that I get the compiler to have both directories on its source path (can GCC do that? It's an idea I know from Java), or to copy things, or that it should really be in <> in stead of "" and I set up a -I (by adding the include dir to eclipse libraries)?
Also I am still a little puzzled that the migrated code does not have a declaration for the alarmArray either. It is there somewhere, did I miss to uncomment something in config.h that gets it enabled?
Regards
Soren

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: Arduino src not shared, cpp shared, why?

Post by Alexinparis »

sorenkuula wrote:Hi,

I have looked at the MultiWii code and gotten it to compile in Arduino too, after adding a missing alarmArray. All fine so far...

I still need to understand the reasoning behind the structure of the project: There is a MultiWii folder with .ino contents and there is a MultiWii_shared with what seems to be essentially the same code but in C++. The shared code seems not to have been generated from the .ino code (the last time I looked, Processing tossed everything into one cpp source). MultiWii is not for editing, and MultiWii_shared is.
And that's where I get confused: Why is the shared code and the "readonly" in 2 different "languages" and why is the shared code in the output language of a possible compilation/generation process? If I wanted to make and publish some change, and have it compilable in Processing, I would edit MultiWii in Arduino IDE, ignoring MultiWii_Shared. Which is what I think I am not supposed to do.

Regards
Soren


Hi,

MultiWii folder was my own workspace at the beginning of this project.
_shared folders was created to open more the code to some committer contributions.
I don't update it anymore, and the only relevant folders are _shared.
To avoid confusion, I've just deleted MultiWii and MultiWiiConf folders.

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: Arduino src not shared, cpp shared, why?

Post by Alexinparis »

sorenkuula wrote:Hi, in eg. Alarms.cpp, there is an #include "Arduino.h" . But in the file system layout, Arduino.h is not in the same directory as Alarms.cpp.
OK I really should find that migration thread you mentioned there, maybe there is a solution. But till then, what was the intension - that I get the compiler to have both directories on its source path (can GCC do that? It's an idea I know from Java), or to copy things, or that it should really be in <> in stead of "" and I set up a -I (by adding the include dir to eclipse libraries)?
Also I am still a little puzzled that the migrated code does not have a declaration for the alarmArray either. It is there somewhere, did I miss to uncomment something in config.h that gets it enabled?
Regards
Soren


right, #include "Arduino.h" should probably be #include <Arduino.h>
alarmArray is declared in MultiWii.h

Basically, cpp/h code still compile in Arduino IDE if you open MultiWii.ino
Initial code was .ino files only, and there was a plebiscite to reorganize code with cpp/h structure.
There are probably still things that are still not at the good place.

dominicclifton
Posts: 202
Joined: Tue Feb 05, 2013 10:28 pm

Re: Arduino src not shared, cpp shared, why?

Post by dominicclifton »

Alexinparis wrote:
sorenkuula wrote:To avoid confusion, I've just deleted MultiWii and MultiWiiConf folders.


Thanks for that, when i checked out the code i spent a while fixing up that code only to find it was old and out of date. So yes, avoiding confusion is great, thanks!

Now how about that move to git instead of SVN?

sorenkuula
Posts: 13
Joined: Mon Sep 30, 2013 2:17 pm

Re: Arduino src not shared, cpp shared, why?

Post by sorenkuula »

Hi Alex,

For the include, the " " style actually works in Eclipse. Apparently Eclipse, when one project has a dependency to another, either copies the sources of both into a common directory somewhere, or it tells the compiler to include both as source. Anyway as soon as I did the compilation inside Eclipse, it worked.

Nice with the move out of Arduino :) Now there's just the Conf tool missing..

Regards
Soren

scanman
Posts: 74
Joined: Thu Jun 21, 2012 9:26 am
Location: Durban, South Africa
Contact:

Re: Arduino src not shared, cpp shared, why?

Post by scanman »

sorenkuula wrote:Now there's just the Conf tool missing..


do you want me to continue development on this: or did you have something else in mind?

viewtopic.php?f=8&t=3218&p=33031&hilit=config+tool#p33031

Post Reply