Using leo to _refactor_ Arduino c++ code and libraries. A bad idea ?

14 views
Skip to first unread message

Christophe Vermeulen

unread,
Mar 22, 2022, 11:59:10 AM3/22/22
to leo-editor
OK. Soo, one of my back burner projects (I'm only doing telecoms on the front burners, I'm not a programmer though I started programming in 1987) is to refactor a project using 8-bit RF-capable Arduinos in an IoT network. I'm still not sure leo is the right tool for that, but it could be, as there are several arguments for using leo :
- the most important thing to me is documentation. /* */ and // are not enough
- there are about 20-30 files in the library, and 5-10 "sketches", potentially more to come
- I'd  like to have some more powerful motes as well, maybe using micropython (on ESP32?), maybe using Raspberry PI, all pretty much undecided at the moment
- I'd like to "clean" the RF library that has IMHO too many files and not consistent
- The original maintainer stopped activity and support, so I'm kindof on my own
- I need to maintain the apps, it keeps me warm at night (literally, it manages my heating and solar systems)
But, although maybe it's just me, there is a big BUT : the code is in C++, to be compiled by the Arduino IDE and downloaded on the motes thru USB/Serial. And I'm willling to learn, and also potentially use leo for 4-10 other projects, but I still am in the early discovery phase, not even knowing of the "clones" share any concept with functions.

Any recommandations from the leo core-team ?

tbp1...@gmail.com

unread,
Mar 22, 2022, 1:24:11 PM3/22/22
to leo-editor
Assuming that Leo can run on the machine that cross-compiles your project, the easiest way to go would be to write a batch file that does the build - maybe there already is one - and launch that from within Leo.  You can set up your project within Leo by importing all the files.  It's possible to do a "recursive import" to get a whole directory tree, but someone else should tell you how to do that since I have never tried it myself.  @Edward does it all the time.  You probably should try out importing a single one of the .cpp files to learn how this all works.

Files will get imported into a subtree with a headline starting with @auto followed by the path to the file.  Most people will probably change that to @file.  The importer will take a stab at making a good organization, but you can change it if you want, especially after you gain some experience.  Imported files will be found under a new node at the end of the outline named "Imported Files".

Oh, yes, by "Import" I mean by using Leo's File/Import Files/Import any File menu item.  The recursive import would be done by some command.  And you can import and probably should any and all files, not just program files.

This should be enough to get you started...
Reply all
Reply to author
Forward
0 new messages