OK so to clarify what happens, you simply have 2 sets of presets.
Set A gets used if the blade is in,
set B gets used when the blade is out.
All you need to do as far as which blades get used and which are Black is to write styles for the appropriate presets the way you want.
For testing, I would suggest just a simple solid color that you can replace with a “real” style later, so you can identify which blade is which. (main is pretty obvious, but still…)
ok.
Since you have 3 blades, you need to set NUM_BLADES 3
So first, since you have zero wiring done specifically for Blade Detect or Blade ID properly, we need to use a BLADE_ID_CLASS that can sort of figure it out with the existing wiring.
That’s going to be define that goes in your CONFIG_TOP section that will useSnapshotBladeID
.
You also need to tell the OS which LED pad(s) need to have power on even though the blade is turned off, so that it can sense the blade anyway.
The defines and explanatory comment look like this:
#define ENABLE_POWER_FOR_ID PowerPINS<bladePowerPin2, bladePowerPin3>
#define BLADE_ID_CLASS SnapshotBladeID<bladeIdentifyPin>
// The following will use the speed-of-charging-a-capacitor method of blade ID which sometimes works without resistors
// Blade ID can detect if a blade is connected or not, but it won't actually reach the NO_BLADE value,
// so it's recommend to use something like 200000 instead of NO_BLADE in the blades[] array.
#define BLADE_ID_CLASS SnapshotBladeID<bladeIdentifyPin>
Next, you’ll need your 2 sets of presets, which you had set up correctly, but all blades need to be included.
So this is where if you want the main blade on (because the blade is in) but the chassis stuff to be off, then you’ll do a normal blade style for the main blade, then Black styles for the accent blades. Thusly:
#ifdef CONFIG_PRESETS
Preset bladein[] = {
{ "SomeFont", "tracks/SomeTrack.wav",
// Main Blade
StylePtr<Red>(),
// Behind Chassis LEDs (likely since it's the 8 pixels)
StylePtr<Black>(),
// In-Hilt accent LEDs
StylePtr<Black>(), "somefont'}
};
Preset noblade[] = {
{ "Font", "tracks/track.wav",
// Main Blade
StylePtr<Black>(),
// Behind Chassis LEDs (likely since it's the 8 pixels)
StylePtr<Green>(),
// In-Hilt accent LEDs
StylePtr<Blue>(), "somefont'}
};
Then the BladeConfig as you had it, but with all 3 blades in each, and the value for the NOBLADE replaced with the suggestion above.
BladeConfig blades[] = {
{ 0, WS281XBladePtr<108, bladePin, Color8::GRB, PowerPINS<bladePowerPin1, bladePowerPin2, bladePowerPin3> >(),
WS281XBladePtr<8, blade2Pin, Color8::GRB, PowerPINS<bladePowerPin4> >(),
SimpleBladePtr<CH1LED, CH2LED, NoLED, NoLED,bladePowerPin5, bladePowerPin6, -1, -1>(),
CONFIGARRAY(bladein), "00_bladeinSave"},
{ 200000, WS281XBladePtr<108, bladePin, Color8::GRB, PowerPINS<bladePowerPin1, bladePowerPin2, bladePowerPin3> >(),
WS281XBladePtr<8, blade2Pin, Color8::GRB, PowerPINS<bladePowerPin4> >(),
SimpleBladePtr<CH1LED, CH2LED, NoLED, NoLED,bladePowerPin5, bladePowerPin6, -1, -1>(),
CONFIGARRAY(no_blade), "01_nobladeSave"},
};