Dev Environment

Related to the development libraries, released by Curt Binder
Post Reply
jolt
Posts: 15
Joined: Fri Dec 13, 2013 2:44 pm

Dev Environment

Post by jolt »

Apologies if I've missed the answers to these, I'm new here and have been poking around but not found definitive answers...

First: I am an experienced C/C++ & embedded programmer (30+ years).

I have my RA hardware (RA Plus/PWM, Salinity and Wifi units) and have been playing with it. I've gotten my Kessil A360W and RA wifi unit working. At this point I think I get how the sketches and RA Arduino IDE are working at a high level and I understand that the dev libraries are managed via git hub.

I know that I want to use the wizard at first (until I solidify my understanding and get the basic outline of my code set up), but I DEFINITELY want to write my own code and minimize the maintenance effort of integrating my code in with wizard generated code. But I also want to stay on the path of least resistance that meets my goals! I've learned how to add a library and have the RA IDE see it and pull code into my sketch, but am concerned that this is a dangerous route from a configuration management perspective.

So, I have three goals: (1) I want to use git to pull the code, and (2) I want to work with structured programming techniques, not just paste my code into code generated by the wizard, and (3) I want to work outside the RA Arduino IDE at least for editing purposes.

Now the questions:

(1) What setup do power users recommend on Windows (IDE, git client, etc), and how well does it meet my goals above? (I've seen threads on eclipse and AVR IDEs, but they looked like they stalled out)
(2) What is the recommended way to manage my own code written outside the wizard (for example a new class for the Kessil A360W light) but continue to be able to incrementally bring up new features in my system with the wizard as I progress?
(3) Is it common to inherit from library base classes and override their methods (or is it even possible?)



Thanks!
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dev Environment

Post by rimai »

1. Yes, you can use any text editor for code editing, but I've seen people using Eclipse and Visual Studio, because they have arduino plug-ins that lets you upload codes directly from the 3rd party IDE.
The major problem you will face is the built-in auto-selection of features I've developed from the standard Arduino IDE.
Basically it scans the entire code looking for keywords and writes #define statements in the file ReefAngel_Features.h file. These #define will enable or disable features, such as expansion modules, webserver and any other feature that may increase the code. The list of keywords is located on \Documents\Arduino\update\feature.txt
It's a comma delimited file where each line is one feature and has 3 fields. The first is the #define that will be written in the ReefAngel_Features.h file, the second is the keyword and the 3rd is the short explanation that gets shown in the Arduino IDE when you hit compile/upload button. It shows below the line "The following features were detected:"
So, if you want to use any 3rd party code editors, you will need to either change the file ReefAngel_Features.h file manually or compile your code in Arduino IDE once to set the file before you can upload it from the 3rd party editor.
The good thing is that if you are set with your features, that file shouldn't change at all either. I don't see your code changing features unless you purchased a new expansion module or something.
So, to sum it up, I think you would be fine to use a 3rd party editor until you bought a new expansion module, at which point you would have to compile the code at least once in the Arduino IDE to be able to have a successful compilation on the 3rd party IDE.
2. If you were to create a new class for kessil, I'd love if you could share it, so others would be able to use it too :). The best way would be to send a pull request in our github dev branch to have it merged into our libraries.
There are other ways too. You could also simply create new functions in the code itself and just call them from inside loop().
The kessils basically use the 2 dimming channels and you can have it coded to have anything you have in mind, really... :)
Right now, what we have are simple Slope and Parabola waveforms that control the sunset and sunrise effect.
3. Not sure if you can inherit and override methods. I think you can, but I know you can inherit and have new methods. KRavEN would be the best person to answer this question. He was the one who created the RA_Wiznet5100 class that inherited the RA_Wifi. Take a look at the files RA_Wiznet5100.h and RA_Wiznet5100.cpp
I think the protected methods are overrides.

I hope this gave you a little bit of light in understanding how things work. I'm pretty sure that with this much experience, you will have no problems grasping the whole thing in no time.
Roberto.
jolt
Posts: 15
Joined: Fri Dec 13, 2013 2:44 pm

Re: Dev Environment

Post by jolt »

Thanks for the quick reply Roberto. I have no problem using the RA IDE for final compile and upload. I think I will just use emacs to edit any .h/.cpp files I create and use RA IDE + wizard to create/maintain the .ino file. If I understood you correctly that should work fine, and I only need to worry about the wizard stomping on my edits in the .ino file if I add features or move things around on the relay box :)

The main reason I want to do my own Kessil class is to make the nomenclature of the PWM methods a little more intuitive for the Kessil. So basically I am pondering a really thin class that either wraps the PWM functionality or inherits from it. I am considering mapping RA:daylight channel to A360:intensity, and RA:actinic channel to A360:temperature. Goal is to make all of that more intuitive for the Kessil user. Then I might want to make the lights menu labels 'intensity' and 'temperature' as well. Ultimately I would want to make the web portal reflect that too if it is even possible.

I'll read through the example you pointed me to to help me decide which approach to take (wrapper versus inheritance) ...

Thanks again,
Jim
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dev Environment

Post by rimai »

Cool.
Yes, I use Eclipse myself to edit all .h/.cpp files and RA Arduino IDE to compile and update :)
Roberto.
User avatar
Xender
Posts: 105
Joined: Sun Mar 20, 2011 12:38 am
Location: France

Re: Dev Environment

Post by Xender »

I have error when I compile with ReefAngel.Star(); :

Code: Select all

/Documents/Arduino/libraries/ReefAngel/ReefAngel.h:126: error: 'RA_Wiznet5100' does not name a type
:cry:
Fresh Water Aquarium 180*60*80
Salt Water Aquarium 60*60*60
Click Here to see the Video of my Fresh Water Aquarium
Image
Post Reply