Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifdef CONFIG_TOP
- #include "proffieboard_config.h"
- #define NUM_BLADES 8//Uses seven blades, the main blade and the crystal chamber
- #define NUM_BUTTONS 2//Uses two button.
- #define VOLUME 2800 //Max volume
- const unsigned int maxLedsPerStrip = 170;
- #define CLASH_THRESHOLD_G 3.0
- #define ENABLE_AUDIO
- #define ENABLE_MOTION
- #define ENABLE_WS2811
- #define ENABLE_SD
- #define SAVE_PRESET
- #define SAVER_VOLUME
- #define COLOR_CHANGE_DIRECT
- #define DISABLE_DIAGNOSTIC_COMMANDS
- #define BLADE_DETECT_PIN 8 //pin on proffieboard that determines whether the emitter is connecte or not.
- //#define IDLE_OFF_TIME 60 * 5 * 1000//shuts off all power to blades after 5 minutes of standby to help preserve battery
- #define SHARED_POWER_PINS
- #define ENABLE_SERIAL
- #define ENABLE_SSD1306
- #define OLED_FLIP_180
- #endif
- //uses a special file for button functions. Located in prop folder
- #ifdef CONFIG_PROP
- #include "../props/saber_sa22c_buttons.h"
- #endif
- #ifdef CONFIG_PRESETS
- // Code for charging indicator
- //-------------------------------------------------------------------------------------
- class ChargingFSVF {
- public:
- ChargingFSVF() { pinMode(chargeDetectPin, INPUT_PULLUP); }
- int calculate(BladeBase* blade) { return digitalRead(chargeDetectPin) ? 0 : 32768; }
- void run(BladeBase* blade) {}
- };
- using ChargingF = SingleValueAdapter<ChargingFSVF>;
- //-------------------------------------------------------------------------------------
- //Battery level indicator style
- using BLI = Mix<SmoothStep<BatteryLevel,Int<-10>>, Black, Mix<BatteryLevel, Red, Green>>;
- //Preset configuration for a fully assembled saber and normal function.
- Preset presets[] =
- {
- //PRESET=============================================================================================================
- {
- "Blind_Cowboy", "",
- //Crystal Chamber
- StylePtr<Layers<RandomFlicker<RotateColorsX<Variation,DeepSkyBlue>,RotateColorsX<Variation,Rgb<0,20,128>>> ,LockupTrL<BrownNoiseFlickerL<White,Int<200>>,TrConcat<TrInstant,White,TrFade<300>>,TrFade<300>,SaberBase::LOCKUP_NORMAL>,LockupTrL<BrownNoiseFlickerL<White,Int<200>>,TrConcat<TrInstant,White,TrFade<300>>,TrFade<300>,SaberBase::LOCKUP_LIGHTNING_BLOCK>,BlastL<Moccasin>,SimpleClashL<Moccasin>,InOutTrL<TrInstant,TrFade<300>,Pulsing<RotateColorsX<Variation,DeepSkyBlue>,RotateColorsX<Variation,Rgb<0,4,10>>,3000>>>>(),
- //LED STRIP
- StylePtr<InOutHelper<SimpleClash<BlastFadeout<Lockup<ColorCycle<Rgb<100,100,100>,10,70>, ColorCycle<Orange,20,80,Red,20,200,2000>>,Orange>, Orange, 80>, 800, 800, ColorCycle<Rgb<100,100,100>, 20,33>>>(),
- StylePtr<Black>(),
- //Extra LED accents past strip
- StylePtr<Blinking<Blue,Black,300,500>>(),
- StylePtr<Blinking<Black,Red,500,500>>(),
- //Main Blade
- StylePtr<Layers<RandomFlicker<RotateColorsX<Variation,DeepSkyBlue>,RotateColorsX<Variation,Rgb<0,20,128>>>,LockupTrL<Layers<AlphaL<AudioFlickerL<White>,Bump<Scale<BladeAngle<>,Scale<BladeAngle<0,16000>,Int<4000>,Int<26000>>,Int<6000>>,Scale<SwingSpeed<100>,Int<14000>,Int<18000>>>>,AlphaL<White,Bump<Scale<BladeAngle<>,Scale<BladeAngle<0,16000>,Int<4000>,Int<26000>>,Int<6000>>,Int<10000>>>>,TrConcat<TrInstant,White,TrFade<400>>,TrConcat<TrInstant,White,TrFade<400>>,SaberBase::LOCKUP_NORMAL>,ResponsiveLightningBlockL<Strobe<White,AudioFlicker<White,Blue>,50,1>,TrConcat<TrInstant,AlphaL<White,Bump<Int<12000>,Int<18000>>>,TrFade<200>>,TrConcat<TrInstant,HumpFlickerL<AlphaL<White,Int<16000>>,30>,TrSmoothFade<600>>>,ResponsiveStabL<Red,TrWipeIn<600>,TrWipe<600>>,ResponsiveBlastL<White,Int<400>,Scale<SwingSpeed<200>,Int<100>,Int<400>>,Int<400>>,ResponsiveClashL<White,TrInstant,TrFade<400>,Scale<BladeAngle<0,16000>,Int<4000>,Int<26000>>,Int<6000>,Int<20000>>,LockupTrL<AlphaL<BrownNoiseFlickerL<White,Int<300>>,SmoothStep<Int<30000>,Int<5000>>>,TrWipeIn<400>,TrFade<300>,SaberBase::LOCKUP_DRAG>,LockupTrL<AlphaL<Mix<TwistAngle<>,Red,Orange>,SmoothStep<Int<28000>,Int<5000>>>,TrWipeIn<600>,TrFade<300>,SaberBase::LOCKUP_MELT>,InOutTrL<TrWipeSparkTip<White,300>,TrWipeIn<500>,Black>>>(),
- //GREEN LED
- StylePtr<InOutHelper<Rgb<0,125,0>,200,200,Blinking<Black,Rgb<0,125,0>,750,500>>>(),
- //RED LED
- StylePtr<InOutHelper<Blinking<Black,Rgb<255,0,0>,750,500>,200,200,Rgb<255,0,0>>>(),
- },
- };
- //Preset configuration for the mode when the emitter is detached from the rest of the hilt.
- Preset detached[] =
- {
- //PRESET=============================================================================================================
- {
- "PKA Detached", "",
- //Crystal Chamber
- StylePtr<Layers<RandomFlicker<RotateColorsX<Variation,DeepSkyBlue>,RotateColorsX<Variation,Rgb<0,20,128>>> ,LockupTrL<BrownNoiseFlickerL<White,Int<200>>,TrConcat<TrInstant,White,TrFade<300>>,TrFade<300>,SaberBase::LOCKUP_NORMAL>,LockupTrL<BrownNoiseFlickerL<White,Int<200>>,TrConcat<TrInstant,White,TrFade<300>>,TrFade<300>,SaberBase::LOCKUP_LIGHTNING_BLOCK>,BlastL<Moccasin>,SimpleClashL<Moccasin>,InOutTrL<TrInstant,TrFade<300>,Pulsing<RotateColorsX<Variation,DeepSkyBlue>,RotateColorsX<Variation,Rgb<0,4,10>>,3000>>>>(),
- //LED STRIP
- StylePtr<Layers<InOutHelper<SimpleClash<BlastFadeout<Lockup<ColorCycle<White,10,70>, ColorCycle<Orange,40,80,Stripes<100000,150,Blue,Green,DarkOrange,Red>,40,200,2000>>,Orange>, Orange, 80>, 800, 800,Cylon<Stripes<100000,300,White,DarkOrange,DarkOrange,White>, 20,33>>, AlphaL<BLI, ChargingF>>>(),
- StylePtr<Black>(),
- //Extra LED accents past strip
- StylePtr<Layers<Blinking<Blue,Black,300,500>,AlphaL<Black, ChargingF>>>(),
- StylePtr<Layers<Blinking<Black,Green,500,500>,AlphaL<Red, ChargingF>>>(),
- //Main Blade
- StylePtr<IgnitionDelay<2000, StyleFire<DodgerBlue,White,0,5,FireConfig<50,1500,0>,FireConfig<15,1500,0>,FireConfig<15,1500,10>,FireConfig<0,0,5>>>>(),
- //GREEN LED
- StylePtr<InOutHelper<Rgb<0,125,0>,200,200,Blinking<Black,Rgb<0,125,0>,750,500>>>(),
- //RED LED
- StylePtr<InOutHelper<Blinking<Black,Rgb<255,0,0>,750,500>,200,200,Rgb<255,0,0>>>(),
- },
- };
- //Blade definitions to specify the deteachable emitter function
- BladeConfig blades[] =
- {
- //==========================================================================
- //EMITTER ATTACHED, NORMAL BLADE FUNCTION
- {
- // blade ID resistor not used
- 0,
- //CC
- SubBlade(0,0, WS2811BladePtr<8, WS2811_800kHz|WS2811_GRB, bladePin, PowerPINS<bladePowerPin1>>()),
- //LED Strip
- DimBlade(25.0, SubBlade(1, 4, NULL)),
- //blank
- SubBlade(5, 5, NULL),
- //LED Strip
- SubBlade(6, 6, NULL),
- //LED Strip
- SubBlade(7, 7, NULL),
- //Main Blade
- WS2811BladePtr<153, WS2811_800kHz|WS2811_GRB, blade2Pin, PowerPINS<bladePowerPin2, bladePowerPin3>>(),
- //GREEN Control Box Accent LED, 1 LED, power on LED4, 22 Ohm Resistor
- SimpleBladePtr<NoLED, CreeXPE2GreenTemplate<0>, NoLED, NoLED, -1, bladePowerPin5, -1, -1>(),
- //RED Control Box Accent LED, 1 LED, power on LED5, 82 Ohm Resistor
- SimpleBladePtr<CreeXPE2RedTemplate< 82000>, NoLED, NoLED, NoLED, bladePowerPin4, -1, -1, -1>(),
- CONFIGARRAY(presets)
- },
- //==========================================================================
- //EMITTER NOT ATTACHED, SPECIAL MODE FUNCTION
- {
- NO_BLADE,
- //CC
- SubBlade(0,0, WS2811BladePtr<8, WS2811_800kHz|WS2811_GRB, bladePin, PowerPINS<bladePowerPin1>>()),
- //LED Strip
- DimBlade(25.0, SubBlade(1, 4, NULL)),
- //blank
- SubBlade(5, 5, NULL),
- //LED Strip
- SubBlade(6, 6, NULL),
- //LED Strip
- SubBlade(7, 7, NULL),
- //Main Blade
- WS2811BladePtr<153, WS2811_800kHz|WS2811_GRB, blade2Pin, PowerPINS<bladePowerPin2, bladePowerPin3>>(),
- //GREEN Control Box Accent LED, 1 LED, power on LED4, no resistor
- SimpleBladePtr<NoLED, CreeXPE2GreenTemplate<0>, NoLED, NoLED, -1, bladePowerPin5, -1, -1>(),
- //RED Control Box Accent LED, 1 LED, power on LED5, 82 Ohm Resistor
- SimpleBladePtr<CreeXPE2RedTemplate<82000>, NoLED, NoLED, NoLED, bladePowerPin4, -1, -1, -1>(),
- CONFIGARRAY(detached)
- },
- };
- #endif
- #ifdef CONFIG_BUTTONS
- Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
- Button AuxButton(BUTTON_AUX, auxPin, "aux");
- #endif
Add Comment
Please, Sign In to add comment