Merge 'blazoncek/dev' into 0_14

1-click presets
Bugfix for 1D
virtual strips POC for 1D effects
global SPI MISO pin
This commit is contained in:
Blaz Kristan 2022-08-29 20:45:06 +02:00
commit d28d2c57e4
15 changed files with 3486 additions and 3440 deletions

View File

@ -1036,7 +1036,6 @@ class AudioReactive : public Usermod {
// Only run the sampling code IF we're not in Receive mode or realtime mode // Only run the sampling code IF we're not in Receive mode or realtime mode
if (!(audioSyncEnabled & 0x02) && !disableSoundProcessing) { if (!(audioSyncEnabled & 0x02) && !disableSoundProcessing) {
bool agcEffect = false;
if (soundAgc > AGC_NUM_PRESETS) soundAgc = 0; // make sure that AGC preset is valid (to avoid array bounds violation) if (soundAgc > AGC_NUM_PRESETS) soundAgc = 0; // make sure that AGC preset is valid (to avoid array bounds violation)
unsigned long t_now = millis(); // remember current time unsigned long t_now = millis(); // remember current time

View File

@ -566,16 +566,14 @@ static const char _data_FX_MODE_SAW[] PROGMEM = "Saw@!,Width;!,!,;!;1d";
* Inspired by www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/ * Inspired by www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/
*/ */
uint16_t mode_twinkle(void) { uint16_t mode_twinkle(void) {
const uint16_t cols = strip.isMatrix ? SEGMENT.virtualWidth() : SEGMENT.virtualLength(); //SEGMENT.fill(SEGCOLOR(1));
const uint16_t rows = SEGMENT.virtualHeight(); SEGMENT.fade_out(224);
SEGMENT.fill(SEGCOLOR(1));
uint32_t cycleTime = 20 + (255 - SEGMENT.speed)*5; uint32_t cycleTime = 20 + (255 - SEGMENT.speed)*5;
uint32_t it = strip.now / cycleTime; uint32_t it = strip.now / cycleTime;
if (it != SEGENV.step) if (it != SEGENV.step)
{ {
uint16_t maxOn = map(SEGMENT.intensity, 0, 255, 1, cols*rows-1); // make sure at least one LED is on uint16_t maxOn = map(SEGMENT.intensity, 0, 255, 1, SEGLEN); // make sure at least one LED is on
if (SEGENV.aux0 >= maxOn) if (SEGENV.aux0 >= maxOn)
{ {
SEGENV.aux0 = 0; SEGENV.aux0 = 0;
@ -587,20 +585,17 @@ uint16_t mode_twinkle(void) {
uint16_t PRNG16 = SEGENV.aux1; uint16_t PRNG16 = SEGENV.aux1;
for (int i = 0; i < SEGENV.aux0; i++) for (uint16_t i = 0; i < SEGENV.aux0; i++)
{ {
PRNG16 = (uint16_t)(PRNG16 * 2053) + 13849; // next 'random' number PRNG16 = (uint16_t)(PRNG16 * 2053) + 13849; // next 'random' number
uint32_t p = ((uint32_t)cols*rows * (uint32_t)PRNG16) >> 16; uint32_t p = (uint32_t)SEGLEN * (uint32_t)PRNG16;
uint16_t j = p % cols; uint16_t j = p >> 16;
uint16_t k = p / cols; SEGMENT.setPixelColor(j, SEGMENT.color_from_palette(j, true, PALETTE_SOLID_WRAP, 0));
uint32_t col = SEGMENT.color_from_palette(map(p, 0, cols*rows, 0, 255), false, PALETTE_SOLID_WRAP, 0);
if (strip.isMatrix) SEGMENT.setPixelColorXY(j, k, col);
else SEGMENT.setPixelColor(j, col);
} }
return FRAMETIME; return FRAMETIME;
} }
static const char _data_FX_MODE_TWINKLE[] PROGMEM = "Twinkle@!,;!,!,;!;1d,2d"; //pixels static const char _data_FX_MODE_TWINKLE[] PROGMEM = "Twinkle@!,;!,!,;!;mp12=0,1d"; //pixels
/* /*
@ -671,15 +666,13 @@ uint16_t mode_sparkle(void) {
if (it != SEGENV.step) if (it != SEGENV.step)
{ {
SEGENV.aux0 = random16(SEGLEN); // aux0 stores the random led index SEGENV.aux0 = random16(SEGLEN); // aux0 stores the random led index
SEGENV.aux1 = random16(0,SEGMENT.virtualHeight()-1);
SEGENV.step = it; SEGENV.step = it;
} }
if (strip.isMatrix) SEGMENT.setPixelColorXY(SEGENV.aux0, SEGENV.aux1, SEGCOLOR(0)); SEGMENT.setPixelColor(SEGENV.aux0, SEGCOLOR(0));
else SEGMENT.setPixelColor(SEGENV.aux0, SEGCOLOR(0));
return FRAMETIME; return FRAMETIME;
} }
static const char _data_FX_MODE_SPARKLE[] PROGMEM = "Sparkle@!,;!,!,;!;1d,2d"; static const char _data_FX_MODE_SPARKLE[] PROGMEM = "Sparkle@!,;!,!,;!;mp12=0,1d";
/* /*
@ -687,21 +680,20 @@ static const char _data_FX_MODE_SPARKLE[] PROGMEM = "Sparkle@!,;!,!,;!;1d,2d";
* Inspired by www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/ * Inspired by www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/
*/ */
uint16_t mode_flash_sparkle(void) { uint16_t mode_flash_sparkle(void) {
for (int i = 0; i < SEGLEN; i++) { for(uint16_t i = 0; i < SEGLEN; i++) {
SEGMENT.setPixelColor(i, SEGMENT.color_from_palette(i, true, PALETTE_SOLID_WRAP, 0)); SEGMENT.setPixelColor(i, SEGMENT.color_from_palette(i, true, PALETTE_SOLID_WRAP, 0));
} }
if (strip.now - SEGENV.aux0 > SEGENV.step) { if (strip.now - SEGENV.aux0 > SEGENV.step) {
if(random8((255-SEGMENT.intensity) >> 4) == 0) { if(random8((255-SEGMENT.intensity) >> 4) == 0) {
if (strip.isMatrix) SEGMENT.setPixelColorXY(random16(SEGLEN), random16(0,SEGMENT.virtualHeight()-1), SEGCOLOR(1)); SEGMENT.setPixelColor(random16(SEGLEN), SEGCOLOR(1)); //flash
else SEGMENT.setPixelColor(random16(SEGLEN), SEGCOLOR(1)); //flash
} }
SEGENV.step = strip.now; SEGENV.step = strip.now;
SEGENV.aux0 = 255-SEGMENT.speed; SEGENV.aux0 = 255-SEGMENT.speed;
} }
return FRAMETIME; return FRAMETIME;
} }
static const char _data_FX_MODE_FLASH_SPARKLE[] PROGMEM = "Sparkle Dark@!,!;Bg,Fx,;!;1d,2d"; static const char _data_FX_MODE_FLASH_SPARKLE[] PROGMEM = "Sparkle Dark@!,!;Bg,Fx,;!;mp12=0,1d";
/* /*
@ -716,8 +708,7 @@ uint16_t mode_hyper_sparkle(void) {
if (strip.now - SEGENV.aux0 > SEGENV.step) { if (strip.now - SEGENV.aux0 > SEGENV.step) {
if (random8((255-SEGMENT.intensity) >> 4) == 0) { if (random8((255-SEGMENT.intensity) >> 4) == 0) {
for (int i = 0; i < MAX(1, SEGLEN/3); i++) { for (int i = 0; i < MAX(1, SEGLEN/3); i++) {
if (strip.isMatrix) SEGMENT.setPixelColorXY(random16(SEGLEN), random16(0,SEGMENT.virtualHeight()), SEGCOLOR(1)); SEGMENT.setPixelColor(random16(SEGLEN), SEGCOLOR(1));
else SEGMENT.setPixelColor(random16(SEGLEN), SEGCOLOR(1));
} }
} }
SEGENV.step = strip.now; SEGENV.step = strip.now;
@ -725,7 +716,7 @@ uint16_t mode_hyper_sparkle(void) {
} }
return FRAMETIME; return FRAMETIME;
} }
static const char _data_FX_MODE_HYPER_SPARKLE[] PROGMEM = "Sparkle+@!,!;Bg,Fx,;!;1d,2d"; static const char _data_FX_MODE_HYPER_SPARKLE[] PROGMEM = "Sparkle+@!,!;Bg,Fx,;!;mp12=0,1d";
/* /*
@ -2209,19 +2200,14 @@ static const char _data_FX_MODE_NOISE16_4[] PROGMEM = "Noise 4@!,!;!,!,!;!;1d";
//based on https://gist.github.com/kriegsman/5408ecd397744ba0393e //based on https://gist.github.com/kriegsman/5408ecd397744ba0393e
uint16_t mode_colortwinkle() uint16_t mode_colortwinkle()
{ {
const uint16_t cols = strip.isMatrix ? SEGMENT.virtualWidth() : 1; uint16_t dataSize = (SEGLEN+7) >> 3; //1 bit per LED
const uint16_t rows = strip.isMatrix ? SEGMENT.virtualHeight() : SEGMENT.virtualLength();
uint16_t dataSize = (cols*rows+7) >> 3; //1 bit per LED
if (!SEGENV.allocateData(dataSize)) return mode_static(); //allocation failed if (!SEGENV.allocateData(dataSize)) return mode_static(); //allocation failed
CRGB fastled_col, prev; CRGB fastled_col, prev;
fract8 fadeUpAmount = strip.getBrightness()>28 ? 8 + (SEGMENT.speed>>2) : 68-strip.getBrightness(); fract8 fadeUpAmount = strip.getBrightness()>28 ? 8 + (SEGMENT.speed>>2) : 68-strip.getBrightness();
fract8 fadeDownAmount = strip.getBrightness()>28 ? 8 + (SEGMENT.speed>>3) : 68-strip.getBrightness(); fract8 fadeDownAmount = strip.getBrightness()>28 ? 8 + (SEGMENT.speed>>3) : 68-strip.getBrightness();
for (uint16_t i = 0; i < SEGLEN; i++) {
for (int i = 0; i < rows*cols; i++) { fastled_col = SEGMENT.getPixelColor(i);
uint16_t j = i % cols, k = i / cols;
fastled_col = CRGB(strip.isMatrix ? SEGMENT.getPixelColorXY(j, k) : SEGMENT.getPixelColor(i)); // TODO
prev = fastled_col; prev = fastled_col;
uint16_t index = i >> 3; uint16_t index = i >> 3;
uint8_t bitNum = i & 0x07; uint8_t bitNum = i & 0x07;
@ -2235,36 +2221,28 @@ uint16_t mode_colortwinkle()
if (fastled_col.red == 255 || fastled_col.green == 255 || fastled_col.blue == 255) { if (fastled_col.red == 255 || fastled_col.green == 255 || fastled_col.blue == 255) {
bitWrite(SEGENV.data[index], bitNum, false); bitWrite(SEGENV.data[index], bitNum, false);
} }
SEGMENT.setPixelColor(i, fastled_col.red, fastled_col.green, fastled_col.blue);
if (strip.isMatrix) SEGMENT.setPixelColorXY(j, k, fastled_col); if (SEGMENT.getPixelColor(i) == RGBW32(prev.r, prev.g, prev.b, 0)) { //fix "stuck" pixels
else SEGMENT.setPixelColor(i, fastled_col.red, fastled_col.green, fastled_col.blue);
uint32_t col = strip.isMatrix ? SEGMENT.getPixelColorXY(j, k) : SEGMENT.getPixelColor(i); // TODO
if (CRGB(col) == prev) { //fix "stuck" pixels
fastled_col += fastled_col; fastled_col += fastled_col;
if (strip.isMatrix) SEGMENT.setPixelColorXY(j, k, fastled_col); SEGMENT.setPixelColor(i, fastled_col);
else SEGMENT.setPixelColor(i, fastled_col.red, fastled_col.green, fastled_col.blue);
} }
} else { } else {
fastled_col.nscale8(255 - fadeDownAmount); fastled_col.nscale8(255 - fadeDownAmount);
if (strip.isMatrix) SEGMENT.setPixelColorXY(j, k, fastled_col); SEGMENT.setPixelColor(i, fastled_col);
else SEGMENT.setPixelColor(i, fastled_col.red, fastled_col.green, fastled_col.blue);
} }
} }
for (int j = 0; j <= rows*cols / 50; j++) { for (uint16_t j = 0; j <= SEGLEN / 50; j++) {
if (random8() <= SEGMENT.intensity) { if (random8() <= SEGMENT.intensity) {
for (size_t times = 0; times < 5; times++) { //attempt to spawn a new pixel 5 times for (uint8_t times = 0; times < 5; times++) { //attempt to spawn a new pixel 5 times
uint16_t i = random16(rows*cols); int i = random16(SEGLEN);
uint16_t j = i % cols, k = i / cols; if (SEGMENT.getPixelColor(i) == 0) {
uint32_t col = strip.isMatrix ? SEGMENT.getPixelColorXY(j, k) : SEGMENT.getPixelColor(i); // TODO
if (col == 0) {
fastled_col = ColorFromPalette(SEGPALETTE, random8(), 64, NOBLEND); fastled_col = ColorFromPalette(SEGPALETTE, random8(), 64, NOBLEND);
uint16_t index = i >> 3; uint16_t index = i >> 3;
uint8_t bitNum = i & 0x07; uint8_t bitNum = i & 0x07;
bitWrite(SEGENV.data[index], bitNum, true); bitWrite(SEGENV.data[index], bitNum, true);
if (strip.isMatrix) SEGMENT.setPixelColorXY(j, k, fastled_col); SEGMENT.setPixelColor(i, fastled_col);
else SEGMENT.setPixelColor(i, fastled_col.red, fastled_col.green, fastled_col.blue);
break; //only spawn 1 new pixel per frame per 50 LEDs break; //only spawn 1 new pixel per frame per 50 LEDs
} }
} }
@ -2272,7 +2250,7 @@ uint16_t mode_colortwinkle()
} }
return FRAMETIME_FIXED; return FRAMETIME_FIXED;
} }
static const char _data_FX_MODE_COLORTWINKLE[] PROGMEM = "Colortwinkles@Fade speed,Spawn speed;1,2,3;!;1d,2d"; //pixels static const char _data_FX_MODE_COLORTWINKLE[] PROGMEM = "Colortwinkles@Fade speed,Spawn speed;1,2,3;!;mp12=0,1d"; //pixels
//Calm effect, like a lake at night //Calm effect, like a lake at night
@ -2651,13 +2629,13 @@ static const char _data_FX_MODE_TWINKLECAT[] PROGMEM = "Twinklecat";
//inspired by https://www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/#LEDStripEffectBlinkingHalloweenEyes //inspired by https://www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/#LEDStripEffectBlinkingHalloweenEyes
#define HALLOWEEN_EYE_SPACE (2*MAX(1,SEGLEN>>5))
#define HALLOWEEN_EYE_WIDTH MAX(1,SEGLEN>>5)
uint16_t mode_halloween_eyes() uint16_t mode_halloween_eyes()
{ {
const uint16_t maxWidth = strip.isMatrix ? SEGMENT.virtualWidth() : SEGLEN;
const uint16_t HALLOWEEN_EYE_SPACE = MAX(2, strip.isMatrix ? SEGMENT.virtualWidth()>>4: SEGLEN>>5);
const uint16_t HALLOWEEN_EYE_WIDTH = HALLOWEEN_EYE_SPACE/2;
uint16_t eyeLength = (2*HALLOWEEN_EYE_WIDTH) + HALLOWEEN_EYE_SPACE; uint16_t eyeLength = (2*HALLOWEEN_EYE_WIDTH) + HALLOWEEN_EYE_SPACE;
if (eyeLength > SEGLEN) return mode_static(); //bail if segment too short if (eyeLength >= maxWidth) return mode_static(); //bail if segment too short
SEGMENT.fill(SEGCOLOR(1)); //fill background SEGMENT.fill(SEGCOLOR(1)); //fill background
@ -2666,7 +2644,7 @@ uint16_t mode_halloween_eyes()
if (stateTime == 0) stateTime = 2000; if (stateTime == 0) stateTime = 2000;
if (state == 0) { //spawn eyes if (state == 0) { //spawn eyes
SEGENV.aux0 = random16(0, SEGLEN - eyeLength); //start pos SEGENV.aux0 = random16(0, maxWidth - eyeLength - 1); //start pos
SEGENV.aux1 = random8(); //color SEGENV.aux1 = random8(); //color
if (strip.isMatrix) SEGMENT.offset = random16(SEGMENT.virtualHeight()-1); // a hack: reuse offset since it is not used in matrices if (strip.isMatrix) SEGMENT.offset = random16(SEGMENT.virtualHeight()-1); // a hack: reuse offset since it is not used in matrices
state = 1; state = 1;
@ -2696,9 +2674,9 @@ uint16_t mode_halloween_eyes()
if (state > 2) state = 0; if (state > 2) state = 0;
if (state < 2) { if (state < 2) {
stateTime = 100 + (255 - SEGMENT.intensity)*10; //eye fade time stateTime = 100 + SEGMENT.intensity*10; //eye fade time
} else { } else {
uint16_t eyeOffTimeBase = (255 - SEGMENT.speed)*10; uint16_t eyeOffTimeBase = (256 - SEGMENT.speed)*10;
stateTime = eyeOffTimeBase + random16(eyeOffTimeBase); stateTime = eyeOffTimeBase + random16(eyeOffTimeBase);
} }
SEGENV.step = strip.now; SEGENV.step = strip.now;
@ -2818,43 +2796,47 @@ typedef struct Ball {
*/ */
uint16_t mode_bouncing_balls(void) { uint16_t mode_bouncing_balls(void) {
//allocate segment data //allocate segment data
uint16_t maxNumBalls = 16; const uint16_t strips = SEGMENT.nrOfVStrips(); // adapt for 2D
const size_t maxNumBalls = 16;
uint16_t dataSize = sizeof(ball) * maxNumBalls; uint16_t dataSize = sizeof(ball) * maxNumBalls;
if (!SEGENV.allocateData(dataSize)) return mode_static(); //allocation failed if (!SEGENV.allocateData(dataSize * strips)) return mode_static(); //allocation failed
Ball* balls = reinterpret_cast<Ball*>(SEGENV.data); Ball* balls = reinterpret_cast<Ball*>(SEGENV.data);
SEGMENT.fill(SEGCOLOR(2) ? BLACK : SEGCOLOR(1));
// virtualStrip idea by @ewowi (Ewoud Wijma)
struct virtualStrip {
static void runStrip(size_t stripNr, Ball* balls) {
// number of balls based on intensity setting to max of 7 (cycles colors) // number of balls based on intensity setting to max of 7 (cycles colors)
// non-chosen color is a random color // non-chosen color is a random color
uint16_t numBalls = int(((SEGMENT.intensity * (maxNumBalls - 0.8f)) / 255) + 1); uint16_t numBalls = (SEGMENT.intensity * (maxNumBalls - 1)) / 255 + 1; // minimum 1 ball
const float gravity = -9.81; // standard value of gravity
float gravity = -9.81; // standard value of gravity const bool hasCol2 = SEGCOLOR(2);
float impactVelocityStart = sqrt( -2 * gravity); const unsigned long time = millis();
unsigned long time = millis();
if (SEGENV.call == 0) { if (SEGENV.call == 0) {
for (size_t i = 0; i < maxNumBalls; i++) balls[i].lastBounceTime = time; for (size_t i = 0; i < maxNumBalls; i++) balls[i].lastBounceTime = time;
} }
bool hasCol2 = SEGCOLOR(2);
SEGMENT.fill(hasCol2 ? BLACK : SEGCOLOR(1));
for (size_t i = 0; i < numBalls; i++) { for (size_t i = 0; i < numBalls; i++) {
float timeSinceLastBounce = (time - balls[i].lastBounceTime)/((255-SEGMENT.speed)*8/256 +1); float timeSinceLastBounce = (time - balls[i].lastBounceTime)/((255-SEGMENT.speed)/64 +1);
float timeSec = timeSinceLastBounce/1000.0f; float timeSec = timeSinceLastBounce/1000.0f;
balls[i].height = 0.5 * gravity * (timeSec * timeSec) + balls[i].impactVelocity * timeSec; // avoid use pow(x, 2) - its extremely slow ! balls[i].height = (0.5f * gravity * timeSec + balls[i].impactVelocity) * timeSec; // avoid use pow(x, 2) - its extremely slow !
if (balls[i].height < 0) { //start bounce if (balls[i].height <= 0.0f) {
balls[i].height = 0; balls[i].height = 0.0f;
//damping for better effect using multiple balls //damping for better effect using multiple balls
float dampening = 0.90 - float(i)/float(numBalls * numBalls); // avoid use pow(x, 2) - its extremely slow ! float dampening = 0.9f - float(i)/float(numBalls * numBalls); // avoid use pow(x, 2) - its extremely slow !
balls[i].impactVelocity = dampening * balls[i].impactVelocity; balls[i].impactVelocity = dampening * balls[i].impactVelocity;
balls[i].lastBounceTime = time; balls[i].lastBounceTime = time;
if (balls[i].impactVelocity < 0.015) { if (balls[i].impactVelocity < 0.015f) {
float impactVelocityStart = sqrt(-2 * gravity) * random8(5,11)/10.0f; // randomize impact velocity
balls[i].impactVelocity = impactVelocityStart; balls[i].impactVelocity = impactVelocityStart;
} }
} else if (balls[i].height > 1.0f) {
continue; // do not draw OOB ball
} }
uint32_t color = SEGCOLOR(0); uint32_t color = SEGCOLOR(0);
@ -2864,13 +2846,19 @@ uint16_t mode_bouncing_balls(void) {
color = SEGCOLOR(i % NUM_COLORS); color = SEGCOLOR(i % NUM_COLORS);
} }
uint16_t pos = roundf(balls[i].height * (SEGLEN - 1)); int pos = roundf(balls[i].height * (SEGLEN - 1));
SEGMENT.setPixelColor(pos, color); SEGMENT.setPixelColor(pos | int((stripNr+1)<<16), color); // encode virtual strip into index
//SEGMENT.setPixelColor(balls[i].height + (stripNr+1)*10.0f, color);
} }
}
};
for (int stripNr=0; stripNr<strips; stripNr++)
virtualStrip::runStrip(stripNr, &balls[stripNr * maxNumBalls]);
return FRAMETIME; return FRAMETIME;
} }
static const char _data_FX_MODE_BOUNCINGBALLS[] PROGMEM = "Bouncing Balls@Gravity,# of balls;!,!,;!;mp12=2,1d"; //circle static const char _data_FX_MODE_BOUNCINGBALLS[] PROGMEM = "Bouncing Balls@Gravity,# of balls;!,!,!;!;mp12=1,1d"; //bar
/* /*
@ -2933,18 +2921,14 @@ uint16_t mode_glitter()
{ {
mode_palette(); mode_palette();
if (strip.isMatrix) { if (SEGMENT.intensity > random8())
uint16_t height = SEGMENT.virtualHeight(); {
uint16_t width = SEGMENT.virtualWidth(); SEGMENT.setPixelColor(random16(SEGLEN), ULTRAWHITE);
for (int i = 0; i<height; i++) {
if (SEGMENT.intensity > random8()) SEGMENT.setPixelColorXY(random16(width-1), i, ULTRAWHITE);
} }
} else
if (SEGMENT.intensity > random8()) SEGMENT.setPixelColor(random16(SEGLEN), ULTRAWHITE);
return FRAMETIME; return FRAMETIME;
} }
static const char _data_FX_MODE_GLITTER[] PROGMEM = "Glitter@,!;!,!,!;!;1d,2d"; //pixels static const char _data_FX_MODE_GLITTER[] PROGMEM = "Glitter@,!;!,!,!;!;mp12=0,1d"; //pixels
//each needs 19 bytes //each needs 19 bytes
@ -3770,18 +3754,14 @@ uint16_t mode_solid_glitter()
{ {
SEGMENT.fill(SEGCOLOR(0)); SEGMENT.fill(SEGCOLOR(0));
if (strip.isMatrix) { if (SEGMENT.intensity > random8())
uint16_t height = SEGMENT.virtualHeight(); {
uint16_t width = SEGMENT.virtualWidth(); SEGMENT.setPixelColor(random16(SEGLEN), ULTRAWHITE);
for (int i = 0; i<height; i++) {
if (SEGMENT.intensity > random8()) SEGMENT.setPixelColorXY(random16(width-1), i, ULTRAWHITE);
} }
} else
if (SEGMENT.intensity > random8()) SEGMENT.setPixelColor(random16(SEGLEN), ULTRAWHITE);
return FRAMETIME; return FRAMETIME;
} }
static const char _data_FX_MODE_SOLID_GLITTER[] PROGMEM = "Solid Glitter@,!;!,,;0;1d,2d"; static const char _data_FX_MODE_SOLID_GLITTER[] PROGMEM = "Solid Glitter@,!;!,,;0;mp12=0,1d";
/* /*
@ -3879,24 +3859,18 @@ static const char _data_FX_MODE_PHASEDNOISE[] PROGMEM = "Phased Noise";
uint16_t mode_twinkleup(void) { // A very short twinkle routine with fade-in and dual controls. By Andrew Tuline. uint16_t mode_twinkleup(void) { // A very short twinkle routine with fade-in and dual controls. By Andrew Tuline.
const uint16_t cols = strip.isMatrix ? SEGMENT.virtualWidth() : 1;
const uint16_t rows = strip.isMatrix ? SEGMENT.virtualHeight() : SEGMENT.virtualLength();
random16_set_seed(535); // The randomizer needs to be re-set each time through the loop in order for the same 'random' numbers to be the same each time through. random16_set_seed(535); // The randomizer needs to be re-set each time through the loop in order for the same 'random' numbers to be the same each time through.
for (int i = 0; i<rows*cols; i++) { for (int i = 0; i<SEGLEN; i++) {
uint16_t j = i % rows, k = i / rows;
uint8_t ranstart = random8(); // The starting value (aka brightness) for each pixel. Must be consistent each time through the loop for this to work. uint8_t ranstart = random8(); // The starting value (aka brightness) for each pixel. Must be consistent each time through the loop for this to work.
uint8_t pixBri = sin8(ranstart + 16 * strip.now/(256-SEGMENT.speed)); uint8_t pixBri = sin8(ranstart + 16 * strip.now/(256-SEGMENT.speed));
if (random8() > SEGMENT.intensity) pixBri = 0; if (random8() > SEGMENT.intensity) pixBri = 0;
uint32_t col = color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(random8() + strip.now/100, false, PALETTE_SOLID_WRAP, 0), pixBri); SEGMENT.setPixelColor(i, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(random8()+strip.now/100, false, PALETTE_SOLID_WRAP, 0), pixBri));
if (strip.isMatrix) SEGMENT.setPixelColorXY(j, k, col);
else SEGMENT.setPixelColor(i, col);
} }
return FRAMETIME; return FRAMETIME;
} }
static const char _data_FX_MODE_TWINKLEUP[] PROGMEM = "Twinkleup@!,Intensity;!,!,;!;1d,2d"; static const char _data_FX_MODE_TWINKLEUP[] PROGMEM = "Twinkleup@!,Intensity;!,!,;!;mp12=0,1d";
// Peaceful noise that's slow and with gradually changing palettes. Does not support WLED palettes or default colours or controls. // Peaceful noise that's slow and with gradually changing palettes. Does not support WLED palettes or default colours or controls.

View File

@ -339,9 +339,9 @@
typedef enum mapping1D2D { typedef enum mapping1D2D {
M12_Pixels = 0, M12_Pixels = 0,
M12_VerticalBar = 1, M12_pBar = 1,
M12_Circle = 2, M12_pArc = 2,
M12_Block = 3 M12_pCorner = 3
} mapping1D2D_t; } mapping1D2D_t;
// segment, 72 bytes // segment, 72 bytes
@ -551,7 +551,7 @@ typedef struct Segment {
void setPixelColor(float i, uint32_t c, bool aa = true); void setPixelColor(float i, uint32_t c, bool aa = true);
void setPixelColor(float i, uint8_t r, uint8_t g, uint8_t b, uint8_t w = 0, bool aa = true) { setPixelColor(i, RGBW32(r,g,b,w), aa); } void setPixelColor(float i, uint8_t r, uint8_t g, uint8_t b, uint8_t w = 0, bool aa = true) { setPixelColor(i, RGBW32(r,g,b,w), aa); }
void setPixelColor(float i, CRGB c, bool aa = true) { setPixelColor(i, RGBW32(c.r,c.g,c.b,0), aa); } void setPixelColor(float i, CRGB c, bool aa = true) { setPixelColor(i, RGBW32(c.r,c.g,c.b,0), aa); }
uint32_t getPixelColor(uint16_t i); uint32_t getPixelColor(int i);
// 1D support functions (some implement 2D as well) // 1D support functions (some implement 2D as well)
void blur(uint8_t); void blur(uint8_t);
void fill(uint32_t c); void fill(uint32_t c);
@ -570,6 +570,7 @@ typedef struct Segment {
// 2D matrix // 2D matrix
uint16_t virtualWidth(void) const; uint16_t virtualWidth(void) const;
uint16_t virtualHeight(void) const; uint16_t virtualHeight(void) const;
uint16_t nrOfVStrips(void) const;
#ifndef WLED_DISABLE_2D #ifndef WLED_DISABLE_2D
uint16_t XY(uint16_t x, uint16_t y); // support function to get relative index within segment (for leds[]) uint16_t XY(uint16_t x, uint16_t y); // support function to get relative index within segment (for leds[])
void setPixelColorXY(int x, int y, uint32_t c); // set relative pixel within segment with color void setPixelColorXY(int x, int y, uint32_t c); // set relative pixel within segment with color

View File

@ -196,9 +196,93 @@ void Segment::setUpLeds() {
#else #else
leds = &Segment::_globalLeds[start]; leds = &Segment::_globalLeds[start];
#endif #endif
else if (!leds) else if (!leds) {
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_PSRAM)
if (psramFound())
leds = (CRGB*)ps_malloc(sizeof(CRGB)*length());
else
#endif
leds = (CRGB*)malloc(sizeof(CRGB)*length()); leds = (CRGB*)malloc(sizeof(CRGB)*length());
} }
}
CRGBPalette16 &Segment::loadPalette(CRGBPalette16 &targetPalette, uint8_t pal) {
static unsigned long _lastPaletteChange = 0; // perhaps it should be per segment
byte tcp[72];
if (pal < 245 && pal > GRADIENT_PALETTE_COUNT+13) pal = 0;
if (pal > 245 && (strip.customPalettes.size() == 0 || 255U-pal > strip.customPalettes.size()-1)) pal = 0;
//default palette. Differs depending on effect
if (pal == 0) switch (mode) {
case FX_MODE_FIRE_2012 : pal = 35; break; // heat palette
case FX_MODE_COLORWAVES : pal = 26; break; // landscape 33
case FX_MODE_FILLNOISE8 : pal = 9; break; // ocean colors
case FX_MODE_NOISE16_1 : pal = 20; break; // Drywet
case FX_MODE_NOISE16_2 : pal = 43; break; // Blue cyan yellow
case FX_MODE_NOISE16_3 : pal = 35; break; // heat palette
case FX_MODE_NOISE16_4 : pal = 26; break; // landscape 33
case FX_MODE_GLITTER : pal = 11; break; // rainbow colors
case FX_MODE_SUNRISE : pal = 35; break; // heat palette
case FX_MODE_FLOW : pal = 6; break; // party
}
switch (pal) {
case 0: //default palette. Exceptions for specific effects above
targetPalette = PartyColors_p; break;
case 1: //periodically replace palette with a random one. Doesn't work with multiple FastLED segments
if (millis() - _lastPaletteChange > 5000 /*+ ((uint32_t)(255-intensity))*100*/) {
targetPalette = CRGBPalette16(
CHSV(random8(), 255, random8(128, 255)),
CHSV(random8(), 255, random8(128, 255)),
CHSV(random8(), 192, random8(128, 255)),
CHSV(random8(), 255, random8(128, 255)));
_lastPaletteChange = millis();
} break;
case 2: {//primary color only
CRGB prim = strip.gammaCorrectCol ? gamma32(colors[0]) : colors[0];
targetPalette = CRGBPalette16(prim); break;}
case 3: {//primary + secondary
CRGB prim = strip.gammaCorrectCol ? gamma32(colors[0]) : colors[0];
CRGB sec = strip.gammaCorrectCol ? gamma32(colors[1]) : colors[1];
targetPalette = CRGBPalette16(prim,prim,sec,sec); break;}
case 4: {//primary + secondary + tertiary
CRGB prim = strip.gammaCorrectCol ? gamma32(colors[0]) : colors[0];
CRGB sec = strip.gammaCorrectCol ? gamma32(colors[1]) : colors[1];
CRGB ter = strip.gammaCorrectCol ? gamma32(colors[2]) : colors[2];
targetPalette = CRGBPalette16(ter,sec,prim); break;}
case 5: {//primary + secondary (+tert if not off), more distinct
CRGB prim = strip.gammaCorrectCol ? gamma32(colors[0]) : colors[0];
CRGB sec = strip.gammaCorrectCol ? gamma32(colors[1]) : colors[1];
if (colors[2]) {
CRGB ter = strip.gammaCorrectCol ? gamma32(colors[2]) : colors[2];
targetPalette = CRGBPalette16(prim,prim,prim,prim,prim,sec,sec,sec,sec,sec,ter,ter,ter,ter,ter,prim);
} else {
targetPalette = CRGBPalette16(prim,prim,prim,prim,prim,prim,prim,prim,sec,sec,sec,sec,sec,sec,sec,sec);
}
break;}
case 6: //Party colors
targetPalette = PartyColors_p; break;
case 7: //Cloud colors
targetPalette = CloudColors_p; break;
case 8: //Lava colors
targetPalette = LavaColors_p; break;
case 9: //Ocean colors
targetPalette = OceanColors_p; break;
case 10: //Forest colors
targetPalette = ForestColors_p; break;
case 11: //Rainbow colors
targetPalette = RainbowColors_p; break;
case 12: //Rainbow stripe colors
targetPalette = RainbowStripeColors_p; break;
default: //progmem palettes
if (pal>245) {
targetPalette = strip.customPalettes[255-pal]; // we checked bounds above
} else {
memcpy_P(tcp, (byte*)pgm_read_dword(&(gGradientPalettes[pal-13])), 72);
targetPalette.loadDynamicGradientPalette(tcp);
}
break;
}
return targetPalette;
}
void Segment::startTransition(uint16_t dur) { void Segment::startTransition(uint16_t dur) {
if (transitional || _t) return; // already in transition no need to store anything if (transitional || _t) return; // already in transition no need to store anything
@ -251,84 +335,6 @@ uint32_t Segment::currentColor(uint8_t slot, uint32_t colorNew) {
return transitional && _t ? color_blend(_t->_colorT[slot], colorNew, progress(), true) : colorNew; return transitional && _t ? color_blend(_t->_colorT[slot], colorNew, progress(), true) : colorNew;
} }
CRGBPalette16 &Segment::loadPalette(CRGBPalette16 &targetPalette, uint8_t pal) {
static unsigned long _lastPaletteChange = 0; // perhaps it should be per segment
byte tcp[72];
if (pal < 245 && pal > GRADIENT_PALETTE_COUNT+13) pal = 0;
if (pal > 245 && (strip.customPalettes.size() == 0 || 255U-pal > strip.customPalettes.size()-1)) pal = 0;
//default palette. Differs depending on effect
if (pal == 0) switch (mode) {
case FX_MODE_FIRE_2012 : pal = 35; break; // heat palette
case FX_MODE_COLORWAVES : pal = 26; break; // landscape 33
case FX_MODE_FILLNOISE8 : pal = 9; break; // ocean colors
case FX_MODE_NOISE16_1 : pal = 20; break; // Drywet
case FX_MODE_NOISE16_2 : pal = 43; break; // Blue cyan yellow
case FX_MODE_NOISE16_3 : pal = 35; break; // heat palette
case FX_MODE_NOISE16_4 : pal = 26; break; // landscape 33
case FX_MODE_GLITTER : pal = 11; break; // rainbow colors
case FX_MODE_SUNRISE : pal = 35; break; // heat palette
case FX_MODE_FLOW : pal = 6; break; // party
}
switch (pal) {
case 0: //default palette. Exceptions for specific effects above
targetPalette = PartyColors_p; break;
case 1: {//periodically replace palette with a random one. Doesn't work with multiple FastLED segments
if (millis() - _lastPaletteChange > 1000 + ((uint32_t)(255-intensity))*100) {
targetPalette = CRGBPalette16(
CHSV(random8(), 255, random8(128, 255)),
CHSV(random8(), 255, random8(128, 255)),
CHSV(random8(), 192, random8(128, 255)),
CHSV(random8(), 255, random8(128, 255)));
_lastPaletteChange = millis();
} break;}
case 2: {//primary color only
CRGB prim = strip.gammaCorrectCol ? gamma32(colors[0]) : colors[0];
targetPalette = CRGBPalette16(prim); break;}
case 3: {//primary + secondary
CRGB prim = strip.gammaCorrectCol ? gamma32(colors[0]) : colors[0];
CRGB sec = strip.gammaCorrectCol ? gamma32(colors[1]) : colors[1];
targetPalette = CRGBPalette16(prim,prim,sec,sec); break;}
case 4: {//primary + secondary + tertiary
CRGB prim = strip.gammaCorrectCol ? gamma32(colors[0]) : colors[0];
CRGB sec = strip.gammaCorrectCol ? gamma32(colors[1]) : colors[1];
CRGB ter = strip.gammaCorrectCol ? gamma32(colors[2]) : colors[2];
targetPalette = CRGBPalette16(ter,sec,prim); break;}
case 5: {//primary + secondary (+tert if not off), more distinct
CRGB prim = strip.gammaCorrectCol ? gamma32(colors[0]) : colors[0];
CRGB sec = strip.gammaCorrectCol ? gamma32(colors[1]) : colors[1];
if (colors[2]) {
CRGB ter = strip.gammaCorrectCol ? gamma32(colors[2]) : colors[2];
targetPalette = CRGBPalette16(prim,prim,prim,prim,prim,sec,sec,sec,sec,sec,ter,ter,ter,ter,ter,prim);
} else {
targetPalette = CRGBPalette16(prim,prim,prim,prim,prim,prim,prim,prim,sec,sec,sec,sec,sec,sec,sec,sec);
}
break;}
case 6: //Party colors
targetPalette = PartyColors_p; break;
case 7: //Cloud colors
targetPalette = CloudColors_p; break;
case 8: //Lava colors
targetPalette = LavaColors_p; break;
case 9: //Ocean colors
targetPalette = OceanColors_p; break;
case 10: //Forest colors
targetPalette = ForestColors_p; break;
case 11: //Rainbow colors
targetPalette = RainbowColors_p; break;
case 12: //Rainbow stripe colors
targetPalette = RainbowStripeColors_p; break;
default: //progmem palettes
if (pal>245) {
targetPalette = strip.customPalettes[255-pal]; // we checked bounds above
} else {
memcpy_P(tcp, (byte*)pgm_read_dword(&(gGradientPalettes[pal-13])), 72);
targetPalette.loadDynamicGradientPalette(tcp);
}
break;
}
return targetPalette;
}
CRGBPalette16 &Segment::currentPalette(CRGBPalette16 &targetPalette, uint8_t pal) { CRGBPalette16 &Segment::currentPalette(CRGBPalette16 &targetPalette, uint8_t pal) {
loadPalette(targetPalette, pal); loadPalette(targetPalette, pal);
if (transitional && _t && progress() < 0xFFFFU) { if (transitional && _t && progress() < 0xFFFFU) {
@ -400,19 +406,33 @@ uint16_t Segment::virtualHeight() const {
return vHeight; return vHeight;
} }
uint16_t Segment::nrOfVStrips() const {
uint16_t vLen = 1;
#ifndef WLED_DISABLE_2D
if (is2D()) {
switch (map1D2D) {
case M12_pBar:
vLen = virtualWidth();
break;
}
}
#endif
return vLen;
}
// 1D strip // 1D strip
uint16_t Segment::virtualLength() const { uint16_t Segment::virtualLength() const {
#ifndef WLED_DISABLE_2D #ifndef WLED_DISABLE_2D
if (is2D()) { if (is2D()) {
uint16_t vW = virtualWidth(); uint16_t vW = virtualWidth();
uint16_t vH = virtualHeight(); uint16_t vH = virtualHeight();
uint32_t vLen = vW * vH; // use all pixels from segment uint16_t vLen = vW * vH; // use all pixels from segment
switch (map1D2D) { switch (map1D2D) {
case M12_VerticalBar: case M12_pBar:
vLen = vW; // segment width since it is used in getPixelColor() vLen = vH;
break; break;
case M12_Block: case M12_pCorner:
case M12_Circle: case M12_pArc:
vLen = max(vW,vH); // get the longest dimension vLen = max(vW,vH); // get the longest dimension
break; break;
} }
@ -427,6 +447,9 @@ uint16_t Segment::virtualLength() const {
void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col) void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
{ {
int vStrip = i>>16; // hack to allow running on virtual strips (2D segment columns/rows)
i &= 0xFFFF;
if (i >= virtualLength() || i<0) return; // if pixel would fall out of segment just exit if (i >= virtualLength() || i<0) return; // if pixel would fall out of segment just exit
#ifndef WLED_DISABLE_2D #ifndef WLED_DISABLE_2D
@ -438,16 +461,17 @@ void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
// use all available pixels as a long strip // use all available pixels as a long strip
setPixelColorXY(i % vW, i / vW, col); setPixelColorXY(i % vW, i / vW, col);
break; break;
case M12_VerticalBar: case M12_pBar:
// expand 1D effect vertically // expand 1D effect vertically or have it play on virtual strips
for (int y = 0; y < vH; y++) setPixelColorXY(i, y, col); if (vStrip>0) setPixelColorXY(vStrip - 1, vH - i - 1, col);
else for (int x = 0; x < vW; x++) setPixelColorXY(x, vH - i - 1, col);
break; break;
case M12_Circle: case M12_pArc:
// expand in circular fashion from center // expand in circular fashion from center
if (i==0) if (i==0)
setPixelColorXY(0, 0, col); setPixelColorXY(0, 0, col);
else { else {
float step = HALF_PI / (2*i); float step = HALF_PI / (2.85f*i);
for (float rad = 0.0f; rad <= HALF_PI+step/2; rad += step) { for (float rad = 0.0f; rad <= HALF_PI+step/2; rad += step) {
// may want to try float version as well (with or without antialiasing) // may want to try float version as well (with or without antialiasing)
int x = roundf(sin_t(rad) * i); int x = roundf(sin_t(rad) * i);
@ -456,13 +480,13 @@ void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
} }
} }
break; break;
case M12_Block: case M12_pCorner:
for (int x = 0; x <= i; x++) setPixelColorXY(x, i, col); for (int x = 0; x <= i; x++) setPixelColorXY(x, i, col);
for (int y = 0; y < i; y++) setPixelColorXY(i, y, col); for (int y = 0; y < i; y++) setPixelColorXY(i, y, col);
break; break;
} }
return; return;
} else if (width()==1 || height()==1) { } else if (strip.isMatrix && (width()==1 || height()==1)) { // TODO remove this hack
// we have a vertical or horizontal 1D segment (WARNING: virtual...() may be transposed) // we have a vertical or horizontal 1D segment (WARNING: virtual...() may be transposed)
int x = 0, y = 0; int x = 0, y = 0;
if (virtualHeight()>1) y = i; if (virtualHeight()>1) y = i;
@ -515,6 +539,9 @@ void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
// anti-aliased normalized version of setPixelColor() // anti-aliased normalized version of setPixelColor()
void Segment::setPixelColor(float i, uint32_t col, bool aa) void Segment::setPixelColor(float i, uint32_t col, bool aa)
{ {
int vStrip = int(i/10.0f); // hack to allow running on virtual strips (2D segment columns/rows)
i -= int(i);
if (i<0.0f || i>1.0f) return; // not normalized if (i<0.0f || i>1.0f) return; // not normalized
float fC = i * (virtualLength()-1); float fC = i * (virtualLength()-1);
@ -523,26 +550,29 @@ void Segment::setPixelColor(float i, uint32_t col, bool aa)
uint16_t iR = roundf(fC+0.49f); uint16_t iR = roundf(fC+0.49f);
float dL = fC - iL; float dL = fC - iL;
float dR = iR - fC; float dR = iR - fC;
uint32_t cIL = getPixelColor(iL); uint32_t cIL = getPixelColor(iL | (vStrip<<16));
uint32_t cIR = getPixelColor(iR); uint32_t cIR = getPixelColor(iR | (vStrip<<16));
if (iR!=iL) { if (iR!=iL) {
// blend L pixel // blend L pixel
cIL = color_blend(col, cIL, uint8_t(dL*255.0f)); cIL = color_blend(col, cIL, uint8_t(dL*255.0f));
setPixelColor(iL, cIL); setPixelColor(iL | (vStrip<<16), cIL);
// blend R pixel // blend R pixel
cIR = color_blend(col, cIR, uint8_t(dR*255.0f)); cIR = color_blend(col, cIR, uint8_t(dR*255.0f));
setPixelColor(iR, cIR); setPixelColor(iR | (vStrip<<16), cIR);
} else { } else {
// exact match (x & y land on a pixel) // exact match (x & y land on a pixel)
setPixelColor(iL, col); setPixelColor(iL | (vStrip<<16), col);
} }
} else { } else {
setPixelColor(uint16_t(roundf(fC)), col); setPixelColor(uint16_t(roundf(fC)) | (vStrip<<16), col);
} }
} }
uint32_t Segment::getPixelColor(uint16_t i) uint32_t Segment::getPixelColor(int i)
{ {
int vStrip = i>>16;
i &= 0xFFFF;
#ifndef WLED_DISABLE_2D #ifndef WLED_DISABLE_2D
if (is2D()) { // if this does not work use strip.isMatrix if (is2D()) { // if this does not work use strip.isMatrix
uint16_t vH = virtualHeight(); // segment height in logical pixels uint16_t vH = virtualHeight(); // segment height in logical pixels
@ -551,11 +581,12 @@ uint32_t Segment::getPixelColor(uint16_t i)
case M12_Pixels: case M12_Pixels:
return getPixelColorXY(i % vW, i / vW); return getPixelColorXY(i % vW, i / vW);
break; break;
case M12_VerticalBar: case M12_pBar:
return getPixelColorXY(i, 0); if (vStrip>0) return getPixelColorXY(vStrip - 1, vH - i -1);
else return getPixelColorXY(0, vH - i -1);
break; break;
case M12_Circle: case M12_pArc:
case M12_Block: case M12_pCorner:
// use longest dimension // use longest dimension
return vW>vH ? getPixelColorXY(i, 0) : getPixelColorXY(0, i); return vW>vH ? getPixelColorXY(i, 0) : getPixelColorXY(0, i);
break; break;
@ -1408,7 +1439,7 @@ void WS2812FX::setTransitionMode(bool t)
void WS2812FX::printSize() void WS2812FX::printSize()
{ {
size_t size = 0; size_t size = 0;
for (const Segment seg : _segments) size += seg.getSize(); for (const Segment &seg : _segments) size += seg.getSize();
DEBUG_PRINTF("Segments: %d -> %uB\n", _segments.size(), size); DEBUG_PRINTF("Segments: %d -> %uB\n", _segments.size(), size);
DEBUG_PRINTF("Modes: %d*%d=%uB\n", sizeof(mode_ptr), _mode.size(), (_mode.capacity()*sizeof(mode_ptr))); DEBUG_PRINTF("Modes: %d*%d=%uB\n", sizeof(mode_ptr), _mode.size(), (_mode.capacity()*sizeof(mode_ptr)));
DEBUG_PRINTF("Data: %d*%d=%uB\n", sizeof(const char *), _modeData.size(), (_modeData.capacity()*sizeof(const char *))); DEBUG_PRINTF("Data: %d*%d=%uB\n", sizeof(const char *), _modeData.size(), (_modeData.capacity()*sizeof(const char *)));

View File

@ -283,11 +283,13 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
JsonArray hw_if_spi = hw[F("if")][F("spi-pin")]; JsonArray hw_if_spi = hw[F("if")][F("spi-pin")];
CJSON(spi_mosi, hw_if_spi[0]); CJSON(spi_mosi, hw_if_spi[0]);
CJSON(spi_sclk, hw_if_spi[1]); CJSON(spi_sclk, hw_if_spi[1]);
PinManagerPinType spi[3] = { { spi_mosi, true }, { spi_sclk, true } }; CJSON(spi_miso, hw_if_spi[2]);
if (spi_mosi >= 0 && spi_sclk >= 0 && pinManager.allocateMultiplePins(spi, 2, PinOwner::HW_SPI)) { PinManagerPinType spi[3] = { { spi_mosi, true }, { spi_miso, true }, { spi_sclk, true } };
if (spi_mosi >= 0 && spi_sclk >= 0 && pinManager.allocateMultiplePins(spi, 3, PinOwner::HW_SPI)) {
// do not initialise bus here // do not initialise bus here
} else { } else {
spi_mosi = -1; spi_mosi = -1;
spi_miso = -1;
spi_sclk = -1; spi_sclk = -1;
} }
@ -746,6 +748,7 @@ void serializeConfig() {
JsonArray hw_if_spi = hw_if.createNestedArray("spi-pin"); JsonArray hw_if_spi = hw_if.createNestedArray("spi-pin");
hw_if_spi.add(spi_mosi); hw_if_spi.add(spi_mosi);
hw_if_spi.add(spi_sclk); hw_if_spi.add(spi_sclk);
hw_if_spi.add(spi_miso);
//JsonObject hw_status = hw.createNestedObject("status"); //JsonObject hw_status = hw.createNestedObject("status");
//hw_status["pin"] = -1; //hw_status["pin"] = -1;

View File

@ -384,6 +384,9 @@
#if defined(ESP8266) && defined(HW_PIN_DATASPI) #if defined(ESP8266) && defined(HW_PIN_DATASPI)
#undef HW_PIN_DATASPI #undef HW_PIN_DATASPI
#endif #endif
#if defined(ESP8266) && defined(HW_PIN_MISOSPI)
#undef HW_PIN_MISOSPI
#endif
#if defined(ESP8266) && defined(HW_PIN_CSSPI) #if defined(ESP8266) && defined(HW_PIN_CSSPI)
#undef HW_PIN_CSSPI #undef HW_PIN_CSSPI
#endif #endif
@ -394,6 +397,9 @@
#ifndef HW_PIN_DATASPI #ifndef HW_PIN_DATASPI
#define HW_PIN_DATASPI MOSI #define HW_PIN_DATASPI MOSI
#endif #endif
#ifndef HW_PIN_MISOSPI
#define HW_PIN_MISOSPI MISO
#endif
#ifndef HW_PIN_CSSPI #ifndef HW_PIN_CSSPI
#define HW_PIN_CSSPI SS #define HW_PIN_CSSPI SS
#endif #endif

View File

@ -1219,6 +1219,12 @@ TD .checkmark, TD .radiomark {
filter: grayscale(100%); filter: grayscale(100%);
} }
.lbl-l {
font-size: 13px;
text-align: center;
padding: 4px 0;
}
.lbl-s { .lbl-s {
display: inline-block; display: inline-block;
/* margin: 10px 4px 0 0; */ /* margin: 10px 4px 0 0; */

View File

@ -714,7 +714,7 @@ function populateSegments(s)
} }
let map2D = `<div id="seg${i}map2D" data-map="map2D" class="lbl-s hide">Expand 1D FX<br> let map2D = `<div id="seg${i}map2D" data-map="map2D" class="lbl-s hide">Expand 1D FX<br>
<div class="sel-p"><select class="sel-p" id="seg${i}mp12" onchange="setMp12(${i})"> <div class="sel-p"><select class="sel-p" id="seg${i}mp12" onchange="setMp12(${i})">
<option value="0" ${inst.mp12==0?' selected':''}>None</option> <option value="0" ${inst.mp12==0?' selected':''}>Strip</option>
<option value="1" ${inst.mp12==1?' selected':''}>Bar</option> <option value="1" ${inst.mp12==1?' selected':''}>Bar</option>
<option value="2" ${inst.mp12==2?' selected':''}>Arc</option> <option value="2" ${inst.mp12==2?' selected':''}>Arc</option>
<option value="3" ${inst.mp12==3?' selected':''}>Corner</option> <option value="3" ${inst.mp12==3?' selected':''}>Corner</option>
@ -774,7 +774,7 @@ function populateSegments(s)
${!isM?rvXck:''} ${!isM?rvXck:''}
${isM&&stoY-staY>1&&stoX-staX>1?map2D:''} ${isM&&stoY-staY>1&&stoX-staX>1?map2D:''}
${s.AudioReactive && s.AudioReactive.on ? "" : sndSim} ${s.AudioReactive && s.AudioReactive.on ? "" : sndSim}
<label class="check revchkl"> <label class="check revchkl" id="seg${i}lbtm">
${isM?'Transpose':'Mirror effect'} ${isM?'Transpose':'Mirror effect'}
<input type="checkbox" id="seg${i}${isM?'tp':'mi'}" onchange="${(isM?'setTp(':'setMi(')+i})" ${isM?(inst.tp?"checked":""):(inst.mi?"checked":"")}> <input type="checkbox" id="seg${i}${isM?'tp':'mi'}" onchange="${(isM?'setTp(':'setMi(')+i})" ${isM?(inst.tp?"checked":""):(inst.mi?"checked":"")}>
<span class="checkmark"></span> <span class="checkmark"></span>
@ -1035,19 +1035,27 @@ function updateLen(s)
var stop = parseInt(gId(`seg${s}e`).value); var stop = parseInt(gId(`seg${s}e`).value);
var len = stop - (cfg.comp.seglen?0:start); var len = stop - (cfg.comp.seglen?0:start);
if (isM) { if (isM) {
// matrix setup
let startY = parseInt(gId(`seg${s}sY`).value); let startY = parseInt(gId(`seg${s}sY`).value);
let stopY = parseInt(gId(`seg${s}eY`).value); let stopY = parseInt(gId(`seg${s}eY`).value);
len *= (stopY-(cfg.comp.seglen?0:startY)); len *= (stopY-(cfg.comp.seglen?0:startY));
let tPL = gId(`seg${s}lbtm`);
if (stop-start>1 && stopY-startY>1) { if (stop-start>1 && stopY-startY>1) {
// 2D segment
tPL.classList.remove("hide"); // unhide transpose checkbox
let sE = gId('fxlist').querySelector(`.lstI[data-id="${selectedFx}"]`); let sE = gId('fxlist').querySelector(`.lstI[data-id="${selectedFx}"]`);
if (sE) { if (sE) {
let sN = sE.querySelector(".lstIname").innerText; let sN = sE.querySelector(".lstIname").innerText;
let seg = gId(`seg${s}map2D`); let seg = gId(`seg${s}map2D`);
if (seg) { if (seg) {
if (sN.indexOf("\u25A6")<0) seg.classList.remove("hide"); if(sN.indexOf("\u25A6")<0) seg.classList.remove("hide"); // unhide mapping for 1D effects (| in name)
else seg.classList.add("hide"); else seg.classList.add("hide"); // hide mapping otherwise
} }
} }
} else {
// 1D segment in 2D set-up
tPL.classList.add("hide"); // hide transpose checkbox
gId(`seg${s}tp`).checked = false; // and uncheck it
} }
} }
var out = "(delete)"; var out = "(delete)";
@ -1806,9 +1814,9 @@ ${makePlSel(plJson[i].end?plJson[i].end:0, true)}
<span class="checkmark"></span> <span class="checkmark"></span>
</label>`; </label>`;
if (Array.isArray(lastinfo.maps) && lastinfo.maps.length>0) { if (Array.isArray(lastinfo.maps) && lastinfo.maps.length>0) {
content += `<div class="sel">Ledmap:&nbsp;<select class="sel-p" id="p${i}lmp"><option value="">None</option>`; content += `<div class="lbl-l">Ledmap:&nbsp;<div class="sel-p"><select class="sel-p" id="p${i}lmp"><option value="">None</option>`;
for (const k of (lastinfo.maps||[])) content += `<option value="${k}"${(i>0 && pJson[i].ledmap==k)?" selected":""}>${k}</option>`; for (const k of (lastinfo.maps||[])) content += `<option value="${k}"${(i>0 && pJson[i].ledmap==k)?" selected":""}>${k}</option>`;
content += "</select></div>"; content += "</select></div></div>";
} }
} }
@ -1824,13 +1832,8 @@ ${makePlSel(plJson[i].end?plJson[i].end:0, true)}
<span class="checkmark"></span> <span class="checkmark"></span>
</label> </label>
</div> </div>
<div class="po2" id="p${i}o2"> <div class="po2" id="p${i}o2">API command<br><textarea class="apitxt" id="p${i}api"></textarea></div>
API command<br> <div class="po1" id="p${i}o1">${content}</div>
<textarea class="apitxt" id="p${i}api"></textarea>
</div>
<div class="po1" id="p${i}o1">
${content}
</div>
<div class="c">Save to ID <input class="noslide" id="p${i}id" type="number" oninput="checkUsed(${i})" max=250 min=1 value=${(i>0)?i:getLowestUnusedP()}></div> <div class="c">Save to ID <input class="noslide" id="p${i}id" type="number" oninput="checkUsed(${i})" max=250 min=1 value=${(i>0)?i:getLowestUnusedP()}></div>
<div class="c"> <div class="c">
<button class="btn btn-p" onclick="saveP(${i},${pl})"><i class="icons btn-icon">&#xe390;</i>Save</button> <button class="btn btn-p" onclick="saveP(${i},${pl})"><i class="icons btn-icon">&#xe390;</i>Save</button>
@ -1846,6 +1849,10 @@ function makePUtil()
p.classList.remove('staybot'); p.classList.remove('staybot');
p.classList.add('pres'); p.classList.add('pres');
p.innerHTML = `<div class="presin expanded">${makeP(0)}</div>`; p.innerHTML = `<div class="presin expanded">${makeP(0)}</div>`;
let pTx = gId('p0txt');
pTx.focus();
pTx.value = eJson.find((o)=>{return o.id==selectedFx}).name;
pTx.select();
p.scrollIntoView({ p.scrollIntoView({
behavior: 'smooth', behavior: 'smooth',
block: 'center' block: 'center'
@ -1853,7 +1860,8 @@ function makePUtil()
gId('psFind').classList.remove('staytop'); gId('psFind').classList.remove('staytop');
} }
function makePlEntry(p,i) { function makePlEntry(p,i)
{
return `<div class="plentry"> return `<div class="plentry">
<div class="hrz"></div> <div class="hrz"></div>
<table> <table>
@ -1889,6 +1897,7 @@ function makePlUtil()
p.classList.remove('staybot'); p.classList.remove('staybot');
p.innerHTML = `<div class="pres"><div class="segin expanded" id="seg100">${makeP(0,true)}</div></div>`; p.innerHTML = `<div class="pres"><div class="segin expanded" id="seg100">${makeP(0,true)}</div></div>`;
refreshPlE(0); refreshPlE(0);
gId('p0txt').focus();
p.scrollIntoView({ p.scrollIntoView({
behavior: 'smooth', behavior: 'smooth',
block: 'center' block: 'center'
@ -1916,7 +1925,11 @@ function tglCs(i)
function tglSegn(s) function tglSegn(s)
{ {
let t = gId(s<100?`seg${s}t`:`p${s-100}txt`); let t = gId(s<100?`seg${s}t`:`p${s-100}txt`);
if (t) t.classList.toggle("show"); if (t) {
t.classList.toggle("show");
t.focus();
t.select();
}
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
} }
@ -1982,6 +1995,7 @@ function setSeg(s)
var stopY = parseInt(gId(`seg${s}eY`).value); var stopY = parseInt(gId(`seg${s}eY`).value);
obj.seg.startY = startY; obj.seg.startY = startY;
obj.seg.stopY = (cfg.comp.seglen?startY:0)+stopY; obj.seg.stopY = (cfg.comp.seglen?startY:0)+stopY;
obj.seg.tp = gId(`seg${s}tp`).checked;
} }
if (gId(`seg${s}grp`)) { if (gId(`seg${s}grp`)) {
var grp = parseInt(gId(`seg${s}grp`).value); var grp = parseInt(gId(`seg${s}grp`).value);

View File

@ -41,7 +41,7 @@ const char PAGE_dmxmap[] PROGMEM = R"=====()=====";
#endif #endif
// Autogenerated from wled00/data/update.htm, do not edit!! // Autogenerated from wled00/data/update.htm, do not edit!!
const uint16_t PAGE_update_length = 616; const uint16_t PAGE_update_length = 615;
const uint8_t PAGE_update[] PROGMEM = { const uint8_t PAGE_update[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x75, 0x53, 0x5d, 0x6f, 0xd4, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x75, 0x53, 0x5d, 0x6f, 0xd4, 0x30,
0x10, 0x7c, 0xcf, 0xaf, 0x70, 0xfd, 0x74, 0x27, 0x71, 0x4e, 0x41, 0xbc, 0x50, 0x92, 0x14, 0x8e, 0x10, 0x7c, 0xcf, 0xaf, 0x70, 0xfd, 0x74, 0x27, 0x71, 0x4e, 0x41, 0xbc, 0x50, 0x92, 0x14, 0x8e,
@ -66,22 +66,22 @@ const uint8_t PAGE_update[] PROGMEM = {
0xe9, 0xc1, 0x32, 0x20, 0xe5, 0x0e, 0x03, 0x99, 0xd2, 0x8f, 0x16, 0xcd, 0x20, 0x03, 0xe6, 0x53, 0xe9, 0xc1, 0x32, 0x20, 0xe5, 0x0e, 0x03, 0x99, 0xd2, 0x8f, 0x16, 0xcd, 0x20, 0x03, 0xe6, 0x53,
0xff, 0x8a, 0x60, 0x92, 0xd3, 0xcd, 0x71, 0xac, 0x7b, 0x43, 0x6e, 0x3e, 0x4c, 0x17, 0xdf, 0xb8, 0xff, 0x8a, 0x60, 0x92, 0xd3, 0xcd, 0x71, 0xac, 0x7b, 0x43, 0x6e, 0x3e, 0x4c, 0x17, 0xdf, 0xb8,
0x88, 0xd2, 0x5a, 0xd0, 0x6c, 0x07, 0x21, 0x12, 0xe3, 0x05, 0x2b, 0xe2, 0x20, 0x1d, 0xcb, 0x94, 0x88, 0xd2, 0x5a, 0xd0, 0x6c, 0x07, 0x21, 0x12, 0xe3, 0x05, 0x2b, 0xe2, 0x20, 0x1d, 0xcb, 0x94,
0x95, 0x31, 0x96, 0x3c, 0x9a, 0x81, 0x57, 0xe7, 0xe2, 0xe5, 0x6b, 0x71, 0xbe, 0xaa, 0xed, 0x39, 0x95, 0x31, 0x96, 0x3c, 0x9a, 0x81, 0x57, 0xe7, 0xe2, 0xe5, 0x6b, 0x71, 0xbe, 0xaa, 0xcf, 0x69,
0x6d, 0x43, 0x55, 0xda, 0x22, 0x54, 0x57, 0x7e, 0x9f, 0xb6, 0x60, 0xd8, 0x01, 0xb3, 0x34, 0x43, 0x19, 0x2a, 0xd2, 0x12, 0xa1, 0xba, 0xf2, 0xfb, 0xb4, 0x04, 0xc3, 0x0e, 0x98, 0xa5, 0x11, 0x22,
0x44, 0x56, 0x1b, 0x27, 0xc3, 0x81, 0x38, 0x24, 0xcb, 0xba, 0x00, 0x4d, 0xc9, 0x3b, 0xc4, 0x21, 0xb2, 0xda, 0x38, 0x19, 0x0e, 0x44, 0x21, 0x59, 0xd6, 0x05, 0x68, 0x4a, 0xde, 0x21, 0x0e, 0xf1,
0x5e, 0xe4, 0x79, 0x6b, 0xb0, 0x1b, 0x6b, 0xa1, 0x7c, 0x9f, 0xbf, 0x37, 0x41, 0x79, 0xef, 0xb7, 0x22, 0xcf, 0x5b, 0x83, 0xdd, 0x58, 0x0b, 0xe5, 0xfb, 0xfc, 0xbd, 0x09, 0xca, 0x7b, 0xbf, 0x35,
0x06, 0xf2, 0x69, 0xe5, 0x3c, 0x80, 0x05, 0x19, 0x21, 0x72, 0x86, 0x32, 0x90, 0x5f, 0x25, 0xff, 0x90, 0x4f, 0x1b, 0xe7, 0x01, 0x2c, 0xc8, 0x08, 0x91, 0x33, 0x94, 0x81, 0xec, 0x2a, 0xf9, 0xb7,
0x56, 0x5b, 0xe9, 0xb6, 0x24, 0x8b, 0xe9, 0x5b, 0x96, 0x25, 0x13, 0x4e, 0x3c, 0xf4, 0x45, 0xc4, 0xda, 0x4a, 0xb7, 0x25, 0x55, 0x4c, 0xdf, 0xb2, 0x2c, 0x79, 0x70, 0xe2, 0xa1, 0x2f, 0x22, 0x76,
0xce, 0x80, 0xd5, 0x51, 0x18, 0x7f, 0xa4, 0x3d, 0x51, 0xfc, 0x49, 0x2d, 0xe2, 0xae, 0xbd, 0x4c, 0x06, 0xac, 0x8e, 0xc2, 0xf8, 0x23, 0xed, 0x89, 0xe2, 0x4f, 0x6a, 0x11, 0x77, 0xed, 0x65, 0x52,
0xf2, 0x97, 0x0d, 0x4d, 0xb8, 0x8a, 0x8f, 0x23, 0x49, 0x3b, 0x85, 0x34, 0x97, 0x69, 0x87, 0xc2, 0xbf, 0x6c, 0x68, 0xc2, 0x55, 0x7c, 0x1c, 0x49, 0xd9, 0x29, 0xa3, 0xb9, 0x4c, 0x3b, 0x14, 0xc6,
0xb8, 0x61, 0x44, 0x36, 0xeb, 0xd5, 0x18, 0x0b, 0xa7, 0x40, 0x9f, 0x54, 0x0d, 0xf0, 0x38, 0x9a, 0x0d, 0x23, 0xb2, 0x59, 0xae, 0xc6, 0x58, 0x38, 0xe5, 0xf9, 0x24, 0x6a, 0x80, 0xc7, 0xd1, 0x04,
0x00, 0x7a, 0x46, 0xd7, 0x23, 0x22, 0x65, 0x72, 0x86, 0xcf, 0x3a, 0x12, 0xd9, 0xec, 0xd4, 0x59, 0xd0, 0x33, 0xba, 0x1e, 0x11, 0x29, 0x92, 0x33, 0x7c, 0x96, 0x91, 0xc8, 0x66, 0xa3, 0xce, 0x8a,
0x91, 0xcf, 0xe5, 0x7f, 0x40, 0xe7, 0xc3, 0x24, 0xbe, 0xb2, 0x46, 0x6d, 0x4b, 0xbe, 0x9e, 0xb4, 0x7c, 0x2e, 0xff, 0x03, 0x3a, 0x1f, 0x26, 0xed, 0x95, 0x35, 0x6a, 0x5b, 0xf2, 0xf5, 0x24, 0xfd,
0x5f, 0x53, 0xd4, 0x7f, 0x35, 0x25, 0x93, 0xaa, 0x42, 0x9b, 0x5d, 0x96, 0xbc, 0x9c, 0x82, 0x4a, 0x9a, 0x92, 0xfe, 0xab, 0x29, 0x79, 0x54, 0x15, 0xda, 0xec, 0xb2, 0x64, 0xe5, 0x94, 0x53, 0xa2,
0x34, 0x55, 0x62, 0xa7, 0xf4, 0x09, 0x21, 0x08, 0x9c, 0xc8, 0x37, 0x69, 0x59, 0xa6, 0x3d, 0x73, 0xa9, 0x12, 0x3b, 0x85, 0x4f, 0x08, 0x41, 0xe0, 0x44, 0xbe, 0x49, 0xcb, 0x32, 0xed, 0x99, 0xf3,
0x1e, 0x99, 0xb2, 0x9e, 0x0e, 0x3e, 0xd0, 0xac, 0x4d, 0x80, 0xd8, 0x25, 0x3f, 0x06, 0xd9, 0x02, 0xc8, 0x94, 0xf5, 0x74, 0xf0, 0x81, 0x66, 0x6d, 0x02, 0xc4, 0x2e, 0xf9, 0x31, 0xc8, 0x16, 0xd8,
0xbb, 0x58, 0x16, 0x39, 0xf1, 0x4d, 0xeb, 0x4e, 0xa9, 0x9b, 0x22, 0x38, 0xfd, 0xdb, 0x3f, 0x01, 0xc5, 0xb2, 0xc8, 0x89, 0x6f, 0x5a, 0x77, 0x0a, 0xdd, 0x94, 0xc0, 0xe9, 0xd7, 0xfe, 0x09, 0x43,
0xce, 0x0e, 0xa3, 0x73, 0xf1, 0x03, 0x00, 0x00 0x44, 0x4f, 0x48, 0xf0, 0x03, 0x00, 0x00
}; };

View File

@ -8,7 +8,7 @@
// Autogenerated from wled00/data/style.css, do not edit!! // Autogenerated from wled00/data/style.css, do not edit!!
const uint16_t PAGE_settingsCss_length = 824; const uint16_t PAGE_settingsCss_length = 824;
const uint8_t PAGE_settingsCss[] PROGMEM = { const uint8_t PAGE_settingsCss[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xad, 0x55, 0x5d, 0x8b, 0x9c, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xad, 0x55, 0x5d, 0x8b, 0x9c, 0x30,
0x14, 0xfd, 0x2b, 0x96, 0x61, 0x61, 0x0b, 0xa3, 0xa8, 0xa3, 0xb3, 0xd3, 0x48, 0xa1, 0xf4, 0xbd, 0x14, 0xfd, 0x2b, 0x96, 0x61, 0x61, 0x0b, 0xa3, 0xa8, 0xa3, 0xb3, 0xd3, 0x48, 0xa1, 0xf4, 0xbd,
0x6f, 0xa5, 0x14, 0xca, 0x3e, 0x44, 0x73, 0x1d, 0xc3, 0xe4, 0x43, 0x92, 0xd8, 0x75, 0x2a, 0xfe, 0x6f, 0xa5, 0x14, 0xca, 0x3e, 0x44, 0x73, 0x1d, 0xc3, 0xe4, 0x43, 0x92, 0xd8, 0x75, 0x2a, 0xfe,
0xf7, 0x26, 0x7e, 0xac, 0xce, 0xac, 0x6c, 0x5f, 0xca, 0xe0, 0xa0, 0xde, 0x98, 0x7b, 0xee, 0xb9, 0xf7, 0x26, 0x7e, 0xac, 0xce, 0xac, 0x6c, 0x5f, 0xca, 0xe0, 0xa0, 0xde, 0x98, 0x7b, 0xee, 0xb9,
@ -66,7 +66,7 @@ const uint8_t PAGE_settingsCss[] PROGMEM = {
// Autogenerated from wled00/data/settings.htm, do not edit!! // Autogenerated from wled00/data/settings.htm, do not edit!!
const uint16_t PAGE_settings_length = 985; const uint16_t PAGE_settings_length = 985;
const uint8_t PAGE_settings[] PROGMEM = { const uint8_t PAGE_settings[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xad, 0x56, 0x6d, 0x6f, 0xdb, 0x36, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xad, 0x56, 0x6d, 0x6f, 0xdb, 0x36,
0x10, 0xfe, 0xee, 0x5f, 0xc1, 0xb0, 0x58, 0x23, 0xa1, 0xb2, 0xec, 0x38, 0xc3, 0xb0, 0xc9, 0x96, 0x10, 0xfe, 0xee, 0x5f, 0xc1, 0xb0, 0x58, 0x23, 0xa1, 0xb2, 0xec, 0x38, 0xc3, 0xb0, 0xc9, 0x96,
0x8b, 0x35, 0x2f, 0x9d, 0x87, 0x04, 0x0d, 0x90, 0xa4, 0xdd, 0x80, 0x7d, 0xa1, 0xc9, 0x93, 0xcc, 0x8b, 0x35, 0x2f, 0x9d, 0x87, 0x04, 0x0d, 0x90, 0xa4, 0xdd, 0x80, 0x7d, 0xa1, 0xc9, 0x93, 0xcc,
0x46, 0x22, 0x05, 0xf2, 0xe4, 0xc4, 0x73, 0xf3, 0xdf, 0x77, 0x94, 0x9d, 0xb7, 0x36, 0xd8, 0x8a, 0x46, 0x22, 0x05, 0xf2, 0xe4, 0xc4, 0x73, 0xf3, 0xdf, 0x77, 0x94, 0x9d, 0xb7, 0x36, 0xd8, 0x8a,
@ -134,7 +134,7 @@ const uint8_t PAGE_settings[] PROGMEM = {
// Autogenerated from wled00/data/settings_wifi.htm, do not edit!! // Autogenerated from wled00/data/settings_wifi.htm, do not edit!!
const uint16_t PAGE_settings_wifi_length = 1557; const uint16_t PAGE_settings_wifi_length = 1557;
const uint8_t PAGE_settings_wifi[] PROGMEM = { const uint8_t PAGE_settings_wifi[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xad, 0x57, 0xff, 0x4f, 0xdb, 0x38, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xad, 0x57, 0xff, 0x4f, 0xdb, 0x38,
0x14, 0xff, 0x3d, 0x7f, 0x85, 0xf1, 0x49, 0x53, 0xa3, 0x85, 0x94, 0xb6, 0xc7, 0x6e, 0x62, 0x49, 0x14, 0xff, 0x3d, 0x7f, 0x85, 0xf1, 0x49, 0x53, 0xa3, 0x85, 0x94, 0xb6, 0xc7, 0x6e, 0x62, 0x49,
0x76, 0x5d, 0xdb, 0x0d, 0xee, 0x18, 0xeb, 0x29, 0x68, 0xe8, 0xa4, 0x93, 0x26, 0x37, 0x79, 0x6d, 0x76, 0x5d, 0xdb, 0x0d, 0xee, 0x18, 0xeb, 0x29, 0x68, 0xe8, 0xa4, 0x93, 0x26, 0x37, 0x79, 0x6d,
0x3d, 0x9c, 0x38, 0x17, 0x3b, 0x2d, 0x88, 0xf1, 0xbf, 0xdf, 0xb3, 0x93, 0x96, 0x16, 0xe8, 0x36, 0x3d, 0x9c, 0x38, 0x17, 0x3b, 0x2d, 0x88, 0xf1, 0xbf, 0xdf, 0xb3, 0x93, 0x96, 0x16, 0xe8, 0x36,
@ -238,7 +238,7 @@ const uint8_t PAGE_settings_wifi[] PROGMEM = {
// Autogenerated from wled00/data/settings_leds.htm, do not edit!! // Autogenerated from wled00/data/settings_leds.htm, do not edit!!
const uint16_t PAGE_settings_leds_length = 7357; const uint16_t PAGE_settings_leds_length = 7357;
const uint8_t PAGE_settings_leds[] PROGMEM = { const uint8_t PAGE_settings_leds[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xdd, 0x3c, 0xed, 0x76, 0xe2, 0xc6, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xdd, 0x3c, 0xed, 0x76, 0xe2, 0xc6,
0x92, 0xff, 0x79, 0x8a, 0x76, 0x27, 0x71, 0xa4, 0x8b, 0x0c, 0x12, 0x1f, 0x8e, 0x07, 0x10, 0xac, 0x92, 0xff, 0x79, 0x8a, 0x76, 0x27, 0x71, 0xa4, 0x8b, 0x0c, 0x12, 0x1f, 0x8e, 0x07, 0x10, 0xac,
0xb1, 0x3d, 0x13, 0xdf, 0x6b, 0xc7, 0x3e, 0xc6, 0xc9, 0xdc, 0x3d, 0x93, 0x39, 0x19, 0x21, 0x1a, 0xb1, 0x3d, 0x13, 0xdf, 0x6b, 0xc7, 0x3e, 0xc6, 0xc9, 0xdc, 0x3d, 0x93, 0x39, 0x19, 0x21, 0x1a,
0xd0, 0x58, 0x48, 0xba, 0x92, 0xb0, 0x87, 0xb5, 0xd9, 0x67, 0xda, 0x67, 0xd8, 0x27, 0xdb, 0xaa, 0xd0, 0x58, 0x48, 0xba, 0x92, 0xb0, 0x87, 0xb5, 0xd9, 0x67, 0xda, 0x67, 0xd8, 0x27, 0xdb, 0xaa,
@ -704,7 +704,7 @@ const uint8_t PAGE_settings_leds[] PROGMEM = {
// Autogenerated from wled00/data/settings_dmx.htm, do not edit!! // Autogenerated from wled00/data/settings_dmx.htm, do not edit!!
const uint16_t PAGE_settings_dmx_length = 1612; const uint16_t PAGE_settings_dmx_length = 1612;
const uint8_t PAGE_settings_dmx[] PROGMEM = { const uint8_t PAGE_settings_dmx[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0x95, 0x57, 0xdb, 0x72, 0xdb, 0x36, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x95, 0x57, 0xdb, 0x72, 0xdb, 0x36,
0x10, 0x7d, 0xd7, 0x57, 0x20, 0x78, 0x88, 0xc9, 0x31, 0x43, 0x4a, 0x4e, 0x95, 0x36, 0x32, 0x49, 0x10, 0x7d, 0xd7, 0x57, 0x20, 0x78, 0x88, 0xc9, 0x31, 0x43, 0x4a, 0x4e, 0x95, 0x36, 0x32, 0x49,
0x37, 0x56, 0x5c, 0xdb, 0x1d, 0xdb, 0xf5, 0x44, 0x49, 0xd3, 0x4e, 0xd3, 0xe9, 0x40, 0xe4, 0x4a, 0x37, 0x56, 0x5c, 0xdb, 0x1d, 0xdb, 0xf5, 0x44, 0x49, 0xd3, 0x4e, 0xd3, 0xe9, 0x40, 0xe4, 0x4a,
0x44, 0x4c, 0x02, 0x2c, 0x00, 0x4a, 0x76, 0x2e, 0xff, 0xde, 0x05, 0x48, 0x5d, 0xec, 0xd8, 0x69, 0x44, 0x4c, 0x02, 0x2c, 0x00, 0x4a, 0x76, 0x2e, 0xff, 0xde, 0x05, 0x48, 0x5d, 0xec, 0xd8, 0x69,
@ -811,7 +811,7 @@ const uint8_t PAGE_settings_dmx[] PROGMEM = {
// Autogenerated from wled00/data/settings_ui.htm, do not edit!! // Autogenerated from wled00/data/settings_ui.htm, do not edit!!
const uint16_t PAGE_settings_ui_length = 3090; const uint16_t PAGE_settings_ui_length = 3090;
const uint8_t PAGE_settings_ui[] PROGMEM = { const uint8_t PAGE_settings_ui[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xad, 0x59, 0x6b, 0x73, 0xda, 0x48, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xad, 0x59, 0x6b, 0x73, 0xda, 0x48,
0x16, 0xfd, 0xce, 0xaf, 0xe8, 0x74, 0x52, 0x1e, 0x54, 0x56, 0x04, 0x4e, 0x66, 0x6b, 0x13, 0x40, 0x16, 0xfd, 0xce, 0xaf, 0xe8, 0x74, 0x52, 0x1e, 0x54, 0x56, 0x04, 0x4e, 0x66, 0x6b, 0x13, 0x40,
0x78, 0x63, 0xc7, 0x93, 0x78, 0xca, 0xd9, 0x64, 0x83, 0xbd, 0x99, 0xad, 0xac, 0xcb, 0x23, 0xa4, 0x78, 0x63, 0xc7, 0x93, 0x78, 0xca, 0xd9, 0x64, 0x83, 0xbd, 0x99, 0xad, 0xac, 0xcb, 0x23, 0xa4,
0x06, 0x3a, 0x16, 0x92, 0x46, 0xdd, 0x32, 0x66, 0x09, 0xff, 0x7d, 0xcf, 0xed, 0x96, 0x40, 0x60, 0x06, 0x3a, 0x16, 0x92, 0x46, 0xdd, 0x32, 0x66, 0x09, 0xff, 0x7d, 0xcf, 0xed, 0x96, 0x40, 0x60,
@ -1011,7 +1011,7 @@ const uint8_t PAGE_settings_ui[] PROGMEM = {
// Autogenerated from wled00/data/settings_sync.htm, do not edit!! // Autogenerated from wled00/data/settings_sync.htm, do not edit!!
const uint16_t PAGE_settings_sync_length = 3153; const uint16_t PAGE_settings_sync_length = 3153;
const uint8_t PAGE_settings_sync[] PROGMEM = { const uint8_t PAGE_settings_sync[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0x9d, 0x5a, 0x6d, 0x77, 0xda, 0xb8, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x9d, 0x5a, 0x6d, 0x77, 0xda, 0xb8,
0x12, 0xfe, 0xee, 0x5f, 0xa1, 0xf8, 0xc3, 0x2e, 0x6c, 0x08, 0x18, 0x12, 0xd2, 0x94, 0x62, 0xf7, 0x12, 0xfe, 0xee, 0x5f, 0xa1, 0xf8, 0xc3, 0x2e, 0x6c, 0x08, 0x18, 0x12, 0xd2, 0x94, 0x62, 0xf7,
0x86, 0x90, 0x26, 0xec, 0x36, 0x0d, 0x85, 0x64, 0x5f, 0xce, 0xb9, 0xe7, 0xec, 0x11, 0xb6, 0x00, 0x86, 0x90, 0x26, 0xec, 0x36, 0x0d, 0x85, 0x64, 0x5f, 0xce, 0xb9, 0xe7, 0xec, 0x11, 0xb6, 0x00,
0x25, 0xb6, 0xe5, 0xb5, 0xe5, 0xbc, 0x9c, 0x6e, 0xff, 0xfb, 0x9d, 0x91, 0x6c, 0x03, 0x06, 0x02, 0x25, 0xb6, 0xe5, 0xb5, 0xe5, 0xbc, 0x9c, 0x6e, 0xff, 0xfb, 0x9d, 0x91, 0x6c, 0x03, 0x06, 0x02,
@ -1215,7 +1215,7 @@ const uint8_t PAGE_settings_sync[] PROGMEM = {
// Autogenerated from wled00/data/settings_time.htm, do not edit!! // Autogenerated from wled00/data/settings_time.htm, do not edit!!
const uint16_t PAGE_settings_time_length = 3302; const uint16_t PAGE_settings_time_length = 3302;
const uint8_t PAGE_settings_time[] PROGMEM = { const uint8_t PAGE_settings_time[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xd5, 0x1a, 0x6b, 0x57, 0xdb, 0x3a, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xd5, 0x1a, 0x6b, 0x57, 0xdb, 0x3a,
0xf2, 0x7b, 0x7e, 0x85, 0x50, 0x7b, 0xb8, 0xf1, 0xc5, 0x79, 0x42, 0x5a, 0x48, 0x62, 0x77, 0x43, 0xf2, 0x7b, 0x7e, 0x85, 0x50, 0x7b, 0xb8, 0xf1, 0xc5, 0x79, 0x42, 0x5a, 0x48, 0x62, 0x77, 0x43,
0x48, 0x0b, 0x2d, 0x09, 0x9c, 0x26, 0xbd, 0xec, 0xf6, 0x71, 0x6e, 0x15, 0x5b, 0x49, 0x0c, 0x8e, 0x48, 0x0b, 0x2d, 0x09, 0x9c, 0x26, 0xbd, 0xec, 0xf6, 0x71, 0x6e, 0x15, 0x5b, 0x49, 0x0c, 0x8e,
0xe4, 0xb5, 0x65, 0x02, 0x4b, 0xf9, 0xef, 0x3b, 0x92, 0x1c, 0xe7, 0x85, 0x81, 0xf6, 0xde, 0xfd, 0xe4, 0xb5, 0x65, 0x02, 0x4b, 0xf9, 0xef, 0x3b, 0x92, 0x1c, 0xe7, 0x85, 0x81, 0xf6, 0xde, 0xfd,
@ -1428,7 +1428,7 @@ const uint8_t PAGE_settings_time[] PROGMEM = {
// Autogenerated from wled00/data/settings_sec.htm, do not edit!! // Autogenerated from wled00/data/settings_sec.htm, do not edit!!
const uint16_t PAGE_settings_sec_length = 2405; const uint16_t PAGE_settings_sec_length = 2405;
const uint8_t PAGE_settings_sec[] PROGMEM = { const uint8_t PAGE_settings_sec[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xa5, 0x58, 0x6d, 0x53, 0xdb, 0x48, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xa5, 0x58, 0x6d, 0x53, 0xdb, 0x48,
0x12, 0xfe, 0xee, 0x5f, 0x31, 0x4c, 0xaa, 0x58, 0xeb, 0x22, 0x2c, 0x43, 0x72, 0x5b, 0x09, 0x20, 0x12, 0xfe, 0xee, 0x5f, 0x31, 0x4c, 0xaa, 0x58, 0xeb, 0x22, 0x2c, 0x43, 0x72, 0x5b, 0x09, 0x20,
0xe7, 0x20, 0x90, 0x0d, 0x57, 0x10, 0x28, 0x6c, 0x36, 0x77, 0x95, 0x4b, 0xa5, 0xc6, 0xd2, 0xd8, 0xe7, 0x20, 0x90, 0x0d, 0x57, 0x10, 0x28, 0x6c, 0x36, 0x77, 0x95, 0x4b, 0xa5, 0xc6, 0xd2, 0xd8,
0x9a, 0x58, 0xd6, 0x68, 0x67, 0x46, 0x38, 0xbe, 0xec, 0xfe, 0xf7, 0x7b, 0x7a, 0x24, 0xd9, 0x86, 0x9a, 0x58, 0xd6, 0x68, 0x67, 0x46, 0x38, 0xbe, 0xec, 0xfe, 0xf7, 0x7b, 0x7a, 0x24, 0xd9, 0x86,
@ -1585,7 +1585,7 @@ const uint8_t PAGE_settings_sec[] PROGMEM = {
// Autogenerated from wled00/data/settings_um.htm, do not edit!! // Autogenerated from wled00/data/settings_um.htm, do not edit!!
const uint16_t PAGE_settings_um_length = 2514; const uint16_t PAGE_settings_um_length = 2514;
const uint8_t PAGE_settings_um[] PROGMEM = { const uint8_t PAGE_settings_um[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xdd, 0x58, 0xdb, 0x72, 0xdb, 0x38, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xdd, 0x58, 0xdb, 0x72, 0xdb, 0x38,
0x12, 0x7d, 0xd7, 0x57, 0xd0, 0x88, 0xcb, 0x26, 0x4b, 0x34, 0x25, 0xc7, 0x3b, 0xb3, 0x89, 0x24, 0x12, 0x7d, 0xd7, 0x57, 0xd0, 0x88, 0xcb, 0x26, 0x4b, 0x34, 0x25, 0xc7, 0x3b, 0xb3, 0x89, 0x24,
0xc8, 0x93, 0x38, 0xc9, 0x44, 0x9b, 0x8b, 0x5d, 0xa5, 0xb9, 0xd4, 0x96, 0xd7, 0x35, 0xa6, 0x44, 0xc8, 0x93, 0x38, 0xc9, 0x44, 0x9b, 0x8b, 0x5d, 0xa5, 0xb9, 0xd4, 0x96, 0xd7, 0x35, 0xa6, 0x44,
0x48, 0x42, 0x4c, 0x81, 0x5c, 0x00, 0xf4, 0x65, 0x65, 0xfd, 0xfb, 0x9e, 0x06, 0x49, 0x5d, 0x1c, 0x48, 0x42, 0x4c, 0x81, 0x5c, 0x00, 0xf4, 0x65, 0x65, 0xfd, 0xfb, 0x9e, 0x06, 0x49, 0x5d, 0x1c,
@ -1749,7 +1749,7 @@ const uint8_t PAGE_settings_um[] PROGMEM = {
// Autogenerated from wled00/data/settings_2D.htm, do not edit!! // Autogenerated from wled00/data/settings_2D.htm, do not edit!!
const uint16_t PAGE_settings_2D_length = 1754; const uint16_t PAGE_settings_2D_length = 1754;
const uint8_t PAGE_settings_2D[] PROGMEM = { const uint8_t PAGE_settings_2D[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0x8d, 0x58, 0x6d, 0x73, 0xdb, 0x36, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x8d, 0x58, 0x6d, 0x73, 0xdb, 0x36,
0x12, 0xfe, 0xce, 0x5f, 0x01, 0x63, 0x3a, 0x2d, 0xd9, 0x50, 0x94, 0xe4, 0xde, 0x75, 0x3a, 0x16, 0x12, 0xfe, 0xce, 0x5f, 0x01, 0x63, 0x3a, 0x2d, 0xd9, 0x50, 0x94, 0xe4, 0xde, 0x75, 0x3a, 0x16,
0x49, 0x37, 0x6e, 0xdc, 0xda, 0x1d, 0x7b, 0xe2, 0x89, 0x72, 0xce, 0xdc, 0x5c, 0x3a, 0x29, 0x44, 0x49, 0x37, 0x6e, 0xdc, 0xda, 0x1d, 0x7b, 0xe2, 0x89, 0x72, 0xce, 0xdc, 0x5c, 0x3a, 0x29, 0x44,
0xae, 0x44, 0xc4, 0x24, 0xc0, 0x01, 0x20, 0xd9, 0xae, 0xe2, 0xff, 0x7e, 0x0b, 0x90, 0x12, 0x25, 0xae, 0x44, 0xc4, 0x24, 0xc0, 0x01, 0x20, 0xd9, 0xae, 0xe2, 0xff, 0x7e, 0x0b, 0x90, 0x12, 0x25,
@ -1865,7 +1865,7 @@ const uint8_t PAGE_settings_2D[] PROGMEM = {
// Autogenerated from wled00/data/settings_pin.htm, do not edit!! // Autogenerated from wled00/data/settings_pin.htm, do not edit!!
const uint16_t PAGE_settings_pin_length = 471; const uint16_t PAGE_settings_pin_length = 471;
const uint8_t PAGE_settings_pin[] PROGMEM = { const uint8_t PAGE_settings_pin[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0x5d, 0x52, 0x4d, 0x6f, 0x13, 0x31, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x5d, 0x52, 0x4d, 0x6f, 0x13, 0x31,
0x10, 0xbd, 0xef, 0xaf, 0x30, 0x73, 0x69, 0x82, 0x92, 0x6c, 0xa8, 0xa8, 0x04, 0xaa, 0xbd, 0x42, 0x10, 0xbd, 0xef, 0xaf, 0x30, 0x73, 0x69, 0x82, 0x92, 0x6c, 0xa8, 0xa8, 0x04, 0xaa, 0xbd, 0x42,
0x81, 0x1e, 0xb8, 0x94, 0x48, 0xe5, 0x52, 0x55, 0x55, 0xe5, 0xd8, 0xb3, 0x89, 0x55, 0x7f, 0x2c, 0x81, 0x1e, 0xb8, 0x94, 0x48, 0xe5, 0x52, 0x55, 0x55, 0xe5, 0xd8, 0xb3, 0x89, 0x55, 0x7f, 0x2c,
0xb6, 0x37, 0x21, 0x54, 0xfc, 0x77, 0xc6, 0xbb, 0xa1, 0xa0, 0x5c, 0xd6, 0x7e, 0x33, 0xe3, 0x37, 0xb6, 0x37, 0x21, 0x54, 0xfc, 0x77, 0xc6, 0xbb, 0xa1, 0xa0, 0x5c, 0xd6, 0x7e, 0x33, 0xe3, 0x37,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -502,23 +502,27 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
i2c_scl = -1; i2c_scl = -1;
} }
int8_t hw_mosi_pin = !request->arg(F("MOSI")).length() ? -1 : max(-1,min(33,(int)request->arg(F("MOSI")).toInt())); int8_t hw_mosi_pin = !request->arg(F("MOSI")).length() ? -1 : max(-1,min(33,(int)request->arg(F("MOSI")).toInt()));
int8_t hw_miso_pin = !request->arg(F("MISO")).length() ? -1 : max(-1,min(33,(int)request->arg(F("MISO")).toInt()));
int8_t hw_sclk_pin = !request->arg(F("SCLK")).length() ? -1 : max(-1,min(33,(int)request->arg(F("SCLK")).toInt())); int8_t hw_sclk_pin = !request->arg(F("SCLK")).length() ? -1 : max(-1,min(33,(int)request->arg(F("SCLK")).toInt()));
#ifdef ESP8266 #ifdef ESP8266
// cannot change pins on ESP8266 // cannot change pins on ESP8266
if (hw_mosi_pin >= 0 && hw_mosi_pin != HW_PIN_DATASPI) hw_mosi_pin = HW_PIN_DATASPI; if (hw_mosi_pin >= 0 && hw_mosi_pin != HW_PIN_DATASPI) hw_mosi_pin = HW_PIN_DATASPI;
if (hw_miso_pin >= 0 && hw_miso_pin != HW_PIN_MISOSPI) hw_mosi_pin = HW_PIN_MISOSPI;
if (hw_sclk_pin >= 0 && hw_sclk_pin != HW_PIN_CLOCKSPI) hw_sclk_pin = HW_PIN_CLOCKSPI; if (hw_sclk_pin >= 0 && hw_sclk_pin != HW_PIN_CLOCKSPI) hw_sclk_pin = HW_PIN_CLOCKSPI;
#endif #endif
PinManagerPinType spi[2] = { { hw_mosi_pin, true }, { hw_sclk_pin, true } }; PinManagerPinType spi[3] = { { hw_mosi_pin, true }, { hw_miso_pin, true }, { hw_sclk_pin, true } };
if (hw_mosi_pin >= 0 && hw_sclk_pin >= 0 && pinManager.allocateMultiplePins(spi, 2, PinOwner::HW_SPI)) { if (hw_mosi_pin >= 0 && hw_sclk_pin >= 0 && pinManager.allocateMultiplePins(spi, 3, PinOwner::HW_SPI)) {
spi_mosi = hw_mosi_pin; spi_mosi = hw_mosi_pin;
spi_miso = hw_miso_pin;
spi_sclk = hw_sclk_pin; spi_sclk = hw_sclk_pin;
// no bus initialisation // no bus initialisation
} else { } else {
//SPI.end(); //SPI.end();
DEBUG_PRINTLN(F("Could not allocate SPI pins.")); DEBUG_PRINTLN(F("Could not allocate SPI pins."));
uint8_t spi[2] = { spi_mosi, spi_sclk }; uint8_t spi[3] = { spi_mosi, spi_miso, spi_sclk };
pinManager.deallocateMultiplePins(spi, 2, PinOwner::HW_SPI); // just in case deallocation of old pins pinManager.deallocateMultiplePins(spi, 3, PinOwner::HW_SPI); // just in case deallocation of old pins
spi_mosi = -1; spi_mosi = -1;
spi_miso = -1;
spi_sclk = -1; spi_sclk = -1;
} }

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2208231 #define VERSION 2208251
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG
@ -647,6 +647,7 @@ WLED_GLOBAL UsermodManager usermods _INIT(UsermodManager());
WLED_GLOBAL int8_t i2c_sda _INIT(-1); // global I2C SDA pin [HW_PIN_SDA] (used for usermods) WLED_GLOBAL int8_t i2c_sda _INIT(-1); // global I2C SDA pin [HW_PIN_SDA] (used for usermods)
WLED_GLOBAL int8_t i2c_scl _INIT(-1); // global I2C SCL pin [HW_PIN_SCL] (used for usermods) WLED_GLOBAL int8_t i2c_scl _INIT(-1); // global I2C SCL pin [HW_PIN_SCL] (used for usermods)
WLED_GLOBAL int8_t spi_mosi _INIT(-1); // global SPI DATA/MOSI pin [HW_PIN_DATASPI] (used for usermods) WLED_GLOBAL int8_t spi_mosi _INIT(-1); // global SPI DATA/MOSI pin [HW_PIN_DATASPI] (used for usermods)
WLED_GLOBAL int8_t spi_miso _INIT(-1); // global SPI DATA/MISO pin [HW_PIN_MISOSPI] (used for usermods)
WLED_GLOBAL int8_t spi_sclk _INIT(-1); // global SPI CLOCK/SCLK pin [HW_PIN_CLOCKSPI] (used for usermods) WLED_GLOBAL int8_t spi_sclk _INIT(-1); // global SPI CLOCK/SCLK pin [HW_PIN_CLOCKSPI] (used for usermods)
// global ArduinoJson buffer // global ArduinoJson buffer

View File

@ -636,6 +636,7 @@ void getSettingsJS(byte subPage, char* dest)
sappend('v',SET_F("SDA"),i2c_sda); sappend('v',SET_F("SDA"),i2c_sda);
sappend('v',SET_F("SCL"),i2c_scl); sappend('v',SET_F("SCL"),i2c_scl);
sappend('v',SET_F("MOSI"),spi_mosi); sappend('v',SET_F("MOSI"),spi_mosi);
sappend('v',SET_F("MISO"),spi_miso);
sappend('v',SET_F("SCLK"),spi_sclk); sappend('v',SET_F("SCLK"),spi_sclk);
oappend(SET_F("addInfo('SDA','")); oappendi(HW_PIN_SDA); oappend(SET_F("');")); oappend(SET_F("addInfo('SDA','")); oappendi(HW_PIN_SDA); oappend(SET_F("');"));
oappend(SET_F("addInfo('SCL','")); oappendi(HW_PIN_SCL); oappend(SET_F("');")); oappend(SET_F("addInfo('SCL','")); oappendi(HW_PIN_SCL); oappend(SET_F("');"));