How I handle CONFIG_TOP for my configs

I have found what works best for me, and just thought I’d share in case someone else can benefit from it, or feels like discussing it.

So, since commented lines are ignored by the compiler, what I do is have a constant, complete, organized list of ALL the #defines I might ever use, and simply treat this list as a checkmark list to turn options on and off on a per-saber basis.

I have a “test” config file named BC_Testbed.h that I use to test new boards with, try new features, experiment with code edit results etc… This config always gets updated to include the latest supported #defines and features.
So, when making a new config, I can always start with copying the CONFIG_TOP info from that universal test config. It also allows for easy updates to older config files when I pull a dusty saber from the shelf.

I categorize the defines by blade, audio, gestures etc, and each section contains the pertinent defines.

Here’s the current version. It does include some now-dead stuff, unofficial stuff, notes-to-self labeled “BC” and things, but you can get the general idea.
I suggest viewing on a screen that will allow it to show wider than the website here can render, to avoid excessive wrapped text.

Feel free to ask anything about any of this.

// BC_ID7_7.x

#include "proffieboard_v2_config.h"
#define NUM_BLADES 1
#define NUM_BUTTONS 1
// #define DUAL_POWER_BUTTONS                        // BC Make both buttons identical for 1-btn use... useful?

// ------ Audio Stuff --------

#define VOLUME 1200
#define BOOT_VOLUME 200
// #define SPEAK_BLADE_ID
// #define ENABLE_I2S_OUT
// #define LINE_OUT_VOLUME 2000                    // SPDIF out
#define FILTER_ORDER 8
// #define FEMALE_TALKIE_VOICE                        // BC now canon
#define NO_REPEAT_RANDOM                            // BC now canon
#define KILL_OLD_PLAYERS                            // BC now canon
#define DISABLE_TALKIE                              // BC Prob only in extreme need conditions

// ------ Blade Stuff ------

#define ENABLE_WS2811
const unsigned int maxLedsPerStrip = 144;
// New define that can speed up processing a bit. Basically, it can calculate the colors for the next
// blade (or the next frame for the same blade) even though it's not done feeding out the data for the
// data in the color buffer yet.Equivalent to just indrasing maxLedsPerStrip.
// #define BLADE_DETECT_PIN blade3Pin
// #define ENABLE_POWER_FOR_ID PowerPINS<bladePowerPin2, bladePowerPin3>
// #define BLADE_ID_CLASS ExternalPullupBladeID<bladeIdentifyPin, 33000>
// #define BLADE_ID_CLASS BridgedPullupBladeID<bladeIdentifyPin, 9> // TX pad
// #define BLADE_ID_CLASS SnapshotBladeID<bladeIdentifyPin> // This will make it use the speed-of-charging-a-capacitor method of blade ID which sometimes works without resistors.
// Blade ID can detect if a blade is connected or not, but it won't actually reach the NO_BLADE value, so I would recommend using something like 200000 instead of NO_BLADE.

// ------ SD Card Stuff -------

#define ENABLE_SD
//#define SAVE_STATE
    // #define SAVE_VOLUME
    // #define SAVE_PRESET
// #define KEEP_SAVEFILES_WHEN_PROGRAMMING          // upload overwrites presets.ini/tmp unless this is defined

// ------- OLED stuff ----------

// #define ENABLE_SSD1306
// #define OLED_FLIP_180                            // BC now canon
// #define USE_AUREBESH_FONT                        // BC now canon
// #define PLI_OFF_TIME 60 * 5 * 1000
// #define POV_INCLUDE_FILE "1024px-Star_Wars_Logo.svg_144_SC_POV_data.h"
// #define POV_INCLUDE_FILE "Raiden_123_FC_POV_data.h"
// #define POV_INCLUDE_FILE "JohnCena_144_8b_POV_data.h"

// ------ System Stuff --------

// #define ENABLE_SERIAL //Bluetooth
#define IDLE_OFF_TIME 60 * 5 * 1000
#define MOTION_TIMEOUT 60 * 5 * 1000
// The following changes the angle required to register twists on curved hilts.
// Example is for assaj ventress curved hit install
// #define ORIENTATION_ROTATION 0,-20,0
// #define CONFIG_STARTUP_DELAY 15000                 // BC now canon
#define DISABLE_BASIC_PARSER_STYLES                 // Standard, Advanced, Old School original templated styles etc...

// ------- Motion and Gesture stuff -------

// #define BC_SWING_ON                                 // Motion time out causing false ignitions on preset switch. This is annoying but possibly resolved with I2C updates.
// #define BC_STAB_ON
#define BC_THRUST_ON
// #define BC_TWIST_ON
#define BC_TWIST_OFF
// #define BC_FORCE_PUSH
#define ENABLE_AUTO_SWING_BLAST                     // BC Multiblast continues as long as swinging within 1 second. 
#define ENABLE_AUTO_SPINS_BLAST                     // Same as auto-multi-blast but for spins. 2 second window.    **Required modified prop_base.h
#define BC_LOCKUP_DELAY 200
// #define NO_BLADE_NO_GEST_ONOFF                   // If using blade detect, No Blade = No Gesture ignitions or retractions

// ------- Custom / Experimental / Alpha-Beta stuff ---------

// #define AUTO_HUMSTART******  DEAD                // BC now canon as ProffieOSHumDelay in config.ini
// #define LOW_BATT_ONCE                            // BC - THIS NEEDS TO BE CheckLowBattery(), see PR     **Requires modified hybrid_font.h file.
// #define LOW_BATT_WARNINGS_TIERED                 // meh...just annoying if not accurate..likely.        **Requires modified hybrid_font.h file.
// #define ENABLE_GESTURE_MENU                      // PSISTORM prop - cool stuff! the TrySound else beep void.
// #define BLADE_ID_MONITORED                       // Constant monitoring of blade resistor value. BladeConfig set to what's detected.

// -------- BC Prop Stuff --------

// #define NO_VOLUME_MENU                           // self evident. But why?
// #define BC_SWAP                                  // Otherwise 4th held click is SPAM BLAST toggle

// -------- Blaster Stuff ----------

// #define BLASTER_SHOTS_UNTIL_EMPTY 15  // (whatever number)
// #define BLASTER_JAM_PERCENTAGE 10     // if not defined, random.


#include "../props/saber_BC_buttons_personal.h"
//#include "../scripts/motion_startup_recorder.h"


//----Aliases for effects sets via 'using'----
#include "aliases/TrueWhites/BC_effects_1.h"              // For Green, light Blue, ...light colored blades
// #include "aliases/TrueWhites/BC_effects_1_BlastRotate.h"  // EffectSequence driven different blast animations
// #include "aliases/TrueWhites/BC_effects_2.h"              // for crystals chambers or accents
#include "aliases/TrueWhites/BC_effects_Red.h"            // For Red or dark blades
#include "aliases/TrueWhites/BC_effects_White.h"          // For White blades
// #include "aliases/TrueWhites/BC_12color_8effect_SS.h"     // Uses BC_SWAP for base blade color. All in one blade style like EffectScroll from ol' CC Fork. 96 possible blade combos in one style. .

using OnDemandVolumeLevel = TransitionEffectL<TrConcat<TrExtendX<Int<1000>,TrSmoothFade<200>>,AlphaL<Gradient<Blue,Green>,SmoothStep<VolumeLevel,Int<-1>>>,TrSmoothFade<500>>,EFFECT_VOLUME_LEVEL>;
using OnDemandBatteryLevel = AlphaL<TransitionEffectL<TrConcat<TrSmoothFade<500>,AlphaL<Mix<BatteryLevel,Red,Green>,SmoothStep<Scale<BatteryLevel,Int<0>,Int<35000>>,Int<-1>>>,TrDelay<1000>,AlphaL<Mix<BatteryLevel,Red,Green>,SmoothStep<BatteryLevel,Int<-1>>>,TrSmoothFade<1000>>,EFFECT_BATTERY_LEVEL>,Ifon<Int<0>,Int<32768>>>;

/* __Presets List___
aa_JayDalorian/Decimate (collab)

Preset ID7 [] = {

...presets follow.....

Well, mine is not so complete, but I’ve been doing that on what I use:

Hilt: SaberForge Disciple
Board: Proffieboard v2.2
Chassis: Baldusi Custom v1
Soundfont Collection: 2023-01
ProffieOS Version: 6.7
-Momentary Switches: 2
-Battery: 18650 Protected
-Speaker: KR Sabers 22mm V2 3W
-Hilt NPXL Connector: Shtok NPLX ECO Illuminated Connector
-BladeID: 22k resistor (0603 SMD)
-USB-C recharge port
//NO Blade Present Pin
//NO OLED 128 x 32 pixel SSD1306
//NO FSC BT909 Blutooth Module

-PowerButton: Button1 (21) (Momentary Non Illuminated)
-AuxButton:   Button1 (23) (Momentary Non Illuminated)
-NeoPixelBlade01: LED2+LED3 (Shared), Data1
-NeoPixelConnector: 5px mirror
-BladeID Resistor: 22k
-Save State

////// Hardware Defines  //////
#include "proffieboard_v2_config.h"
#define NUM_BLADES 1													//(Blade, illuminated NPXL PCB runs parallel, //If Crystal Chamber +1 // If BlueTooth +1)
#define NUM_BUTTONS 2													//If you add a 2nd button, uncomment the AUX line at the bottom
const unsigned int maxLedsPerStrip = 180;
#define EXTRA_COLOR_BUFFER_SPACE 70										//Helps to make some effects faster
#define CLASH_THRESHOLD_G 2.0											//How difficult is to register effects.
#define ENABLE_WS2811
#define ENABLE_SD
//#define SHARED_POWER_PINS												//This one is only used for sharing NPXL DATA line on same power lines.
//#define ENABLE_POWER_FOR_ID PowerPINS<bladePowerPin2, bladePowerPin3>	//When it detects blade insert it resets the NPXL
//#define BLADE_ID_CLASS ExternalPullupBladeID<bladeIdentifyPin, 21620>	//You have to run a resistor between 20k and 50k between 3.3V and your blade detect pin.
//#define BLADE_DETECT_PIN blade3Pin									//Blade detect pin
//#define ORIENTATION_ROTATION 0,0,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

/////// Audio Defines  ////////
#define VOLUME 1500														//Volume, anything 0-3000, recommended 700
#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
//#define BLE_PASSWORD "FromACertainPOV"		//Redbear BLE preloads BT name and password
//#define BLE_NAME "OWK1"						//
//#define BLE_SHORTNAME "BMPP"					//

///// ProffieOS Defines  //////
#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 * 15 * 1000		//Amount of time power to LEDs remains active after saber is retracted. Might affect Bluetooth.

//// Save States Defines  /////
//#define SAVE_STATE					//Makes the board save last selected Volume, Preset and blade Color
/*#define SAVE_VOLUME

// Presets and Props Defines  /
//#define DUAL_POWER_BUTTONS			//This one means that clicking the AUX will also turn the saber on. If not defined, AUX will go to next preset when off.
//#define FETT263_EDIT_MODE_MENU
//#define FETT263_MAX_CLASH 16
//#define FETT263_SAY_COLOR_LIST
//#define FETT263_LOCKUP_DELAY 200
//#define FETT263_BM_CLASH_DETECT 6
#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


I will have to study yours, because I think your divisions might be better. But I like big comment labels.

Cool! Nice descriptions of environment used in and usage etc…

Loving this Brian. Very thorough.
Interesting reading too. Which, as you might expect from me, has prompted a few questions: :slight_smile:

What does this define actually do:
#define MOTION_TIMEOUT 60 * 5 * 1000
I realise it shuts off the motion chip, but what does that actually mean in practical terms and how does it affect saber function?

Am I right in saying that this define is now built into the OS in that list of all the other OLED parameters?

When the motion chip is inactive, aside from conserving power, it also means that gestures can not be recognized.

Not in the OS quite yet, but pending.
Yes, it would be an option to show image files for blaster effects.

1 Like

Sorry, I’m a bit confused…
Line 15 of the bit of code you posted shows blst as a fileset, and Blast is included in the list of parameters in hybrid_fonts (I remember it as I modified the default duration from 1000ms to 500ms). It works when you add a blst.bmp file to the font folder, even without that define.

What am I missing?
Sorry, just curious is all. :slight_smile:

Blst is the event of stopping a blaster shot with your saber. Like you do when you tap Aux.

While we are on the subject, I’m kinda OCD with Blade ID. :rofl: So this is how I arrange my blades section. I’m using the saber with just a Shtok ECO PCB so it has a single blade.

// Blade number should always be the same. In this case, 3. 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: 2k to 100k Ohms.
BladeConfig blades[] = {
	// Always leave a 0 resistor for a "catch all" config. No resistor will read as high ohms (100k or infinte).
	// 0/Default is an 86cm, 124 pixel WS2812B
	// Only saving state for blade and no blade separatelly. Could also save for each individual blade.
	{ 0,
		WS281XBladePtr<124, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(), // Main Blade with 124 pixels
	} /*,
	// 2.2k **FUTURE USE**
	// 2.7k **FUTURE USE**
	// 3.3k **FUTURE USE**
	// 3.9k **FUTURE USE**
	// 4.7k **FUTURE USE**
	// 5.6k **FUTURE USE**
	// 6.8k is an 56cm 60 pixel WS2812, SMD resistor, mainly used for Grogu
	{ 6800,
		WS281XBladePtr<60, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
	// 8.2k is an 56cm 80 pixel WS2812, SMD resistor, mainly used for Yoda
	{ 8300,
		WS281XBladePtr<80, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
	// 10k  **FUTURE USE**
	// 12k is a 108 pixel WS2812 (or V2 LED Strip)
	{ 12000,
		WS281XBladePtr<108, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
	// 15k is a 122 pixel WS2812 (or V2 LED Strip)
	{ 15000,
		WS281XBladePtr<122, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
	// 18k is a 132 pixel WS2812 (or V2 LED Strip)
	{ 18000,
		WS281XBladePtr<132, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
	// 22.3k is an 86.5cm 124 pixel WS2812
	{ 22300,
		WS281XBladePtr<124, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
	// 27k is a 20 pixel WS2812 (or mini-LED Strip)
	{ 27000,
		WS281XBladePtr<5, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
	// 33k is a 15 pixel WS2812 (or mini-LED Strip)
	{ 33000,
		WS281XBladePtr<5, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
	// 39k is Charging Bladeplug with 5 pixels WS2812b
	{ 39000,
		WS281XBladePtr<5, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
		"chrg_sav"     //You can add a directory to save state for each blade.
	// 47k is Bladeplug with 5 pixels WS2812b, SMD resistor
	{ 47000,
		WS281XBladePtr<5, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
		"plug_sav"     //You can add a directory to save state for each blade.
	// 56k is Shtok's NPXL to TriCree adapter
	{ 56000,
		WS281XBladePtr<1, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
		"tri_save"     //You can add a directory to save state for each blade.
	// 68k is an 86.5cm, 124 pixel WS2812, metal resistor
	{ 68000,
		WS281XBladePtr<124, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
	// 82k is a full length 144 SK6812 (please be careful about the W)
	{ 82000,
		WS281XBladePtr<144, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
	// 100k is an 85cm, 121 pixel WS2812B
	{ 100000,
		WS281XBladePtr<121, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
	//Default no blade uses illuminated PCB's 5 LEDs.
		WS281XBladePtr<5, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
		"nb_save"    //You can add a directory to save state for each blade.

1 Like

Spelling matters.
blst is saber blaster blocking effect.
blast is a blaster bolt.
blst has been in there for a long time.
blast, stun, auto( which is a lockup loop) are probably future possibilities too while we’re at it
Only the bit between the #ifdef and #endif are governed by the define.

Ah OK. I wasn’t aware it was two effects. Although in that case I’m not sure what blst actually does to the sound/blade that’s different to blast (or vice versa).
All the fonts I’ve looked at only have blst wavs.
Sorry - every day is a school day with Proffie! LOL!

blast and the other blaster sounds are typically used in a blaster build. Usually the muzzle and barrel are animated to depict a blaster shot emitting the gun.

blst is shown as an impact on a saber blade from deflecting an attack.

Hope that clarifies.

1 Like

Are these defines for OS 7? Because I find a lot of defines that I don’t recognise. Plus, those with “BC” without “canon” I assume are from your own repository, right?

Yeah, I run the latest GitHub master.
And like I disclosed in the beginning of the post, there’s stuff in there that is just custom personal version stuff. The main objective was just to show structure.

1 Like