Blaster TestBench v1.0

I’m trying to clean up the blaster.h prop. It started by trying to write a How-To page, then I ent through the documentation for the soundfonts. That took me to the prop itself where I wanted to understand what did each thing. I found out a lot of documented functionality is not implemented, the prop itself has lots of edits that tried to put things but never happened.
So, to actually clean up the prop file, I need actual hardware. From the defines and sound definition, I found out we have definitions for six buttons: Fire, Mode, Power, Reload, Range and Clip. Since the Clip button acts more like a sensor of clip present, it was better implemented as a latching button.
There’s some examples on how to implement an OLED, and the sound definition includes an optional PLI to set the Range/Power level. I also wanted a hardware on/off, besides the PowerButton.
Thus, I set to design a test bench so I could have all the hardware to test the full functionality.


The wiring is this:

I would like @profezzorn to check about all this buttons, though.

Button FireButton(BUTTON_FIRE, powerButtonPin, "fire");
Button ModeButton(BUTTON_MODE_SELECT, auxPin, "modeselect");
Button PowerButton(BUTTON_POWER, aux2Pin, "power"); 
Button ReloadButton(BUTTON_RELOAD, blade3Pin, "reload");
Button RangeButton(BUTTON_RANGE, rxPin, "range");
Button ClipButton(BUTTON_CLIP_DETECT, blade4Pin, "clip"); //Actually clip sensor. It should be closed when the clip is in, and open when the clip is removed. So you can use either latching as single button or momentary if it is a physical clip inserted sensor.
1 Like

I’ve prepared most of the wiring, just need to check everything is right to start doing the board.


My tentative config is the following. If anybody finds an error before I’m done flashing it, so much the better.

/********************************************************************************************
##### General Specs #####
Blaster: Custom Blaster Bench Test
Chassis: Included in bench design
Board: Proffieboard v2.2
ProffieOS Version: 7.5
Soundfont Collection: 2023-04
-Momentary Switches: 5
-Latching Switches: 1
-Battery: 18650
-Speaker: TCSS Premium 28mm 3W
-Main Blade: 15px WS2812B
-Blaster NPXL Connector: None
-Accents (6px WS2812B)
-OLED 128 x 32 pixel SSD1306

##### Hardware Config #####
-FireButton:   Button1 (21)
-ModeButton:   Button2 (23)
-PowerButton:  Button3 (22)
-ReloadButton: Data 3 (17)
-RangeButton:  Data4 (0)
-ClipButton:   RX (9)
-NeoPixelBlade01: 16px, LED2/Data1
-NeoPixelPLI:     10px,  LED5/Data2 (470 Ohm resistor)
-On/Off switch.

##### Install Intent #####
This is a dedicated blaster benchtest for blasters props. It's got five momentary buttons
plus a latching button for clip, speakers, OLED, a main blade plus a dedicated PLI. It's
intent is to validate a rewirte of a base a simple "blaster.h" prop with full functionality,
but no luxuries. But it can also be used to validate a lot of other blaster props.

@@@ REMEMBER @@@: YOU SHOULD PAY FOR EACH SOUNDFONT PER PERSON: MULTIPLE HILTS SAME PERSON
ARE FINE. BUT IF YOU SELL THE HILT, YOU EITHER PAY FOR THOSE FONTS, INSTALL FONTS THAT THE
BUYER ALREADY OWNS OR DELETE YOUR COPIES.

********************************************************************************************/

//*******************************************************************************************
#ifdef CONFIG_TOP
//*******************************************************************************************
/*-----------------------------
////// Hardware Defines  //////
-----------------------------*/
#include "proffieboard_v2_config.h"
#define NUM_BLADES 2						//(1 x Blade + 2 x illuminated NPXL PCB + 1 x Crystal Chamber + 3 Accents)
#define NUM_BUTTONS 6						//If you add a 2nd button, uncomment the AUX line at the bottom
const unsigned int maxLedsPerStrip = 30;	//Should be bigger than the longest physical strip you have (so you might have to add subblades)
//#define EXTRA_COLOR_BUFFER_SPACE 70			//Helps to make some effects faster
#define CLASH_THRESHOLD_G 1.0				//Define how hard your motions before effects register. Lower if hard to get or increase if you have spurious effects.
#define ENABLE_MOTION						//Enables de motion sensors.
#define ENABLE_WS2811						//Enables WS2811 NeoPixe-style protocol
#define ENABLE_SD							//Enables SD Card access.
//#define ORIENTATION_ROTATION 0,17,0			//X,Y,Z rotation with respect to USB towards pommel. Mainly thought for curved pommels like Dookus, but also useful for usb at emitter config.

/*-----------------------------
////// Blaster Defines  ///////
-----------------------------*/
#define ENABLE_BLASTER_AUTO          // If you desire to enable AUTO mode.
#define BLASTER_SHOTS_UNTIL_EMPTY 30 // The capacity of your weapons rounds.
#define BLASTER_JAM_PERCENTAGE 1     //  0-100. If not defined, random.


/*-----------------------------
/////// Audio Defines  ////////
-----------------------------*/
#define ENABLE_AUDIO					//Basic enabling of the audio functions.
#define VOLUME 1500						//Volume, anything 0-3000, recommended 700.
//#define BOOT_VOLUME 100					//This is the volume the saber will default to on boot, you will then use Volume Menu or Volume Editing to adjust during normal use (10 "~" 100% of Volume).
#define FILTER_CUTOFF_FREQUENCY 100		//(Hz) Enable a butterworth highpass filter with the given order and cutoff frequency
#define FILTER_ORDER 8					//Order of the filter

/*-----------------------------
//////// OLED Defines  ////////
-----------------------------*/
#define ENABLE_SSD1306		//To enable OLED
//#define INCLUDE_SSD1306   //Includes support for ssd1306 displays, but does not automatically enable it
//#define OLED_FLIP_180     //Rotates OLED pictures 180deg
//#define USE_AUREBESH_FONT	//Select Aubresh font for the display rather than Star Jedi

/*-----------------------------
///// BlueTooth Defines  //////
-----------------------------*/
// Bluetooth module:
// 1) Enable the defines below.
// 2) Add +1 to NUM_BLADES.
// 3) In Preset add: "StylePtr<Blue>(),".
// 4) In BladesConfig: "SimpleBladePtr<CH3LED, NoLED, NoLED, NoLED, bladePowerPin6, -1, -1, -1>()," where bladePowerPin6 is the MOSFET negative you used to power the BT module.
// 
//#define ENABLE_SERIAL				//To enable Blutooth
//Redbear BLE preloads BT name and password
//#define BLE_PASSWORD "PASSWORD"	//Password must be 20 or less characters.
//#define BLE_NAME "LONG NAME"		//Descriptive name.
//#define BLE_SHORTNAME "SHORTNAM"	//Must be 8 or less characters.

/*-----------------------------
///// ProffieOS Defines  //////
-----------------------------*/
#define DISABLE_DIAGNOSTIC_COMMANDS			//Recommended to save memory, disables diagnostic commands for Serial Monitor.
#define DISABLE_BASIC_PARSER_STYLES			//Saves memory by disabling old-fashioned styles.
#define MOTION_TIMEOUT 60 * 15 * 1000		//Amount of time motion and gestures detection stays active after saber is retracted. Affects Battle Mode.
#define IDLE_OFF_TIME 60 * 10 * 1000		//Amount of time power to LEDs remains active after saber is retracted. Might affect Bluetooth.
#define KILL_OLD_PLAYERS					//Will "kill off" oldest sound when spamming effects like blast or clash to prevent running out of wav players.

/*-----------------------------
//// Save States Defines  /////
-----------------------------*/
//#define SAVE_STATE					//Makes the board save last selected Volume, Preset and blade Color
//#define SAVE_PRESET
/*#define SAVE_VOLUME
#define SAVE_COLOR_CHANGE
#define DYNAMIC_BLADE_DIMMING
#define DYNAMIC_BLADE_LENGTH
#define DYNAMIC_CLASH_THRESHOLD
#define SAVE_BLADE_DIMMING
#define SAVE_CLASH_THRESHOLD*/

/*-----------------------------
// Presets and Props Defines  /
-----------------------------*/
#define NO_REPEAT_RANDOM				//Make ProffieOS remember which file (of each effect) was played last
//#define FEMALE_TALKIE_VOICE			//Uses a female talkie voice, only affects built-in error messages

#endif

//*******************************************************************************************
#ifdef CONFIG_PROP
//*******************************************************************************************
#include "../props/blaster.h"

#endif

//*******************************************************************************************
#ifdef CONFIG_PRESETS
//*******************************************************************************************

//----------------------------------------------------------------------------------------------
// Default preset for pixelblades. You'd need a new one if you got a tricree-npxl adapter.
//----------------------------------------------------------------------------------------------
/********* Preset Intent ***********************************************************************
  For now the important things to test are the button sequences, the PLI and the clip
  functionality. For that we need just two styles, so we can change between them, check if the
  state is saved and such. We also need to test clip in/out, and to implement the Range
  functionality and PLI I've added a 6px accent.

@@@ REMEMBER @@@: YOU SHOULD PAY FOR EACH SOUNDFONT PER PERSON: MULTIPLE HILTS SAME PERSON
ARE FINE. BUT IF YOU SELL THE HILT, YOU EITHER PAY FOR THOSE FONTS, INSTALL FONTS THAT THE
BUYER ALREADY OWNS OR DELETE YOUR COPIES.
  
************************************************************************************************/
Preset presets[] = {
	{	"E-11", "tracks/mars.wav",
		//Barrel
		StylePtr<Layers<AudioFlicker<RotateColorsX<Variation,Blue>,RotateColorsX<Variation,Rgb<0,0,128>>>,BlastL<White>, InOutTrL<TrInstant,TrFade<300>,Pulsing<RotateColorsX<Variation,Blue>,RotateColorsX<Variation,Rgb<0,0,10>>,3000>>>>(),
		//StylePtr<DredgenMainOrange>(),
		//Accents
		StylePtr<Lockup<BlastFadeout<BlastFadeout<Black,AudioFlicker<Black,Red>,250,EFFECT_FIRE>,AudioFlicker<Black,Red>,1500,EFFECT_STUN>,AudioFlicker<Black,Red>>>(),
		"E-11"
	},
	{ "E-11D", "tracks/mars.wav",
		//Barrel
		StylePtr<Layers<AudioFlicker<RotateColorsX<Variation,Blue>,RotateColorsX<Variation,Rgb<0,0,128>>>,BlastL<White>, InOutTrL<TrInstant,TrFade<300>,Pulsing<RotateColorsX<Variation,Blue>,RotateColorsX<Variation,Rgb<0,0,10>>,3000>>>>(),
		//Accents
		StylePtr<Lockup<BlastFadeout<BlastFadeout<Black,AudioFlicker<Black,Red>,250,EFFECT_FIRE>,AudioFlicker<Black,Blue>,1500,EFFECT_STUN>,AudioFlicker<Black,Red>>>(),
		"E-11D"
	}
};

//----------------------------------------------------------------------------------------------
// Blade number should always be the same. In this case, 2. Please note that the soundboard will
// not suppress power to any blade. But if it's not physically connected, you can blank it.
//----------------------------------------------------------------------------------------------
// Resistor range for the Blade PCB (between Data and Ground): 2k to 100k Ohms.

/********* Hardware Definition *****************************************************************
 The main blade goes on Data1, while the PLI is on Data2. Everything is fixed, so there is no
 sense to have Blade Present and Blade ID functionality. At least to test what this bench
 is designed for.
 ************************************************************************************************/
/********* Blade Definitions *******************************************************************

We have a single presets:
-presets:			Blade Present. 

************************************************************************************************/

BladeConfig blades[] = {
	// Always leave a 0 resistor for a "catch all" config. No resistor will read as high ohms.
	// 0/Default is an 10cm, 16 pixel WS2812B
	// Saving state for each differant preset separatelly. Could also save for each individual blade.
	{ 0,
		//Main Blade
		WS281XBladePtr<16, bladePin, Color8::GRB, PowerPINS<bladePowerPin2> >(),
		//Accent Pixel
		WS281XBladePtr<10, blade2Pin, Color8::GRB, PowerPINS<bladePowerPin5> >(),
		CONFIGARRAY(presets)
	}
};

#endif

//*******************************************************************************************
#ifdef CONFIG_BUTTONS
//*******************************************************************************************
Button FireButton(BUTTON_FIRE, powerButtonPin, "fire");
Button ModeButton(BUTTON_MODE_SELECT, auxPin, "modeselect");
Button PowerButton(BUTTON_POWER, aux2Pin, "power"); //A third button to power on/off your weapon
Button ReloadButton(BUTTON_RELOAD, blade3Pin, "reload"); //Dedicated button for reloading.
Button RangeButton(BUTTON_RANGE, rxPin, "range"); //Used to increase range/power.
Button ClipButton(BUTTON_CLIP_DETECT, blade4Pin, "clip"); //Actually clip sensor. It should be closed when the clip is in, and open when the clip is removed. So you can use either latching as single button or momentary if it is a physical clip inserted sensor.
#endif

3 Likes

Awesome! Look forward to seeing where it goes.

Ok, the test bench is kinda put together. I still haven’t installed the OLED, but that will probably come later, when the rest works.


Don’t look behind the curtain!

And yes, it’s definetly not my proudest work. But it does work!

Here is the config:

/********************************************************************************************
##### General Specs #####
Blaster: Custom Blaster Bench Test
Chassis: Included in bench design
Board: Proffieboard v2.2
ProffieOS Version: 7.5
Soundfont Collection: 2023-04
-Momentary Switches: 5
-Latching Switches: 1
-Battery: 18650
-Speaker: TCSS Premium 28mm 3W
-Main Blade: 15px WS2812B
-Blaster NPXL Connector: None
-Accents (6px WS2812B)
-OLED 128 x 32 pixel SSD1306

##### Hardware Config #####
-FireButton:   Button1 (21)
-ModeButton:   Button2 (23)
-PowerButton:  Button3 (22)
-ReloadButton: Data 3 (17)
-RangeButton:  Data4 (0)
-ClipButton:   RX (9)
-NeoPixelBlade01: 16px, LED2/Data1
-NeoPixelPLI:     10px,  LED5/Data2 (470 Ohm resistor)
-On/Off switch.

##### Install Intent #####
This is a dedicated blaster benchtest for blasters props. It's got five momentary buttons
plus a latching button for clip, speakers, OLED, a main blade plus a dedicated PLI. It's
intent is to validate a rewirte of a base a simple "blaster.h" prop with full functionality,
but no luxuries. But it can also be used to validate a lot of other blaster props.

@@@ REMEMBER @@@: YOU SHOULD PAY FOR EACH SOUNDFONT PER PERSON: MULTIPLE HILTS SAME PERSON
ARE FINE. BUT IF YOU SELL THE HILT, YOU EITHER PAY FOR THOSE FONTS, INSTALL FONTS THAT THE
BUYER ALREADY OWNS OR DELETE YOUR COPIES.

********************************************************************************************/

//*******************************************************************************************
#ifdef CONFIG_TOP
//*******************************************************************************************
/*-----------------------------
////// Hardware Defines  //////
-----------------------------*/
#include "proffieboard_v2_config.h"
#define NUM_BLADES 3						//(1 x Blade + 2 x illuminated NPXL PCB + 1 x Crystal Chamber + 3 Accents)
#define NUM_BUTTONS 6						//If you add a 2nd button, uncomment the AUX line at the bottom
const unsigned int maxLedsPerStrip = 30;	//Should be bigger than the longest physical strip you have (so you might have to add subblades)
//#define EXTRA_COLOR_BUFFER_SPACE 70			//Helps to make some effects faster
#define CLASH_THRESHOLD_G 1.0				//Define how hard your motions before effects register. Lower if hard to get or increase if you have spurious effects.
#define ENABLE_MOTION						//Enables de motion sensors.
#define ENABLE_WS2811						//Enables WS2811 NeoPixe-style protocol
#define ENABLE_SD							//Enables SD Card access.
//#define ORIENTATION_ROTATION 0,17,0			//X,Y,Z rotation with respect to USB towards pommel. Mainly thought for curved pommels like Dookus, but also useful for usb at emitter config.

/*-----------------------------
////// Blaster Defines  ///////
-----------------------------*/
#define ENABLE_BLASTER_AUTO          // If you desire to enable AUTO mode.
#define BLASTER_SHOTS_UNTIL_EMPTY 30 // The capacity of your weapons rounds.
#define BLASTER_JAM_PERCENTAGE 1     //  0-100. If not defined, random.


/*-----------------------------
/////// Audio Defines  ////////
-----------------------------*/
#define ENABLE_AUDIO					//Basic enabling of the audio functions.
#define VOLUME 1500						//Volume, anything 0-3000, recommended 700.
//#define BOOT_VOLUME 100					//This is the volume the saber will default to on boot, you will then use Volume Menu or Volume Editing to adjust during normal use (10 "~" 100% of Volume).
#define FILTER_CUTOFF_FREQUENCY 100		//(Hz) Enable a butterworth highpass filter with the given order and cutoff frequency
#define FILTER_ORDER 8					//Order of the filter

/*-----------------------------
//////// OLED Defines  ////////
-----------------------------*/
#define ENABLE_SSD1306		//To enable OLED
//#define INCLUDE_SSD1306   //Includes support for ssd1306 displays, but does not automatically enable it
//#define OLED_FLIP_180     //Rotates OLED pictures 180deg
//#define USE_AUREBESH_FONT	//Select Aubresh font for the display rather than Star Jedi

/*-----------------------------
///// BlueTooth Defines  //////
-----------------------------*/
// Bluetooth module:
// 1) Enable the defines below.
// 2) Add +1 to NUM_BLADES.
// 3) In Preset add: "StylePtr<Blue>(),".
// 4) In BladesConfig: "SimpleBladePtr<CH3LED, NoLED, NoLED, NoLED, bladePowerPin6, -1, -1, -1>()," where bladePowerPin6 is the MOSFET negative you used to power the BT module.
// 
//#define ENABLE_SERIAL				//To enable Blutooth
//Redbear BLE preloads BT name and password
//#define BLE_PASSWORD "PASSWORD"	//Password must be 20 or less characters.
//#define BLE_NAME "LONG NAME"		//Descriptive name.
//#define BLE_SHORTNAME "SHORTNAM"	//Must be 8 or less characters.

/*-----------------------------
///// ProffieOS Defines  //////
-----------------------------*/
//#define DISABLE_DIAGNOSTIC_COMMANDS			//Recommended to save memory, disables diagnostic commands for Serial Monitor.
#define DISABLE_BASIC_PARSER_STYLES			//Saves memory by disabling old-fashioned styles.
#define MOTION_TIMEOUT 60 * 15 * 1000		//Amount of time motion and gestures detection stays active after saber is retracted. Affects Battle Mode.
#define IDLE_OFF_TIME 60 * 10 * 1000		//Amount of time power to LEDs remains active after saber is retracted. Might affect Bluetooth.
#define KILL_OLD_PLAYERS					//Will "kill off" oldest sound when spamming effects like blast or clash to prevent running out of wav players.

/*-----------------------------
//// Save States Defines  /////
-----------------------------*/
//#define SAVE_STATE					//Makes the board save last selected Volume, Preset and blade Color
//#define SAVE_PRESET
/*#define SAVE_VOLUME
#define SAVE_COLOR_CHANGE
#define DYNAMIC_BLADE_DIMMING
#define DYNAMIC_BLADE_LENGTH
#define DYNAMIC_CLASH_THRESHOLD
#define SAVE_BLADE_DIMMING
#define SAVE_CLASH_THRESHOLD*/

/*-----------------------------
// Presets and Props Defines  /
-----------------------------*/
#define NO_REPEAT_RANDOM				//Make ProffieOS remember which file (of each effect) was played last
//#define FEMALE_TALKIE_VOICE			//Uses a female talkie voice, only affects built-in error messages

#endif

//*******************************************************************************************
#ifdef CONFIG_PROP
//*******************************************************************************************
#include "../props/blaster.h"

#endif

//*******************************************************************************************
#ifdef CONFIG_PRESETS
//*******************************************************************************************

//----------------------------------------------------------------------------------------------
// Default preset for pixelblades. You'd need a new one if you got a tricree-npxl adapter.
//----------------------------------------------------------------------------------------------
/********* Preset Intent ***********************************************************************
  For now the important things to test are the button sequences, the PLI and the clip
  functionality. For that we need just two styles, so we can change between them, check if the
  state is saved and such. We also need to test clip in/out, and to implement the Range
  functionality and PLI I've added a 6px accent.

@@@ REMEMBER @@@: YOU SHOULD PAY FOR EACH SOUNDFONT PER PERSON: MULTIPLE HILTS SAME PERSON
ARE FINE. BUT IF YOU SELL THE HILT, YOU EITHER PAY FOR THOSE FONTS, INSTALL FONTS THAT THE
BUYER ALREADY OWNS OR DELETE YOUR COPIES.
  
************************************************************************************************/
Preset presets[] = {
	{	"Blaster/Dredgen/E-11;common", "tracks/mars.wav",
		//***Barrel***
		//StylePtr<Layers<AudioFlicker<RotateColorsX<Variation,Blue>,RotateColorsX<Variation,Rgb<0,0,128>>>,BlastL<White>, InOutTrL<TrInstant,TrFade<300>,Pulsing<RotateColorsX<Variation,Blue>,RotateColorsX<Variation,Rgb<0,0,10>>,3000>>>>(),
		StylePtr<Black>(),
		//StylePtr<DredgenMainOrange>(),
		//***Accents***
		//StylePtr<Lockup<BlastFadeout<BlastFadeout<Black,AudioFlicker<Black,Red>,250,EFFECT_FIRE>,AudioFlicker<Black,Red>,1500,EFFECT_STUN>,AudioFlicker<Black,Red>>>(),
		//StylePtr<Layers<AudioFlicker<RotateColorsX<Variation,Blue>,RotateColorsX<Variation,Rgb<0,0,128>>>,BlastL<White>, InOutTrL<TrInstant,TrFade<300>,Pulsing<RotateColorsX<Variation,Blue>,RotateColorsX<Variation,Rgb<0,0,10>>,3000>>>>(),
		StylePtr<Black>(),
		//***Clip On***
		//StylePtr<Green>(),
		StylePtr<Black>(),
		"E-11"
	},
	{ "Blaster/Dredgen/E-11D;common", "tracks/mars.wav",
		//***Barrel***
		//StylePtr<Layers<AudioFlicker<RotateColorsX<Variation,Blue>,RotateColorsX<Variation,Rgb<0,0,128>>>,BlastL<White>, InOutTrL<TrInstant,TrFade<300>,Pulsing<RotateColorsX<Variation,Blue>,RotateColorsX<Variation,Rgb<0,0,10>>,3000>>>>(),
		StylePtr<Black>(),
		//***Accents***
		//StylePtr<Lockup<BlastFadeout<BlastFadeout<Black,AudioFlicker<Black,Red>,250,EFFECT_FIRE>,AudioFlicker<Black,Blue>,1500,EFFECT_STUN>,AudioFlicker<Black,Red>>>(),
		StylePtr<Layers<AudioFlicker<RotateColorsX<Variation,Blue>,RotateColorsX<Variation,Rgb<0,0,128>>>,BlastL<White>, InOutTrL<TrInstant,TrFade<300>,Pulsing<RotateColorsX<Variation,Blue>,RotateColorsX<Variation,Rgb<0,0,10>>,3000>>>>(),
		StylePtr<Black>(),
		//***Clip On***
		//StylePtr<Green>(),
		StylePtr<Black>(),
		"E-11D"
	}
};

//----------------------------------------------------------------------------------------------
// Blade number should always be the same. In this case, 2. Please note that the soundboard will
// not suppress power to any blade. But if it's not physically connected, you can blank it.
//----------------------------------------------------------------------------------------------
// Resistor range for the Blade PCB (between Data and Ground): 2k to 100k Ohms.

/********* Hardware Definition *****************************************************************
 The main blade goes on Data1, while the PLI is on Data2. Everything is fixed, so there is no
 sense to have Blade Present and Blade ID functionality. At least to test what this bench
 is designed for.
 ************************************************************************************************/
/********* Blade Definitions *******************************************************************

We have a single presets:
-presets:			Blade Present. 

************************************************************************************************/

struct SwitchLedGreen {
  static constexpr float MaxAmps = 0.02;
  static constexpr float MaxVolts = 3.3;
  static constexpr float P2Amps = 0.01;
  static constexpr float P2Volts = 3.0;
  static constexpr float R = 470;
  // LED color
  static const int Red = 0;
  static const int Green = 255;
  static const int Blue = 0;
};


BladeConfig blades[] = {
	// Always leave a 0 resistor for a "catch all" config. No resistor will read as high ohms.
	// 0/Default is an 10cm, 16 pixel WS2812B
	// Saving state for each differant preset separatelly. Could also save for each individual blade.
	{ 0,
		//Main Blade
		WS281XBladePtr<16, bladePin, Color8::GRB, PowerPINS<bladePowerPin2> >(),
		//Accent Pixel
		WS281XBladePtr<10, blade2Pin, Color8::GRB, PowerPINS<bladePowerPin5> >(),
		SimpleBladePtr<SwitchLedGreen, NoLED, NoLED, NoLED,bladePowerPin1, -1, -1, -1>(),
		CONFIGARRAY(presets)
		
	}
};

#endif

//*******************************************************************************************
#ifdef CONFIG_BUTTONS
//*******************************************************************************************
Button FireButton(BUTTON_FIRE, powerButtonPin, "fire");
Button ModeButton(BUTTON_MODE_SELECT, auxPin, "modeselect");
Button PowerButton(BUTTON_POWER, aux2Pin, "power"); //A third button to power on/off your weapon
//Button ReloadButton(BUTTON_RELOAD, blade3Pin, "reload"); //Dedicated button for reloading.
//Button RangeButton(BUTTON_RANGE, rxPin, "range"); //Used to increase range/power.
//LatchingButton ClipButton(BUTTON_CLIP_DETECT, blade4Pin, "clip"); //Actually clip sensor. It should be closed when the clip is in, and open when the clip is removed. So you can use either latching as single button or momentary if it is a physical clip inserted sensor.
#endif

//*******************************************************************************************
#ifdef CONFIG_STYLES
//*******************************************************************************************

/* copyright Fett263 CustomBlade (Primary Blade) OS6 Style
https://fett263.com/fett263-proffieOS6-style-library.html#CustomBlade
OS6.7 v4.017
Single Style
Static

Base Color: Rgb<0,0,0> (0)

--Effects Included--
Preon Effect: Overload (PreOn Color)
Ignition Effect: Instant
Retraction Effect: Fade Out
CoolDown Effect: Power Burst Forward
Lockup Effect: Intensity Lockup V1, Begin Effect: Real Clash, End Effect: Full Blade Absorb
LightningBlock Effect: 0
Drag Effect: Intensity Sparking Drag
Melt Effect: Intensity Melt
Blast Effect: Responsive Blast Wave (Sound Based)
Clash Effect: Flash on Clash (Full Blade)
Swing Effect: Force Slow
Emitter Effect: Emitter Flare
Battery Level: Blade Location (Green to Red)
Battery Monitor: Passive Battery Monitor (Boot & Change Preset)
*/
//using DredgenMainOrange = StylePtr<Layers<RgbArg<BASE_COLOR_ARG,Rgb<0,0,0>>,AlphaL<RgbArg<EMITTER_COLOR_ARG,Rgb<255,97,0>>,SmoothStep<IntArg<EMITTER_SIZE_ARG,-662>,Int<-6000>>>,TransitionEffectL<TrConcat<TrJoin<TrDelay<100>,TrFade<300>>,Pulsing<RgbArg<SWING_COLOR_ARG,Rgb<50,50,50>>,Mix<Int<16384>,Black,RgbArg<SWING_COLOR_ARG,Rgb<50,50,50>>>,3000>,TrFade<300>>,EFFECT_FORCE>,TransitionEffectL<TrConcat<TrJoin<TrDelayX<RetractionTime<0>>,TrInstant>,Stripes<5000,-2500,RgbArg<RETRACTION_COLOR_ARG,Rgb<50,50,50>>,Mix<Int<7710>,Black,RgbArg<RETRACTION_COLOR_ARG,Rgb<50,50,50>>>,Mix<Int<3855>,Black,RgbArg<RETRACTION_COLOR_ARG,Rgb<50,50,50>>>>,TrFade<800>>,EFFECT_RETRACTION>,TransitionEffectL<TrWaveX<RgbArg<BLAST_COLOR_ARG,Rgb<255,97,0>>,Scale<WavLen<>,Int<100>,Int<400>>,Int<100>,Scale<WavLen<>,Int<100>,Int<400>>,Scale<BladeAngle<>,Int<1>,Int<1>>>,EFFECT_BLAST>,TransitionEffectL<TrConcat<TrJoin<TrDelay<30>,TrInstant>,RgbArg<CLASH_COLOR_ARG,Rgb<255,97,0>>,TrFade<300>>,EFFECT_CLASH>,LockupTrL<TransitionEffect<AlphaMixL<Bump<Scale<BladeAngle<>,Scale<BladeAngle<0,16000>,Sum<IntArg<LOCKUP_POSITION_ARG,16000>,Int<-12000>>,Sum<IntArg<LOCKUP_POSITION_ARG,16000>,Int<10000>>>,Sum<IntArg<LOCKUP_POSITION_ARG,16000>,Int<-10000>>>,Scale<SwingSpeed<100>,Int<14000>,Int<18000>>>,BrownNoiseFlickerL<RgbArg<LOCKUP_COLOR_ARG,Rgb<0,0,0>>,Int<200>>,StripesX<Int<1800>,Scale<NoisySoundLevel,Int<-3500>,Int<-5000>>,Mix<Int<6425>,Black,RgbArg<LOCKUP_COLOR_ARG,Rgb<0,0,0>>>,RgbArg<LOCKUP_COLOR_ARG,Rgb<0,0,0>>,Mix<Int<12850>,Black,RgbArg<LOCKUP_COLOR_ARG,Rgb<0,0,0>>>>>,AlphaL<AudioFlicker<RgbArg<LOCKUP_COLOR_ARG,Rgb<0,0,0>>,Mix<Int<10280>,Black,RgbArg<LOCKUP_COLOR_ARG,Rgb<0,0,0>>>>,Bump<Scale<BladeAngle<>,Scale<BladeAngle<0,16000>,Sum<IntArg<LOCKUP_POSITION_ARG,16000>,Int<-12000>>,Sum<IntArg<LOCKUP_POSITION_ARG,16000>,Int<10000>>>,Sum<IntArg<LOCKUP_POSITION_ARG,16000>,Int<-10000>>>,Int<13000>>>,TrJoin<TrDelay<8000>,TrInstant>,TrFade<3000>,EFFECT_LOCKUP_BEGIN>,TrConcat<TrJoin<TrDelay<50>,TrInstant>,Mix<IsLessThan<ClashImpactF<>,Int<26000>>,RgbArg<LOCKUP_COLOR_ARG,Rgb<0,0,0>>,AlphaL<RgbArg<LOCKUP_COLOR_ARG,Rgb<0,0,0>>,Bump<Scale<BladeAngle<>,Scale<BladeAngle<0,16000>,Sum<IntArg<LOCKUP_POSITION_ARG,16000>,Int<-12000>>,Sum<IntArg<LOCKUP_POSITION_ARG,16000>,Int<10000>>>,Sum<IntArg<LOCKUP_POSITION_ARG,16000>,Int<-10000>>>,Scale<ClashImpactF<>,Int<20000>,Int<60000>>>>>,TrFade<300>>,TrConcat<TrInstant,RgbArg<LOCKUP_COLOR_ARG,Rgb<0,0,0>>,TrFade<400>>,SaberBase::LOCKUP_NORMAL>,LockupTrL<AlphaL<RandomPerLEDFlickerL<RgbArg<DRAG_COLOR_ARG,Rgb<0,0,0>>>,SmoothStep<IntArg<DRAG_SIZE_ARG,28000>,Int<3000>>>,TrConcat<TrJoin<TrDelay<4000>,TrWipeIn<200>>,AlphaL<BrownNoiseFlickerL<RgbArg<DRAG_COLOR_ARG,Rgb<0,0,0>>,Int<300>>,SmoothStep<IntArg<DRAG_SIZE_ARG,28000>,Int<3000>>>,TrFade<4000>>,TrFade<300>,SaberBase::LOCKUP_DRAG>,LockupTrL<AlphaL<Remap<Scale<RampF,Int<65536>,Int<0>>,StaticFire<Mix<TwistAngle<>,RgbArg<STAB_COLOR_ARG,Rgb<255,24,0>>,RotateColorsX<Int<3000>,RgbArg<STAB_COLOR_ARG,Rgb<255,24,0>>>>,Mix<TwistAngle<>,RotateColorsX<Int<3000>,RgbArg<STAB_COLOR_ARG,Rgb<255,24,0>>>,RotateColorsX<Int<3000>,Mix<Int<12000>,Black,RgbArg<STAB_COLOR_ARG,Rgb<255,24,0>>>>>,0,3,5,3000,10>>,SmoothStep<IntArg<MELT_SIZE_ARG,28000>,Int<4000>>>,TrConcat<TrWipeIn<100>,AlphaL<RgbArg<STAB_COLOR_ARG,Rgb<255,24,0>>,SmoothStep<IntArg<MELT_SIZE_ARG,28000>,Int<4000>>>,TrJoin<TrDelay<4000>,TrFade<300>>,AlphaL<Mix<TwistAngle<>,RgbArg<STAB_COLOR_ARG,Rgb<255,24,0>>,RotateColorsX<Int<3000>,RgbArg<STAB_COLOR_ARG,Rgb<255,24,0>>>>,SmoothStep<IntArg<MELT_SIZE_ARG,28000>,Int<4000>>>,TrFade<4000>>,TrWipe<200>,SaberBase::LOCKUP_MELT>,InOutTrL<TrInstant,TrFadeX<RetractionTime<0>>,Black>,TransitionEffectL<TrConcat<TrFadeX<Mult<Int<8192>,WavLen<EFFECT_PREON>>>,AlphaL<HumpFlickerL<RgbArg<PREON_COLOR_ARG,Rgb<255,97,0>>,10>,SmoothStep<IntArg<PREON_SIZE_ARG,-1781>,Int<-4000>>>,TrFadeX<Mult<Int<8192>,WavLen<EFFECT_PREON>>>,AlphaL<HumpFlickerL<RgbArg<PREON_COLOR_ARG,Rgb<255,97,0>>,15>,SmoothStep<Sum<Int<2000>,IntArg<PREON_SIZE_ARG,-1781>>,Int<-4000>>>,TrFadeX<Mult<Int<8192>,WavLen<EFFECT_PREON>>>,AlphaL<HumpFlickerL<RgbArg<PREON_COLOR_ARG,Rgb<255,97,0>>,20>,SmoothStep<Sum<Int<4000>,IntArg<PREON_SIZE_ARG,-1781>>,Int<-4000>>>,TrBoingX<Mult<Int<8192>,WavLen<EFFECT_PREON>>,3>>,EFFECT_PREON>,TransitionEffectL<TrConcat<TrJoin<TrDelay<2000>,TrInstant>,AlphaL<Mix<BatteryLevel,Red,Green>,Bump<BatteryLevel,Int<10000>>>,TrFade<300>>,EFFECT_BATTERY_LEVEL>,TransitionEffectL<TrConcat<TrJoin<TrDelay<2000>,TrInstant>,AlphaL<Mix<BatteryLevel,Red,Green>,SmoothStep<IntArg<EMITTER_SIZE_ARG,-662>,Int<-4000>>>,TrFade<300>>,EFFECT_BOOT>,TransitionEffectL<TrConcat<TrJoin<TrDelay<2000>,TrInstant>,AlphaL<Mix<BatteryLevel,Red,Green>,SmoothStep<IntArg<EMITTER_SIZE_ARG,-662>,Int<-4000>>>,TrFade<300>>,EFFECT_NEWFONT>>>()},
/*
Add to preset as StylePtr<DredgenMainOrange>()
--------------------------------------------------------------------------*/
#endif

Now… it’s not working… @profezzorn @NoSloppy
I’m using 7.6, so technically it could be Beta testing :wink:
It’s not firing, and the Mode change does nothing.

Battery voltage: 3.71
Battery voltage: 3.70
Battery voltage: 3.69
Battery voltage: 3.68
 done
Activating polyphonic font.
Activating SmoothSwing V2
Accent Swings Enabled.
Polyphonic swings: 7
Monophonic swings: 0
Accent Slashes NOT Detected: 
Ignition.
unit = 0 vol = 0.50, Playing Blaster/Dredgen/E-11/preon/preon1.wav
channels: 1 ratWelcome to ProffieOS v7.6
For available serial commands, see:
https://pod.hubbe.net/tools/serial-monitor-commands.html
I2C init..
Motion chip ... 105 found.
Display initialized.
No sounds found: poweron
No sounds found: hum
unit = 1 vol = 0.00, SmoothSwing V2 cannot allocate wav player.
No sounds found: hum
Audio underflows: 1
Amplifier off.
Battery voltage: 3.69
Battery voltage: 3.68
Battery voltage: 3.67
Battery voltage: 3.66
Battery voltage: 3.65
EVENT: Down-Pressed#1 ON millis=117729
EVENT: Down-Pressed ON millis=117729
EVENT: Down-Released#1 ON millis=118000
EVENT: Down-Released ON millis=118000
EVENT: Down-Shortclick#1 ON millis=118000
EVENT: Down-Shortclick ON millis=118000
EVENT: Down-SavedShortclick#1 ON millis=118230
Amplifier off.
Battery voltage: 3.65
EVENT: Up-Pressed#1 ON millis=125006
EVENT: Up-Pressed ON millis=125006
No sounds found: blast
Amplifier off.
EVENT: Up-Released#1 ON millis=125263
EVENT: Up-Released ON millis=125263
EVENT: Up-Pressed#1 ON millis=130311
EVENT: Up-Pressed ON millis=130311
No sounds found: blast
Amplifier off.
EVENT: Up-Released#1 ON millis=130474
EVENT: Up-Released ON millis=130474
EVENT: Up-Pressed#1 ON millis=137569
EVENT: Up-Pressed ON millis=137569
No sounds found: blast
Amplifier off.
EVENT: Up-Released#1 ON millis=137652
EVENT: Up-Released ON millis=137652
Battery voltage: 3.64
EVENT: Down-Pressed#1 ON millis=141755
EVENT: Down-Pressed ON millis=141755
EVENT: Down-Released#1 ON millis=141792
EVENT: Down-Released ON millis=141792
EVENT: Down-Shortclick#1 ON millis=141793
EVENT: Down-Shortclick ON millis=141793
EVENT: Down-Pressed#2 ON millis=141821
channels: 1 rate: 44100 bits: 16
EVENT: Down-Released#2 ON millis=142075
EVENT: Down-Released ON millis=142075
EVENT: Down-Shortclick#2 ON millis=142075
EVENT: Down-Shortclick ON millis=142075
EVENT: Down-SavedShortclick#2 ON millis=142338
EVENT: Down-SavedShortclick ON millis=142338
EVENT: Down-Pressed#1 ON millis=147325
EVENT: Down-Pressed ON millis=147325
EVENT: Down-Released#1 ON millis=147329
EVENT: Down-Released ON millis=147329
EVENT: Down-Shortclick#1 ON millis=147329
EVENT: Down-Shortclick ON millis=147329
EVENT: Down-SavedShortclick#1 ON millis=147826
EVENT: Up-Pressed#1 ON millis=150079
EVENT: Up-Pressed ON millis=150080
No sounds found: lock
EVENT: Up-Released#1 ON millis=150296
EVENT: Up-Released ON millis=150300
EVENT: Up-Pressed#1 ON millis=151742
EVENT: Up-Pressed ON millis=151742
No sounds found: lock
EVENT: Up-Released#1 ON millis=151918
EVENT: Up-Released ON millis=151918
Battery voltage: 3.62

What I’m seeing is that it is reading the BUTTON_FIRE as BUTTON_UP and BUTTON_MODE as BUTTON_DOWN. I know that all define as 8 and 16, but I’m not getting firing nor preset changes.

I’ve found out that blast is different from blst in the soundfont. :man_facepalming:
Still lot’s of debugging. Even the latching switch is giving me problems. Might redo the whole thing with a focus on rigidity.

you have this?

Button FireButton(BUTTON_FIRE, powerButtonPin, "fire");
Button ModeButton(BUTTON_MODE_SELECT, auxPin, "modeselect");

Yep, I’ve found out I didn’t had the relevant sounds on the soundfont. Somehow, it was not outputting the xxx.wav not found error.
Now I need to do two things:

  1. I need a style that turns on when the clip is in, and turns off when the clip is off.
  2. I need to change the color of the blades when entering stun, fire and auto modes.

Ok, I can fire, switch mode and reload easily. Changing presets require some delicate timing between mode change and reload. So, in my current state I can say that what works is:

  1. Fire
  2. Mode change.
  3. Preset Change (timing not very forgiving)
  4. Change Clip (both holding Mode as Reload).
  5. Single fire does respects clip max rounds.
  6. Auto does not respect clip max rounds.
  7. It makes no sense given (6.) keep round states between modes.
  8. ClipButton does not seems to do anything.
  9. Neither does RangeButton.

I think I should move to a new thread and go full blaster.h debugging.

1 Like

Hello Baldusi, I have also checked the prop file and regarding the clip button: I have no problem using it. I changed the following in my config file and then it worked properly:

#define NUM_BUTTONS 3

and Buttons:

Button FireButton(BUTTON_FIRE, powerButtonPin, “fire”);
Button ModeButton(BUTTON_MODE_SELECT, auxPin, “modeselect”);
LatchingButton ClipButton(BUTTON_CLIP_DETECT, aux2Pin, “clip”);

With a latching button I can get the clipin and clipout sound. However, I needed to use aux2Pin instead blade4Pin. Last does not work. Also when clip is released, magazine is empty and needs to be reloaded by the reload button after inserting it. So what the prop file is currently giving, the clip function works fine if used like above.

1 Like

I love your formatting! Notes being taken

1 Like