I’ve been reading through Kaleidoscope in an attempt to understand the code, and I’ve got lots of little questions (e.g. “Where is KALEIDOSCOPE_HARDWARE_H defined? I can’t find that anywhere…”). I don’t feel like it’s appropriate to bring all those little questions up here, but I would like to get some enlightenment from @jesse, @algernon, and/or anyone else who understands it well enough. I’d also like to add lots of comments to that code as I go, and offer those up as pull requests to the repository (probably with a few actual code changes, too), to benefit people (myself included) who are trying to do the same in the future.
How should I go about doing this without constantly distracting the people who are most critical to real improvements to Kaleidoscope?
Either IRC, or these forums, I’d sya. As long as the questions are in a single thread, it’s not a distraction. The forums have the advantage of being perhaps a little friendlier and easier to search back, and may prove more educational for others. We’ve had great success on IRC too, mind you. Only thing about IRC is that it is only really useful if you have a client that can stay there without disconnecting, because in a lot of cases, we can only answer a few hours later (depending on timezone, or babies, or whatever).
Definitely a good idea to write your discoveries too — I’ve been trying to do the same as well so the next person to come along doesn’t need to spend a day reading source & asking Algernon & Jesse (my current crowning achievement being making the README for Ranges longer than the source ) .
To answer this question in particular - it’s a tricky one, it’s actually defined by the Arduino build system based on which platform you’re compiling for. (In the Arduino IDE, this is controlled by the Tools->Board option.) So, every file is compiled with -DKALEIDOSCOPE_HARDWARE_H=foo for some value of foo.
Yep, it’s “Kaleidoscope-Hardware-Model01.h” (a file provided by the plugin Kaleidoscope-Hardware-Model01). Highly related is the plugin Kaleidoscope-Hardware, which provides a base class which defines the interface between Kaleidoscope and each of the hardware plugins (like Hardware-Model01).
Can’t do that right now as I am far away from any source code. My post was directed to all those that are new to exploring source code. That’s why I skipped all regex magic for more sophisticated search queries.
Also, if you’re doing lots of source code diving, you should totally install https://github.com/ggreer/the_silver_searcher – it gives you a command called ag, which is like grep, but a) recursive by default and b) aware of git and most importantly, .gitignore files, so a bunch of false positive noise you get with grep is eliminated.
I will absolutely check that out! Sounds like something I might find myself using at work, too. I find myself really missing a lot of IntelliJ IDEA’s features when looking for header files (day job is mostly java), but haven’t been willing to spring for the subscription that includes CLion. At risk of derailing this thread - @Javaru, I know you’re a huge IntelliJ fan - do you have the ultimate license?
jesse@szx:~/git/Arduino-Boards (master)$ grep -ri KALEIDOSCOPE_HARDWARE_H *
libraries/Kaleidoscope-Hardware/src/Kaleidoscope-Hardware.h: * KALEIDOSCOPE_HARDWARE_H - filename of the file Kaleidoscope should include for
The Arduino-Boards repo is our Arduino hardware definition package, including libraries. If you’re going to go grepping, it’s more likely to be a good starting point, since it includes Kaleidoscope, plugins AND our arduino board and platform files.
@kajsa.anderson I assume you mean the All Products Pack? Yes I have that, so I have a license for CLion. (Keep in mind you can also buy it individually for USD $89 for a personal license).
I have Kaleidoscope (mostly) configured in it so I can play around and easily navigate through the code. I like the code browsing benefits of a good IDE. I still have nightmares of writing code on a green screen VAX terminal in my youth This is a bit nicer:
Besides, given that I have not touched C or C++ in over 20 years, I need all the help I can get. After all, my avatar is Javaru and not Cguru for a reason.
I took a look at that, actually, and there’s a “non-commercial” requirement for their free license, so I’m not sure Kaleidoscope would qualify, though it might since the firmware itself isn’t a commercial product. IANAL, etc. Keyboardio would qualify for their 50% pricing for startups, though, unless you formed the company longer ago than I realize.
@Javaru - I’ve already got a personal subscription for IntelliJ, which is why I wondered about the All Products pack. Looking at it, I’d be ahead to do a separate CLion subscription rather than take the hit for the first year of the other option. I’ve got a query in to their sales folks to see if they have any discount available, though.
@kajsa.anderson - I dropped them a line asking if they’d be willing to consider an opensource license for kaleidoscope, with an explicit exception that it’s not usable by anyone who’s paid to hack on the project. I’ll report back.