I was thinking it would be a good idea to have a code section separate from patterns where you could put code used in all patterns.
You could put routines/controls/variables in there that are used by multiple patterns. Something like global speed, or relay on for power to the LED’s.
I’m suggesting this, because I have found that I am copying and pasting the same code/controls/variables over and over into different patterns, as they all have the same controls, and are controlled via websocket (so the variables are the same also).
Then utility functions (I have HSV2RGB, RGB2HSV, and Relay_Control functions for example) could be separate from actual pattern code.
Exported variables and controls in the “Common Code” section would appear for all patterns (even if not used for that pattern). There may be a better way of doing this, maybe some sort of “include” mechanism? ie the common code section is only included if you specifically “include” it?
What do you think?