Hmm, okay…
First, the code that was on GitHub at the time you wrote this definitely compiles in the Arduino IDE and runs properly on a Model 01. (I did have a pretty bad bug where one of the constructors wasn’t setting rgbLookupExc which I fixed right before going to bed, but that was before you wrote this).
I did try moving the constructors into the .h and inlining them, and that seems to work fine, however it actually ends up using 260 bytes MORE progmem than it otherwise did. (I have no idea how that works, but I’ve seen other weird behaviour, like how adding extra constructors seems to decrease memory usage).
I’m not sure if, with respect to themeSelect() you were talking about this:
void themeSelect();
template<typename IntType> void themeSelect(IntType themeID);
Is it not acceptable to overload themeSelect() in this manner? The first function just selects the default theme, but with a parameter, it selects any of them via a switch statement. I’ll change it to themeDefault() for clarity and to avoid confusion and potential errors in the future, but this has no effect on how anything runs.
This must not be compiling the entire switch statement, because using a constructor that uses the themeSelect(int) version uses about 3KB more RAM.
Perhaps I should rename themeSelect() anyways, just for clarity.
Since based on my quick demo, inlining constructors in the header increases memory usage, I will leave it as is for now unless you can provide me an explanation that I’m doing this horribly incorrectly…
Here’s the code I created in Kaleidoscope-LEDEffect-FunctionalColor.h (and removed from .cpp)
inline FCPlugin(byte brightness, RGBLookupException rgbLookupExc)
: exceptionsLookup(rgbLookupExc)
{
themeDefault();
brightnessSetting = brightness;
}
inline FCPlugin(RGBLookupException rgbLookupExc, byte brightness = 210)
: exceptionsLookup(rgbLookupExc)
{
themeDefault();
brightnessSetting = brightness;
}
inline FCPlugin(byte brightness, RGBLookupException rgbLookupExc, int theme)
: exceptionsLookup(rgbLookupExc)
{
themeSelect(theme);
brightnessSetting = brightness;
}
inline FCPlugin(RGBLookupException rgbLookupExc, byte brightness, int theme)
: exceptionsLookup(rgbLookupExc)
{
themeSelect(theme);
brightnessSetting = brightness;
}
// Another constructor that uses the default theme and allows an optional brightness.
inline FCPlugin(byte brightness = 210){
// Switch block to specify themeid
themeDefault();
brightnessSetting = brightness;
}
// Another constructor that uses the default theme and allows an optional brightness.
inline FCPlugin(byte brightness, int theme){
// Switch block to specify themeid
themeSelect(theme);
brightnessSetting = brightness;
}