It looos like the code components for SubBlade (and SubBladeReverse) interfere with DimBlade.
Are these compatible? I wanted to dim a quad zigzag blade.
It looos like the code components for SubBlade (and SubBladeReverse) interfere with DimBlade.
Are these compatible? I wanted to dim a quad zigzag blade.
I looked at it briefly for ProffieConfig v1.8.0 and couldn’t find a reason why you couldn’t do ungodly things like DimBlade the WS281XBladePtr, and also DimBlade individual subblades.
It just wraps the run function iirc.
Well I thought of three applications: testing bare LEDs when construction funky blades.
Brightness limitation in items that should never hit full brightness anyways.
Chilling out pcb LEDs which are always so bright you really shouldn’t look at them.
I’ll give it a shot but if someone has an example blade array in which this is done, it would be very kind of you would post it. I’m ok at analyzing and repeating, but not so great at doing coding that’s new to me.
Well, I don’t have a saber to test with (It’s a running joke/reality… I recognize the irony),
but this compiles:
BladeConfig blades[] = {
{ 0,
DimBlade(20, SubBladeWithStride(0, 14, 2, DimBlade(80, WS281XBladePtr<132, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>()))),
DimBlade(20, SubBladeWithStride(1, 15, 2, nullptr)),
DimBlade(85, SubBlade(16, 131, nullptr)),
CONFIGARRAY(blade_in)
},
};
Thanks, I’ll give it a try!
EDIT:
My actual array based on your help:
BladeConfig blades[] = {
{ 0,
//27 LEDs
DimBlade(50, SubBlade(0, 26, DimBlade(50, WS281XBladePtr<108, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >()))),
//27 LEDs
DimBlade(50, SubBladeReverse(27, 53, NULL)),
//27 LEDs
DimBlade(50, SubBlade(54, 80, NULL)),
//27 LEDs
DimBlade(50, SubBladeReverse(81, 107, NULL)),
//108 LEDs total
CONFIGARRAY(presets) },
};
You need something like this, which I used with a Shtok 64 bit pixel screen to dial down the brightness a bit. It pretty much covers every combination:
// Shtok 64 Bit 1:
DimBlade(25.0, SubBladeReverse (0, 15, WS281XBladePtr<64, blade7Pin, Color8::GRB, PowerPINS<bladePowerPin6>>())),
// Shtok 64 Bit 2:
DimBlade(25.0, SubBlade(16, 31, NULL)),
// Shtok 64 Bit 3:
DimBlade(25.0, SubBladeReverse(32, 47, NULL)),
// Shtok 64 Bit 4:
DimBlade(25.0, SubBlade(48, 63, NULL)),
Sweet, thanks! Screen dimming is an application I hadn’t considered. Pretty cool!
Sorry, I got an error on compile and must have missed something. Can you see what it is?
Config:
#ifdef CONFIG_TOP
#include "proffieboard_v2_config.h"
#define NUM_BLADES 4
#define NUM_BUTTONS 1
#define VOLUME 1000
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 1.0
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#define ENABLE_ALL_EDIT_OPTIONS
#define FETT263_EDIT_MODE_MENU
#endif
#ifdef CONFIG_PROP
#include "../props/saber_fett263_buttons.h"
#endif
#ifdef CONFIG_PRESET
Preset presets[] = {
{ "TeensySF;common", "common/tracks/venus.wav",
StyleNormalPtr<CYAN, WHITE, 300, 800>(),
StyleNormalPtr<CYAN, WHITE, 300, 800>(),
StyleNormalPtr<CYAN, WHITE, 300, 800>(),
StyleNormalPtr<CYAN, WHITE, 300, 800>(),"cyan"},
};
BladeConfig blades[] = {
{ 0,
//27 LEDs
DimBlade(50.0, SubBlade(0, 26, WS281XBladePtr<108, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >())),
//27 LEDs
DimBlade(50.0, SubBladeReverse(27, 53, NULL)),
//27 LEDs
DimBlade(50.0, SubBlade(54, 80, NULL)),
//27 LEDs
DimBlade(50.0, SubBladeReverse(81, 107, NULL)),
//108 LEDs total
CONFIGARRAY(presets) },
};
#endif
#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
#endif
Error:
In file included from /Users/catherinebogin/Documents/Sabers/ProffieOSCollection/ProffieOS7.15STABLE/ProffieOS/ProffieOS.ino:240:
/Users/catherinebogin/Documents/Sabers/ProffieOSCollection/ProffieOS7.15STABLE/ProffieOS/props/prop_base.h: In member function 'size_t PropBase::FindBestConfig()':
/Users/catherinebogin/Documents/Sabers/ProffieOSCollection/ProffieOS7.15STABLE/ProffieOS/props/prop_base.h:567:25: error: 'blades' was not declared in this scope
567 | static_assert(NELEM(blades) > 0, "blades array cannot be empty");
| ^~~~~~
/Users/catherinebogin/Documents/Sabers/ProffieOSCollection/ProffieOS7.15STABLE/ProffieOS/common/common.h:18:26: note: in definition of macro 'NELEM'
18 | #define NELEM(X) (sizeof(X)/sizeof((X)[0]))
| ^
In file included from /Users/catherinebogin/Documents/Sabers/ProffieOSCollection/ProffieOS7.15STABLE/ProffieOS/props/saber_fett263_buttons.h:928,
from /Users/catherinebogin/Documents/Sabers/ProffieOSCollection/ProffieOS7.15STABLE/ProffieOS/config/Nunchaku715DIMSense.h:18,
from /Users/catherinebogin/Documents/Sabers/ProffieOSCollection/ProffieOS7.15STABLE/ProffieOS/ProffieOS.ino:625:
/Users/catherinebogin/Documents/Sabers/ProffieOSCollection/ProffieOS7.15STABLE/ProffieOS/props/prop_base.h: In member function 'void PropBase::FindBlade()':
/Users/catherinebogin/Documents/Sabers/ProffieOSCollection/ProffieOS7.15STABLE/ProffieOS/props/prop_base.h:622:22: error: 'blades' was not declared in this scope
622 | current_config = blades + best_config;
| ^~~~~~
exit status 1
Compilation error: 'blades' was not declared in this scope```
it’s plural.
#ifdef CONFIG_PRESETS
Oy! thanks
Fwiw my example was more of a “this is possible,” not that it quite aligned with what I think you’re going for… which was probably poor on my part.
If you want all the sub blades dimmed the same, just dim the main blade (dim blade inside subblade), if you want sub blades individually dimmed differently, dim the subblade(s) (fun blade outside the subblade).
I’d be curious, I think just doing DimBlade 25 on the WS281X would achieve the same result. Conceptually that makes sense at least.
If you wanted a random test
What makes you think so?
I have used them together in the past.
OK, I was trying to work from the POD without speaking code (my Japanese is better, and that’s horrible ). Thank you for always creating an example! At least I can look for a pattern to copy.
That gave me the a and b of a + b = code for me
BladeConfig blades[] = {
{ 0,
DimBlade(50.0, WS281XBladePtr<144, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
CONFIGARRAY(presets) },
};
SubBlade(9, 108, WS281XBlade<109, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>()),
SubBlade(1, 8, NULL),
SubBlade(0, 0, NULL),
In the above examples, my muggle eyes see the TheThing, then numbers and commas in both cases in front of WS281X. In one case it dictates the dimming percentage, but in the other it counts out LEDs. One has to move… now what? I guess ask here
And now, I will join you.
I was about to start writing a post with the exact same subject.
I have another application for you:
A motor, a crystal chamber, a hilt side PCB and a main blade go to a bar and when they come out after a few drinks, they noticed that they have all been wired in PARALELL by TXQ/Theory Sabers!
I know, it sounds like the beginning of a bad joke, but the joke is on me because this is what I got the_fallen_knight with exposed spinning dual crystal chamber where everything is kind of wired in parallel (I think).
When I ran edit blade length from the new OS8 MENU_SPEC_TEMPLATE DefaultMenuSpec this is what I observe starting at blade length “one”:
without a blade:
with a blade:
So I was thinking to subblade the first 3 pixels (the glow of the crystal chamber is only controlled from the first pixel) the motor is activated by the first 3 pixels
I want to be able to dim the main blade without affecting the rotation speed of the exposed crystal chamber or the crystal chamber glow which is not that bright to begin with & the crystals colors are fixed, one is red the other is dark blue.
So I started with this:
BladeConfig blades[] = {
{ 0, // my real blade, brightness at 100% ===
WS281XBladePtr<129, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>(),
CONFIGARRAY(presets) },
{ 1, // === Dim blade, brightness at 80% ===
DimBlade(80.0, WS281XBladePtr<129, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
CONFIGARRAY(presets) },
{ 2, // === Dim blade, brightness at 50% ===
DimBlade(50.0, WS281XBladePtr<129, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
CONFIGARRAY(presets) },
{ 3, // === Dim blade, brightness at 30% ===
DimBlade(30.0, WS281XBladePtr<129, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >()),
CONFIGARRAY(presets) },
};
Then I turned it into this:
BladeConfig blades[] = {
{ 0, // my real blade, brightness at 100% ===
SubBlade(3, 128, WS281XBladePtr<129, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>()),
SubBlade(0, 2, NULL),CONFIGARRAY(presets) },
{ 1, // === Dim blade, brightness at 80% ===
DimBlade(80.0, SubBlade(3, 128, WS281XBladePtr<129, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>())),
SubBlade(0, 2, NULL),CONFIGARRAY(presets) },
{ 2, // === Dim blade, brightness at 50% ===
DimBlade(50.0, SubBlade(3, 128, WS281XBladePtr<129, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>())),
SubBlade(0, 2, NULL),CONFIGARRAY(presets) },
{ 3, // === Dim blade, brightness at 30% ===
DimBlade(30.0, SubBlade(3, 128, WS281XBladePtr<129, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>())),
SubBlade(0, 2, NULL),CONFIGARRAY(presets) },
};
After adding a second blade style to all my presets and changing from NUM_BLADES 1
to NUM_BLADES 2
I now have a dim-able blade array, where the “main subblade” blade will dim and the crystal chamber will not dim.