CONFIG_STYLES usage guidance

Working on incorporating some of the flash saving features to pack more into a config and I want to use the CONFIG_STYLES feature of the config. Please tell me if I am using it correctly in the example below (I have left out other sections of the config to keep things cleaner to see).

Preset presets[] = {
	{ "SmthJedi", "tracks/mars.wav",
		StylePtr<Smpl_Sprk_Tip>()("~ ~ ~ ~ ~ ~ 65535 0 0"), //Change Lockup to Red
		StylePtr<Smpl_Sprk_Tip>()("0 65535  0~ ~ ~ ~ ~ ~"), //Change blade to green

BladeConfig blades[] = {
{ 0, 
	WS281XBladePtr<20, bladePin, Color8::GRB, PowerPINS<bladePowerPin2> >(),
	WS281XBladePtr<20, blade2Pin, Color8::GRB, PowerPINS<bladePowerPin3> >(),
	WS281XBladePtr<20, blade3Pin, Color8::GRB, PowerPINS<bladePowerPin4> >(),
	CONFIGARRAY(presets) },

	using Smpl_Sprk_Tip = 
	add to preset as StylePtr<Smpl_Sprk_Tip>()

You don’t need the ‘StylePtr’ in the using statement, it should be:

	using Smpl_Sprk_Tip = InOutSparkTip<EasyBlade<RgbArg<BASE_COLOR_ARG,Blue>,RgbArg<CLASH_COLOR_ARG,Red>,RgbArg<LOCKUP_COLOR_ARG,Orange>>,300,800>;

Also, if you want to put parameters in, you don’t add another set of paranthesis, and colosr are written as R,G,B. Finally, argument 7 is IGNITION_COLOR_ARG, LOCKUP_COLOR_ARG is argument 11, so…

		StylePtr<Smpl_Sprk_Tip>("~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 65535,0,0"), //Change Lockup to Red

But other than that it’s correct… :slight_smile:

I feel it’s also worth mentioning that using the using syntax won’t save memory (as opposed to creating the same config not using using), it’s purely for organization/readability purposes

My Config Helper will assist with this. As noted using functions on their own don’t save memory. It’s a piece in the puzzle. The combination of library styles with options, using functions and style arguments are how you can accomplish and my config tool handles easily. Just watch the videos at the top and read through the selections and instructions.

More info in this thread.

So the using style should have been spelled out more so as to see all of the color locations.
like this…


Using that each RgbArg is equal to 3 integers when I am passing options. Am I counting correctly here? 12 total?

	RgbArg<BASE_COLOR_ARG,Blue>,				//3 integers
	RgbArg<CLASH_COLOR_ARG,Red>,				//3 integers
	RgbArg<LOCKUP_COLOR_ARG,Orange>>,			//3 integers
	300,800,									//Not counted, because not Args
	RgbArg<IGNITION_COLOR_ARG,White>>			//3 integers

If I added the args for ignition and retraction time I would be up to 15 total I can pass in when using the function in a style?

Kind of, they’re comma separated though. Not space separated… that difference is important for the default arguments.

Style Arguments must be in a specific order and you must account for the unused ones with “~”, it’s much harder by hand, that’s why I built the tool into the Config Helper to decipher, set/update and handle the syntax for you :wink:
More information here if you want to do it by hand, but the Config Helper will make it 100x easier and preview the changes for you (see links I provided above).


RgbArgs are not equal to three integers.
A color is written something like this: 65536,0,0
There are no spaces, and it’s counted as a single argument.
(Arguments are separated by spaces)


Thank you for sharing this again… I had lost track of it. Link saved.