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