Question about Blade detect and Subblade config

Hello,

I am not sure I understand what Blade detect does exactly. The way I see it, when a blade is inserted, the blade lights up and a sound can be played. Do the LED’s on the Shtok NPXL v3 connector also turn off or do they stay on ?

When the blade is removed, I would assume that the blade turns off (duh - it’s removed), a sound is played and the NPXL connector lights up ?

Is there something else that happens when the blade is inserted/removed ?

Now for the SubBlade part. Do I need the NPXL connector to be 2 SubBlades or can it also be a single blade ?

BladeConfig blades[] = {
 { 0, WS281XBladePtr<144, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
    SubBladeWithStride(0, 15, 2, WS281XBladePtr<16, blade2Pin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
    SubBladeWithStride(1, 15, 2, NULL),
    WS281XBladePtr<1, blade3Pin, Color8::GRB, PowerPINS<bladePowerPin1> >(),
    CONFIGARRAY(presets) },
 { NO_BLADE, WS281XBladePtr<144, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
    SubBladeWithStride(0, 15, 2, WS281XBladePtr<16, blade2Pin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
    SubBladeWithStride(1, 15, 2, NULL),
    WS281XBladePtr<1, blade3Pin, Color8::GRB, PowerPINS<bladePowerPin1> >(),
    CONFIGARRAY(no_blade_presets), "nb_save" },
};

I guess I do not understand the point of this SubBlade thing with regards to the NPXL connector. If I understood correctly it has 16 pixels (from 0 to 15), SubBlade 0 uses all 16 of them and SubBlade 1 also uses all 16 of them ? So why not have 1 blade that uses all 16 and that’s it ?

Thank you for your enlightenment.

P.S.: I have read ProffieOS Documentation: Blade Detect
and
ProffieOS Documentation: Blade Configuration but I do not see how or why it should apply to the NPXL connector ?

P.P.S.: The above config extract comes from Proffieboard V3 & I would like to understand why I should use it like that or if I need to use it like that ?

The easiest thing to get at quickly is probably this:

You’re correct in that both SubBlades can be considered as spanning the entire “length” of the NPXL connector. However, the important thing to note is the “Stride” value. That 2 as the third “argument” to SubBladeWithStride.

This makes it so that the SubBlade uses every other (once every 2) pixel. The reason for this is that the NPXL connector LEDs are set up in such a way that they’re all wired in series/in-line, with the first one being (I don’t know exactly, this is for illustration) an outside pixel at one position on the circle, then an inside pixel on that same point on the circle. Then you rotate and the next pixel is an outside pixel, and so on and so forth. So by splitting the SubBlade like this you get individual control of the inside and outside rings, if that makes sense.

Blade it switches between two separate settings, and it’s up to your configuration if that turns things on/off or not. Blade ID can work exactly as you describe, but it can also do other things.

I think a lot of people thought “it would be cool if the rings on this thing lit up in a nice circular ignition pattern”, and Profezzorn added that to the configurator. It really does look cool. Otherwise the light up in the order of the layout in the NPXL manual.

This is totally up to you.
Blade detect can be setup to just use the same, single Preset [] array, or you can set up 2 different ones, where each one would be for each state of the blade.

The BladeConfig you posted is set to look for 2 different CONFIGARRAYs, one named “presets” and one named “no_blade_presets”

So in the array named “presets” where there’s a blade, you could just set the blade styles so the main blade does something nice, while the NPXL connector is just black like

Preset presets [] = {

{ "font", "track",
StylePtr<...main blade style here ...>(),
StylePtr<Black>(),
"blade in preset example 1"}

};

Then in another array named “no_blade_presets”, you’d do the opposite, where the main blade is black and the connector does stuff like

Preset no_blade_presets [] = {

{ "font", "track",
StylePtr<Black>(),
StylePtr<...NPXL blade style here ...>(),
"no blade preset example 1"}

};

Note that if you subBlade the NPXL, such as you have above, you’d need a style for each blade, so 2 would be black etc…

Yes it does.

So would I need one blade or two subblades to create a rotation effect like this on the NPXL connector:

And how is that pattern called?

Even if I only have one blade or several identical blades ?

I mean I do not see the point of setting up Blade ID if all the blades are identical or if I only have one.

I guess I need to see both to chose.

And I also have the 1 pixel for the crystal chamber. Also what kind of “tricks” can a 1 pixel do ?

zero.
subblade lets you have two separate rings and control them independently.

The style used to create the rotating effect can be found here:

1 Like

I must apologize for mixing up the terms here.
I meant to say “Blade Detect”.
Blade Detect lets you have different settings for when the blade is inserted and when it is not. Without blade Detect, the saber will not notice when you remove or insert the blade, it will do the same thing regardless.

Blade ID lets you have different settings for different blades. This can be used to tell ProffieOS the length of the blade, or some people hook it up to the crystal chamber to have different crystals create different colors.

Both are entirely optional, and if you don’t see a need for it, then don’t bother with it.

1 Like

Can you confirm if I used the StylePtr(), correctly ?

I have no idea how/where to use that ?

#ifdef CONFIG_TOP
#include "proffieboard_v3_config.h"
#define NUM_BLADES 4
#define NUM_BUTTONS 2
#define VOLUME 1000
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 1.0
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#define SHARED_POWER_PINS
#define BLADE_DETECT_PIN blade5Pin
#define ENABLE_SERIAL
#define ENABLE_SSD1306
#define USE_AUREBESH_FONT
#endif

#ifdef CONFIG_PRESETS
Preset presets[] = {
   { "TeensySF;common", "tracks/venus.wav",
    StyleNormalPtr<CYAN, WHITE, 300, 800>(),
    StylePtr<Black>(),
    StylePtr<Black>(),
    StyleNormalPtr<CYAN, WHITE, 300, 800>(), "cyan"},
   { "SmthGrey;common", "tracks/mercury.wav",
    StyleFirePtr<RED, YELLOW, 0>(),
    StylePtr<Black>(),
    StylePtr<Black>(),
    StyleFirePtr<RED, YELLOW, 3>(), "fire"},
   { "SmthFuzz;common", "tracks/uranus.wav",
    StyleNormalPtr<RED, WHITE, 300, 800>(),
    StylePtr<Black>(),
    StylePtr<Black>(),
    StyleNormalPtr<RED, WHITE, 300, 800>(), "red"},
   { "RgueCmdr;common", "tracks/venus.wav",
    StyleFirePtr<BLUE, CYAN, 0>(),
    StylePtr<Black>(),
    StylePtr<Black>(),
    StyleFirePtr<BLUE, CYAN, 3>(), "blue fire"},
   { "TthCrstl;common", "tracks/mars.wav",
    StylePtr<InOutHelper<EASYBLADE(OnSpark<GREEN>, WHITE), 300, 800> >(),
    StylePtr<Black>(),
    StylePtr<Black>(),
    StylePtr<InOutHelper<EASYBLADE(OnSpark<GREEN>, WHITE), 300, 800> >(), "green"},
   { "TeensySF;common", "tracks/mercury.wav",
    StyleNormalPtr<WHITE, RED, 300, 800, RED>(),
    StylePtr<Black>(),
    StylePtr<Black>(),
    StyleNormalPtr<WHITE, RED, 300, 800, RED>(), "white"},
   { "SmthJedi;common", "tracks/uranus.wav",
    StyleNormalPtr<AudioFlicker<YELLOW, WHITE>, BLUE, 300, 800>(),
    StylePtr<Black>(),
    StylePtr<Black>(),
    StyleNormalPtr<AudioFlicker<YELLOW, WHITE>, BLUE, 300, 800>(), "yellow"},
   { "SmthGrey;common", "tracks/venus.wav",
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(),
    StylePtr<Black>(),
    StylePtr<Black>(),
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(), "magenta"},
   { "SmthFuzz;common", "tracks/mars.wav",
    StyleNormalPtr<Gradient<RED, BLUE>, Gradient<CYAN, YELLOW>, 300, 800>(),
    StylePtr<Black>(),
    StylePtr<Black>(),
    StyleNormalPtr<Gradient<RED, BLUE>, Gradient<CYAN, YELLOW>, 300, 800>(), "gradient"},
   { "RgueCmdr;common", "tracks/mercury.wav",
    StyleRainbowPtr<300, 800>(),
    StylePtr<Black>(),
    StylePtr<Black>(),
    StyleRainbowPtr<300, 800>(), "rainbow"},
   { "TthCrstl;common", "tracks/uranus.wav",
    StyleStrobePtr<WHITE, Rainbow, 15, 300, 800>(),
    StylePtr<Black>(),
    StylePtr<Black>(),
    StyleStrobePtr<WHITE, Rainbow, 15, 300, 800>(), "strobe"},
   { "TeensySF;common", "tracks/venus.wav",
    &style_pov,
    StyleNormalPtr<BLACK, BLACK, 300, 800>(),
    StyleNormalPtr<BLACK, BLACK, 300, 800>(),
    StyleNormalPtr<BLACK, BLACK, 300, 800>(), "pov"},
   { "SmthJedi;common", "tracks/mars.wav",
    &style_charging,
    StyleNormalPtr<BLACK, BLACK, 300, 800>(),
    StyleNormalPtr<BLACK, BLACK, 300, 800>(),
    StyleNormalPtr<BLACK, BLACK, 300, 800>(), "battery\nlevel"}
};
Preset no_blade_presets[] = {
  { "Crispity;common", "Crispity/tracks/track1.wav", // Does the folder tracks need to be in common
                                                     // or in the font folder or in the root of the SD ? Also can it be 
                                                     // in the font folder AND another in the root of the SD ?
   StylePtr<Black>(),
   StyleFirePtr<RED, YELLOW, 0>(),
   StyleFirePtr<RED, YELLOW, 0>(),
   StyleFirePtr<RED, YELLOW, 0>(),  "no blade" },
  { "TeensySF;common", "tracks/venus.wav",
   StylePtr<Black>(),
   StyleNormalPtr<CYAN, WHITE, 300, 800>(),
   StyleNormalPtr<CYAN, WHITE, 300, 800>(),
   StyleNormalPtr<CYAN, WHITE, 300, 800>(), "no blade\n  cyan"},
  { "SmthJedi;common", "tracks/mars.wav",
   StylePtr<Black>(),
   StylePtr<InOutSparkTip<EASYBLADE(BLUE, WHITE), 300, 800> >(),
   StylePtr<InOutSparkTip<EASYBLADE(BLUE, WHITE), 300, 800> >(),
   StylePtr<InOutSparkTip<EASYBLADE(BLUE, WHITE), 300, 800> >(), "no blade\n  blue"},
  { "SmthGrey;common", "tracks/mercury.wav",
   StylePtr<Black>(),
   StyleFirePtr<RED, YELLOW, 1>(),
   StyleFirePtr<RED, YELLOW, 2>(),
   StyleFirePtr<RED, YELLOW, 3>(), "no blade\n  fire"},
  { "SmthFuzz;common", "tracks/uranus.wav",
   StylePtr<Black>(),
   StyleNormalPtr<RED, WHITE, 300, 800>(),
   StyleNormalPtr<RED, WHITE, 300, 800>(),
   StyleNormalPtr<RED, WHITE, 300, 800>(), "no  blade\n   red"},
  { "RgueCmdr;common", "tracks/venus.wav",
   StylePtr<Black>(),
   StyleFirePtr<BLUE, CYAN, 1>(),
   StyleFirePtr<BLUE, CYAN, 2>(),
   StyleFirePtr<BLUE, CYAN, 3>(), " no blade\nblue  fire"},
  { "TthCrstl;common", "tracks/mars.wav",
   StylePtr<Black>(),
   StylePtr<InOutHelper<EASYBLADE(OnSpark<GREEN>, WHITE), 300, 800> >(),
   StylePtr<InOutHelper<EASYBLADE(OnSpark<GREEN>, WHITE), 300, 800> >(),
   StylePtr<InOutHelper<EASYBLADE(OnSpark<GREEN>, WHITE), 300, 800> >(), "no  blade\n  green"},
  { "TeensySF;common", "tracks/mercury.wav",
   StylePtr<Black>(),
   StyleNormalPtr<WHITE, RED, 300, 800, RED>(),
   StyleNormalPtr<WHITE, RED, 300, 800, RED>(),
   StyleNormalPtr<WHITE, RED, 300, 800, RED>(), "no  blade\n  white"},
  { "SmthJedi;common", "tracks/uranus.wav",
   StylePtr<Black>(),
   StyleNormalPtr<AudioFlicker<YELLOW, WHITE>, BLUE, 300, 800>(),
   StyleNormalPtr<AudioFlicker<YELLOW, WHITE>, BLUE, 300, 800>(),
   StyleNormalPtr<AudioFlicker<YELLOW, WHITE>, BLUE, 300, 800>(), "no blade\n yellow"},
  { "SmthGrey;common", "tracks/venus.wav",
   StylePtr<Black>(),
   StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(),
   StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(),
   StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(), "no  blade\n magenta"},
  { "SmthFuzz;common", "tracks/mars.wav",
   StylePtr<Black>(),
   StyleNormalPtr<Gradient<RED, BLUE>, Gradient<CYAN, YELLOW>, 300, 800>(),
   StyleNormalPtr<Gradient<RED, BLUE>, Gradient<CYAN, YELLOW>, 300, 800>(),
   StyleNormalPtr<Gradient<RED, BLUE>, Gradient<CYAN, YELLOW>, 300, 800>(), "no blade\ngradient"},
  { "RgueCmdr;common", "tracks/mercury.wav",
   StylePtr<Black>(),
   StyleRainbowPtr<300, 800>(),
   StyleRainbowPtr<300, 800>(),
   StyleRainbowPtr<300, 800>(), "no  blade\n  rainbow"},
  { "TthCrstl;common", "tracks/uranus.wav",
   StylePtr<Black>(),
   StyleStrobePtr<WHITE, Rainbow, 15, 300, 800>(),
   StyleStrobePtr<WHITE, Rainbow, 15, 300, 800>(),
   StyleStrobePtr<WHITE, Rainbow, 15, 300, 800>(), "no blade\n strobe"},
   { "SmthJedi;common", "tracks/mars.wav",
   StylePtr<Black>(),
   &style_charging,
   StyleNormalPtr<BLACK, BLACK, 300, 800>(),
   StyleNormalPtr<BLACK, BLACK, 300, 800>(), "batt level\n no blade"}
};

// Marble style
//     StylePtr<Mix<
//          CircularSectionF<
//          MarbleF<Int<-2000>, Int<40000>, Ifon<Int<827680>, Int<0>>, Int<1276800>>,
//          /* circle fraction = */ ChangeSlowly<Ifon<Int<32768>, Int<3276>>, Int<2048>>>,
//         Black,
//         Mix<InOutFuncX<Int<2000>,Int<2000>>, Rgb<0,0,20>, Rgb<0,255,255>
//     >>>(),
//    "chaotic good"},
//
//  I have no idea what to do with this bit ???
//


BladeConfig blades[] = {
 { 0, WS281XBladePtr<144, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
    SubBladeWithStride(0, 15, 2, WS281XBladePtr<16, blade2Pin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
    SubBladeWithStride(1, 15, 2, NULL),
    WS281XBladePtr<1, blade3Pin, Color8::GRB, PowerPINS<bladePowerPin1> >(),
    CONFIGARRAY(presets) },
 { NO_BLADE, WS281XBladePtr<144, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
    SubBladeWithStride(0, 15, 2, WS281XBladePtr<16, blade2Pin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
    SubBladeWithStride(1, 15, 2, NULL),
    WS281XBladePtr<1, blade3Pin, Color8::GRB, PowerPINS<bladePowerPin1> >(),
    CONFIGARRAY(no_blade_presets), "nb_save" },
};
#endif

#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
Button AuxButton(BUTTON_AUX, auxPin, "aux");
#endif

Thank you again for all your help. I will go sleep now and check back tomorrow.

That’s correct.

1 Like

Having a track in 2 places doesn’t help nor hurt anything. It simply will be found wherever you set the path to it.
Crispity/tracks/track1.wav
means the track1.wav file is inside a folder named “tracks”,
which is inside a folder named “Crispity”,
which is on the root level of your SD card.

It’s usually just a matter of organization.
Some like to have all of their tracks in one big tracks folder on the root, others like to “categorize” them by keeping them inside the font they belong with. It’s totally up to you.

It’s a blade style. You would use it in the slot where your blade style(s) for the connector with the rings is (position 2 and 3 of your preset styles, because the first is your main blade, and the 4th is a switch LED or some accent?).
So you’d swap the styles you have out for the marble style, like make this

  { "TeensySF;common", "tracks/venus.wav",
   StylePtr<Black>(),
   StyleNormalPtr<CYAN, WHITE, 300, 800>(),
   StyleNormalPtr<CYAN, WHITE, 300, 800>(),
   StyleNormalPtr<CYAN, WHITE, 300, 800>(), "no blade\n  cyan"},

into this instead:

  { "TeensySF;common", "tracks/venus.wav",
   StylePtr<Black>(),
// Marble style
StylePtr<Mix<CircularSectionF<MarbleF<Int<-2000>,Int<40000>,Ifon<Int<827680>,Int<0>>,Int<1276800>>,ChangeSlowly<Ifon<Int<32768>,Int<3276>>,Int<2048>>>,Black,Mix<InOutFuncX<Int<2000>,Int<2000>>,Rgb<0,0,20>,Rgb<0,255,255>>>>(),
 // Marble style
StylePtr<Mix<CircularSectionF<MarbleF<Int<-2000>,Int<40000>,Ifon<Int<827680>,Int<0>>,Int<1276800>>,ChangeSlowly<Ifon<Int<32768>,Int<3276>>,Int<2048>>>,Black,Mix<InOutFuncX<Int<2000>,Int<2000>>,Rgb<0,0,20>,Rgb<0,255,255>>>>(),
   StyleNormalPtr<CYAN, WHITE, 300, 800>(), "no blade\n  cyan"},
1 Like

I have several more sound fonts questions. I will post them in soundfonts after I read a bit more about them.

Off-topic, I am so gonna see what it takes to turn this into a little something-something.

Thanks Prof!

Oh damn I didn’t know we could do the stride thing . Learn something every day.

There’s also subbladereverse which can be used on just a single blade to reverse it or in a string of other sub blades.

And SubBladeZZ for grids.

Maybe we need to make a SubBladeWithStrideReverse too.