Configuration file - “Blade ID” resistor

Hi,

I’m not very good at coding, so I need some advice. I want to only use the blade detector so that the LEDs on the PCB connector don’t light up when I connect the blade. I found options where I can use a resistor (I used 10K) as shown in the attached image.

What should the configuration file look like?

Is the following correct?:

#ifdef CONFIG_TOP
#include “proffieboard_v2_config.h”
#define NUM_BLADES 5
#define NUM_BUTTONS 2
#define VOLUME 1000
const unsigned int maxLedsPerStrip = 385;
#define CLASH_THRESHOLD_G 1.0
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#define ENABLE_SSD1306
#define ENABLE_SERIAL
#define SHARED_POWER_PINS
#define ENABLE_POWER_FOR_ID PowerPINS<bladePowerPin2, bladePowerPin3>
// Max 20 characters
#define BLE_PASSWORD “Zegreus”
// Max 32 characters.
#define BLE_NAME “Zegreus”
// Max 9 characters
#define BLE_SHORTNAME “Saber”

#endif

#ifdef CONFIG_PRESETS
Preset presets = {
{ “TeensySF”, “tracks/venus.wav”,
StyleNormalPtr<CYAN, WHITE, 300, 800>(),
StyleNormalPtr<CYAN, WHITE, 300, 800>(),
StyleNormalPtr<CYAN, WHITE, 300, 800>(),
StyleNormalPtr<CYAN, WHITE, 300, 800>(),
StyleNormalPtr<CYAN, WHITE, 300, 800>(), “cyan”},
};

Preset no_blade_presets = {
{ “TeensySF”, “tracks/mars.wav”,
StyleFirePtr<RED, YELLOW, 0>(),
StyleFirePtr<RED, YELLOW, 0>(),
StyleFirePtr<RED, YELLOW, 0>(),
StyleFirePtr<RED, YELLOW, 0>(),
StyleFirePtr<RED, YELLOW, 0>(),
“no blade” },
};

BladeConfig blades = {
{ 0, SubBlade(0, 89, WS281XBladePtr<180, bladePin, Color8::GRBw, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
SubBladeReverse(89, 179, NULL),
SubBladeWithStride(0, 15, 2, WS281XBladePtr<16, blade2Pin, Color8::GRBw, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
SubBladeWithStride(1, 15, 2, NULL),
WS281XBladePtr<50, blade3Pin, Color8::GRBw, PowerPINS<bladePowerPin4, bladePowerPin5> >()
, CONFIGARRAY(presets) },
{ 11800,
NO_BLADE, SubBlade(0, 89, WS281XBladePtr<180, bladePin, Color8::GRBw, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
SubBladeReverse(89, 179, NULL),
SubBladeWithStride(0, 15, 2, WS281XBladePtr<16, blade2Pin, Color8::GRBw, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
SubBladeWithStride(1, 15, 2, NULL),
WS281XBladePtr<50, blade3Pin, Color8::GRBw, PowerPINS<bladePowerPin4, bladePowerPin5> >()
, CONFIGARRAY(no_blade_presets), “nb_save” }
,
};
#endif

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

So I think you are mixing up BladeID and Blade Detect.

Your blade array is wrong:

{ 11800,
NO_BLADE,

Should be:

{11800, // for blade ID with your resistor 
or
{No_BLADE, // for blade detect
or
Have 3 arrays
{0, // for "id-ing" a blade with no resistor
... }
{11800, // for "id-ing" the blade with your resistor 
... }
{NO_BLADE, // for the "id-ing" the no blade situation
... }

Now if you want the blade connector to be off (no lights) when a blade is inserted, you need to change your “bladed preset” from:

Preset presets = {
{ “TeensySF”, “tracks/venus.wav”,
StyleNormalPtr<CYAN, WHITE, 300, 800>(),
StyleNormalPtr<CYAN, WHITE, 300, 800>(),
StyleNormalPtr<CYAN, WHITE, 300, 800>(),
StyleNormalPtr<CYAN, WHITE, 300, 800>(),
StyleNormalPtr<CYAN, WHITE, 300, 800>(), “cyan”},
};

to

Preset presets = {
{ “TeensySF”, “tracks/venus.wav”,
StyleNormalPtr<CYAN, WHITE, 300, 800>(),
StyleNormalPtr<CYAN, WHITE, 300, 800>(),
StylePtr<Black>(), // this will turn off your connector when a blade is inserted
StylePtr<Black>(),
StyleNormalPtr<CYAN, WHITE, 300, 800>(), “cyan”},
};


Okay, I followed this guide about the resistor on the PCB connector. What do you think the entire code should look like?

As you pointed out, I want it to turn off when the sword is inserted. According to the instructions, by placing a resistor on the PCB, the BP will “sense” when something is connected.

How are you guys hooking up your blades whilst connected to usb? Needs to be in the hilt…?

BladeConfig blades = {
{ 0, SubBlade(0, 89, WS281XBladePtr<180, bladePin, Color8::GRBw, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
 // 0 is for blades without a resistance (you can change (0,89 & 180 if it is a different blade size)
SubBladeReverse(89, 179, NULL), // (also change 89 & 179 if you change 0, 89 & 180 above)
SubBladeWithStride(0, 15, 2, WS281XBladePtr<16, blade2Pin, Color8::GRBw, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
SubBladeWithStride(1, 15, 2, NULL),
WS281XBladePtr<50, blade3Pin, Color8::GRBw, PowerPINS<bladePowerPin4, bladePowerPin5> >()
, CONFIGARRAY(presets) },

{ "xyz", SubBlade(0, 89, WS281XBladePtr<180, bladePin, Color8::GRBw, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
 // where "xyz" is another of your Blade ID, if you have more than one resistored blade. (you can change (0,89 & 180 if it is a different blade size)
SubBladeReverse(89, 179, NULL),
SubBladeWithStride(0, 15, 2, WS281XBladePtr<16, blade2Pin, Color8::GRBw, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
SubBladeWithStride(1, 15, 2, NULL),
WS281XBladePtr<50, blade3Pin, Color8::GRBw, PowerPINS<bladePowerPin4, bladePowerPin5> >()
, CONFIGARRAY(presets) },

{ 11800,
SubBlade(0, 89, WS281XBladePtr<180, bladePin, Color8::GRBw, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
SubBladeReverse(89, 179, NULL),
SubBladeWithStride(0, 15, 2, WS281XBladePtr<16, blade2Pin, Color8::GRBw, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
SubBladeWithStride(1, 15, 2, NULL),
WS281XBladePtr<50, blade3Pin, Color8::GRBw, PowerPINS<bladePowerPin4, bladePowerPin5> >()
, CONFIGARRAY(presets) },

{ NO_BLADE,
SubBlade(0, 89, WS281XBladePtr<180, bladePin, Color8::GRBw, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
SubBladeReverse(89, 179, NULL),
SubBladeWithStride(0, 15, 2, WS281XBladePtr<16, blade2Pin, Color8::GRBw, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
SubBladeWithStride(1, 15, 2, NULL),
WS281XBladePtr<50, blade3Pin, Color8::GRBw, PowerPINS<bladePowerPin4, bladePowerPin5> >()
, CONFIGARRAY(no_blade_presets), “nb_save” }
,
};

I can connect to USB while my hilt is open and my chassis is in the top part of my saber with the blade attached.