ported changes from non-chained version of example.

Tested with 128x128 pane (four 64x64 panels)

Signed-off-by: Emil Muratov <gpm@hotplug.ru>
This commit is contained in:
Emil Muratov 2020-12-19 20:28:47 +03:00
parent 445c0424f4
commit 33b95f534f
27 changed files with 1772 additions and 945 deletions

View file

@ -34,7 +34,7 @@ public:
Attractor() {
location = PVector(MATRIX_CENTRE_X, MATRIX_CENTRE_Y);
mass = 8;
mass = 10;
G = .5;
}

View file

@ -124,15 +124,16 @@ void setup()
void patternAdvance(){
// Go to next pattern in the list (se Patterns.h)
patterns.stop();
patterns.move(1);
patterns.stop();
patterns.moveRandom(1);
//patterns.move(1);
patterns.start();
// Select a random palette as well
effects.RandomPalette();
Serial.print("Changing pattern to: ");
Serial.println(patterns.getCurrentPatternName());
Serial.println(patterns.getPatternIndex());
lastPattern = patterns.getPatternIndex();
//Serial.println(patterns.getPatternIndex());
//lastPattern = patterns.getPatternIndex();
// Save last index.
preferences.begin("RGBMATRIX", false);
preferences.putInt("lastPattern", lastPattern);

View file

@ -43,6 +43,11 @@ public:
return 0;
};
virtual void printTesting()
{
Serial.println("Testing...");
}
virtual void start() {};
virtual void stop() {};
};

File diff suppressed because it is too large Load diff

View file

@ -147,4 +147,4 @@ struct triFace
}
};
#endif
#endif

View file

@ -52,7 +52,7 @@ public:
unsigned int drawFrame() {
// dim all pixels on the display
uint8_t dim = beatsin8(2, 170, 250);
effects.DimAll(dim); effects.ShowFrame();
effects.DimAll(dim);
for (int i = 0; i < count; i++) {
Boid boid = boids[i];
@ -66,7 +66,8 @@ public:
boids[i] = boid;
}
return 15;
effects.ShowFrame();
return 0;
}
};

View file

@ -0,0 +1,73 @@
/*
* Aurora: https://github.com/pixelmatix/aurora
* Copyright (c) 2014 Jason Coon
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PatternBounce_H
class PatternBounce : public Drawable {
private:
static const int count = 32;
PVector gravity = PVector(0, 0.0125);
public:
PatternBounce() {
name = (char *)"Bounce";
}
void start() {
unsigned int colorWidth = 256 / count;
for (int i = 0; i < count; i++) {
Boid boid = Boid(i, 0);
boid.velocity.x = 0;
boid.velocity.y = i * -0.01;
boid.colorIndex = colorWidth * i;
boid.maxforce = 10;
boid.maxspeed = 10;
boids[i] = boid;
}
}
unsigned int drawFrame() {
// dim all pixels on the display
effects.DimAll(170); effects.ShowFrame();
for (int i = 0; i < count; i++) {
Boid boid = boids[i];
boid.applyForce(gravity);
boid.update();
effects.drawBackgroundFastLEDPixelCRGB(boid.location.x, boid.location.y, effects.ColorFromCurrentPalette(boid.colorIndex));
if (boid.location.y >= VPANEL_H - 1) {
boid.location.y = VPANEL_H - 1;
boid.velocity.y *= -1.0;
}
boids[i] = boid;
}
return 15;
}
};
#endif

View file

@ -0,0 +1,219 @@
/*
* Aurora: https://github.com/pixelmatix/aurora
* Copyright (c) 2014 Jason Coon
*
* Portions of this code are adapted from Noel Bundy's work: https://github.com/TwystNeko/Object3d
* Copyright (c) 2014 Noel Bundy
*
* Portions of this code are adapted from the Petty library: https://code.google.com/p/peggy/
* Copyright (c) 2008 Windell H Oskay. All right reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PatternCube_H
#define PatternCube_H
class PatternCube : public Drawable {
private:
float focal = 30; // Focal of the camera
int cubeWidth = 28; // Cube size
float Angx = 20.0, AngxSpeed = 0.05; // rotation (angle+speed) around X-axis
float Angy = 10.0, AngySpeed = 0.05; // rotation (angle+speed) around Y-axis
float Ox = 15.5, Oy = 15.5; // position (x,y) of the frame center
int zCamera = 110; // distance from cube to the eye of the camera
// Local vertices
Vertex local[8];
// Camera aligned vertices
Vertex aligned[8];
// On-screen projected vertices
Point screen[8];
// Faces
squareFace face[6];
// Edges
EdgePoint edge[12];
int nbEdges;
// ModelView matrix
float m00, m01, m02, m10, m11, m12, m20, m21, m22;
// constructs the cube
void make(int w)
{
nbEdges = 0;
local[0].set(-w, w, w);
local[1].set(w, w, w);
local[2].set(w, -w, w);
local[3].set(-w, -w, w);
local[4].set(-w, w, -w);
local[5].set(w, w, -w);
local[6].set(w, -w, -w);
local[7].set(-w, -w, -w);
face[0].set(1, 0, 3, 2);
face[1].set(0, 4, 7, 3);
face[2].set(4, 0, 1, 5);
face[3].set(4, 5, 6, 7);
face[4].set(1, 2, 6, 5);
face[5].set(2, 3, 7, 6);
int f, i;
for (f = 0; f < 6; f++)
{
for (i = 0; i < face[f].length; i++)
{
face[f].ed[i] = this->findEdge(face[f].sommets[i], face[f].sommets[i ? i - 1 : face[f].length - 1]);
}
}
}
// finds edges from faces
int findEdge(int a, int b)
{
int i;
for (i = 0; i < nbEdges; i++)
if ((edge[i].x == a && edge[i].y == b) || (edge[i].x == b && edge[i].y == a))
return i;
edge[nbEdges++].set(a, b);
return i;
}
// rotates according to angle x&y
void rotate(float angx, float angy)
{
int i;
float cx = cos(angx);
float sx = sin(angx);
float cy = cos(angy);
float sy = sin(angy);
m00 = cy;
m01 = 0;
m02 = -sy;
m10 = sx * sy;
m11 = cx;
m12 = sx * cy;
m20 = cx * sy;
m21 = -sx;
m22 = cx * cy;
for (i = 0; i < 8; i++)
{
aligned[i].x = m00 * local[i].x + m01 * local[i].y + m02 * local[i].z;
aligned[i].y = m10 * local[i].x + m11 * local[i].y + m12 * local[i].z;
aligned[i].z = m20 * local[i].x + m21 * local[i].y + m22 * local[i].z + zCamera;
screen[i].x = floor((Ox + focal * aligned[i].x / aligned[i].z));
screen[i].y = floor((Oy - focal * aligned[i].y / aligned[i].z));
}
for (i = 0; i < 12; i++)
edge[i].visible = false;
Point *pa, *pb, *pc;
for (i = 0; i < 6; i++)
{
pa = screen + face[i].sommets[0];
pb = screen + face[i].sommets[1];
pc = screen + face[i].sommets[2];
boolean back = ((pb->x - pa->x) * (pc->y - pa->y) - (pb->y - pa->y) * (pc->x - pa->x)) < 0;
if (!back)
{
int j;
for (j = 0; j < 4; j++)
{
edge[face[i].ed[j]].visible = true;
}
}
}
}
byte hue = 0;
int step = 0;
public:
PatternCube() {
name = (char *)"Cube";
make(cubeWidth);
}
unsigned int drawFrame() {
uint8_t blurAmount = beatsin8(2, 10, 255);
#if FASTLED_VERSION >= 3001000
blur2d(effects.leds, VPANEL_W, VPANEL_H, blurAmount);
#else
effects.DimAll(blurAmount); effects.ShowFrame();
#endif
zCamera = beatsin8(2, 100, 140);
AngxSpeed = beatsin8(3, 1, 10) / 100.0f;
AngySpeed = beatcos8(5, 1, 10) / 100.0f;
// Update values
Angx += AngxSpeed;
Angy += AngySpeed;
if (Angx >= TWO_PI)
Angx -= TWO_PI;
if (Angy >= TWO_PI)
Angy -= TWO_PI;
rotate(Angx, Angy);
// Draw cube
int i;
CRGB color = effects.ColorFromCurrentPalette(hue, 128);
// Backface
EdgePoint *e;
for (i = 0; i < 12; i++)
{
e = edge + i;
if (!e->visible) {
matrix.drawLine(screen[e->x].x, screen[e->x].y, screen[e->y].x, screen[e->y].y, color);
}
}
color = effects.ColorFromCurrentPalette(hue, 255);
// Frontface
for (i = 0; i < 12; i++)
{
e = edge + i;
if (e->visible)
{
matrix.drawLine(screen[e->x].x, screen[e->x].y, screen[e->y].x, screen[e->y].y, color);
}
}
step++;
if (step == 8) {
step = 0;
hue++;
}
effects.ShowFrame();
return 20;
}
};
#endif

View file

@ -70,7 +70,7 @@ class PatternElectricMandala : public Drawable {
unsigned int drawFrame() {
#if FASTLED_VERSION >= 3001000
// a new parameter set every 15 seconds
EVERY_N_SECONDS(25) {
EVERY_N_SECONDS(15) {
//SetupRandomPalette3();
dy = random16(500) - 250; // random16(2000) - 1000 is pretty fast but works fine, too
dx = random16(500) - 250;
@ -92,13 +92,13 @@ class PatternElectricMandala : public Drawable {
effects.ShowFrame();
return 0;
return 30;
}
// show just one layer
void ShowNoiseLayer(byte layer, byte colorrepeat, byte colorshift) {
for (uint8_t i = 0; i < VPANEL_W; i++) {
for (uint8_t j = 0; j < VPANEL_H; j++) {
for (uint16_t i = 0; i < VPANEL_W; i++) {
for (uint16_t j = 0; j < VPANEL_H; j++) {
uint8_t color = noise[i][j];
@ -107,7 +107,7 @@ class PatternElectricMandala : public Drawable {
// assign a color depending on the actual palette
CRGB pixel = ColorFromPalette(effects.currentPalette, colorrepeat * (color + colorshift), bri);
effects.leds[XY(i, j)] = pixel;
effects.leds[XY16(i, j)] = pixel;
}
}
}

View file

@ -1,29 +1,27 @@
/*
Aurora: https://github.com/pixelmatix/aurora
Copyright (c) 2014 Jason Coon
Portions of this code are adapted from FastLED Fire2012 example by Mark Kriegsman: https://github.com/FastLED/FastLED/tree/master/examples/Fire2012WithPalette
Copyright (c) 2013 FastLED
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Note: (Kosso) : Doesn't look good with certain palettes.
* Aurora: https://github.com/pixelmatix/aurora
* Copyright (c) 2014 Jason Coon
*
* Portions of this code are adapted from FastLED Fire2012 example by Mark Kriegsman: https://github.com/FastLED/FastLED/tree/master/examples/Fire2012WithPalette
* Copyright (c) 2013 FastLED
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PatternFire_H
#define PatternFire_H
@ -58,7 +56,7 @@ class PatternFire : public Drawable {
// Add entropy to random number generator; we use a lot of it.
random16_add_entropy( random16());
effects.DimAll(235);
effects.DimAll(235);
for (int x = 0; x < VPANEL_W; x++) {
// Step 1. Cool down every cell a little
@ -92,12 +90,10 @@ class PatternFire : public Drawable {
colorIndex = scale8(colorIndex, 200);
// override color 0 to ensure a black background?
//if (colorIndex != 0) {
// effects.leds[xy] = CRGB::Black;
//}
//else {
if (colorIndex != 0)
// effects.leds[xy] = CRGB::Black;
// else
effects.leds[xy] = effects.ColorFromCurrentPalette(colorIndex);
//}
}
}
@ -109,9 +105,10 @@ class PatternFire : public Drawable {
noise_scale_y = 4000;
effects.FillNoise();
// effects.MoveX(2);
effects.MoveX(2);
effects.MoveFractionalNoiseX(2);
effects.ShowFrame();
return 15;

View file

@ -26,7 +26,7 @@
class PatternIncrementalDrift : public Drawable {
public:
PatternIncrementalDrift() {
PatternIncrementalDrift() {
name = (char *)"Incremental Drift";
}

View file

@ -0,0 +1,64 @@
/*
*
* Aurora: https://github.com/pixelmatix/aurora
* Copyright (c) 2014 Jason Coon
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PatternIncrementalDrift2_H
#define PatternIncrementalDrift2_H
class PatternIncrementalDrift2 : public Drawable {
public:
PatternIncrementalDrift2() {
name = (char *)"Incremental Drift Rose";
}
unsigned int drawFrame() {
uint8_t dim = beatsin8(2, 170, 250);
effects.DimAll(dim); effects.ShowFrame();
for (int i = 2; i < VPANEL_H / 2; ++i)
//for (uint8_t i = 0; i < 32; i++)
{
CRGB color;
uint8_t x = 0;
uint8_t y = 0;
if (i < 16) {
x = beatcos8((i + 1) * 2, i, VPANEL_W - i);
y = beatsin8((i + 1) * 2, i, VPANEL_H - i);
color = effects.ColorFromCurrentPalette(i * 14);
}
else
{
x = beatsin8((32 - i) * 2, VPANEL_W - i, i + 1);
y = beatcos8((32 - i) * 2, VPANEL_H - i, i + 1);
color = effects.ColorFromCurrentPalette((31 - i) * 14);
}
effects.drawBackgroundFastLEDPixelCRGB(x, y, color);
}
return 0;
}
};
#endif

View file

@ -31,7 +31,9 @@ public:
unsigned int drawFrame() {
// dim all pixels on the display slightly
// to 250/255 (98%) of their current brightness
effects.DimAll(250); effects.ShowFrame();
blur2d(effects.leds, VPANEL_W > 255 ? 255 : VPANEL_W, VPANEL_H > 255 ? 255 : VPANEL_H, 250);
// effects.DimAll(250); effects.ShowFrame();
// the Effects class has some sample oscillators
// that move from 0 to 255 at different speeds
@ -51,7 +53,8 @@ public:
// draw a pixel at x,y using a color from the current palette
effects.Pixel(x, y, hue);
return 15;
effects.ShowFrame();
return 30;
}
};

View file

@ -0,0 +1,154 @@
/*
* Aurora: https://github.com/pixelmatix/aurora
* Copyright (c) 2014 Jason Coon
*
* Inspired by 'Space Invader Generator': https://the8bitpimp.wordpress.com/2013/05/07/space-invader-generator
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PatternInvaders_H
#define PatternInvaders_H
class PatternInvadersSmall : public Drawable {
private:
uint8_t x = 1;
uint8_t y = 1;
public:
PatternInvadersSmall() {
name = (char *)"Invaders Small";
}
void start() {
matrix.fillScreen(0);
}
unsigned int drawFrame() {
CRGB color1 = effects.ColorFromCurrentPalette(random(0, 255));
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 5; j++) {
CRGB color = CRGB::Black;
if (random(0, 2) == 1) color = color1;
effects.drawBackgroundFastLEDPixelCRGB(x + i, y + j, color);
if (i < 2)
effects.drawBackgroundFastLEDPixelCRGB(x + (4 - i), y + j, color);
}
}
x += 6;
if (x > 25) {
x = 1;
y += 6;
}
if (y > 25) y = x = 1;
effects.ShowFrame();
return 125;
}
};
class PatternInvadersMedium : public Drawable {
private:
uint8_t x = 0;
uint8_t y = 0;
public:
PatternInvadersMedium() {
name = (char *)"Invaders Medium";
}
void start() {
matrix.fillScreen(0);
}
unsigned int drawFrame() {
CRGB color1 = effects.ColorFromCurrentPalette(random(0, 255));
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 5; j++) {
CRGB color = CRGB::Black;
if (random(0, 2) == 1) color = color1;
matrix.fillRect(x + (i * 2), y + (j * 2), x + (i * 2 + 1), y + (j * 2 + 1), color);
if (i < 2)
matrix.fillRect(x + (8 - i * 2), y + (j * 2), x + (9 - i * 2), y + (j * 2 + 1), color);
}
}
x += 11;
if (x > 22) {
x = 0;
y += 11;
}
if (y > 22) y = x = 0;
effects.ShowFrame();
return 500;
}
};
class PatternInvadersLarge : public Drawable {
private:
public:
PatternInvadersLarge() {
name = (char *)"Invaders Large";
}
void start() {
matrix.fillScreen(0);
}
unsigned int drawFrame() {
matrix.fillScreen(0);
CRGB color1 = effects.ColorFromCurrentPalette(random(0, 255));
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 5; y++) {
CRGB color = CRGB::Black;
if (random(0, 2) == 1) {
color = color1;
}
matrix.fillRect(1 + x * 6, 1 + y * 6, 5 + x * 6, 5 + y * 6, color);
if (x < 2)
matrix.fillRect(1 + (4 - x) * 6, 1 + y * 6, 5 + (4 - x) * 6, 5 + y * 6, color);
}
}
effects.ShowFrame();
return 2000;
}
};
#endif

View file

@ -246,7 +246,7 @@ public:
if (algorithm >= algorithmCount)
algorithm = 0;
return 1000;
return 0;
}
effects.ShowFrame();
@ -255,7 +255,7 @@ public:
}
void start() {
matrix.fillScreen(0);
effects.ClearFrame();
cellCount = 0;
hue = 0;
}

View file

@ -40,9 +40,9 @@ public:
unsigned int drawFrame() {
for (byte x = 0; x < VPANEL_W; x++) {
for (byte y = 0; y < VPANEL_H; y++) {
effects.leds[XY(x, y)] = (x ^ y ^ flip) < count ? effects.ColorFromCurrentPalette(((x ^ y) << 2) + generation) : CRGB::Black;
for (uint16_t x = 0; x < VPANEL_W; x++) {
for (uint16_t y = 0; y < VPANEL_H; y++) {
effects.leds[XY16(x, y)] = (x ^ y ^ flip) < count ? effects.ColorFromCurrentPalette(((x ^ y) << 2) + generation) : CRGB::Black;
// The below is more pleasant
// effects.leds[XY(x, y)] = effects.ColorFromCurrentPalette(((x ^ y) << 2) + generation) ;
@ -66,7 +66,6 @@ public:
// show it ffs!
effects.ShowFrame();
return 60;
}
};

View file

@ -65,10 +65,10 @@ public:
effects.FillNoise();
effects.MoveX(8);
// effects.MoveFractionalNoiseX();
effects.MoveFractionalNoiseX();
effects.MoveY(8);
// effects.MoveFractionalNoiseY();
effects.MoveFractionalNoiseY();
patternNoiseSmearingHue++;
@ -103,10 +103,10 @@ public:
effects.FillNoise();
effects.MoveX(3);
// effects.MoveFractionalNoiseY(4);
effects.MoveFractionalNoiseY(4);
effects.MoveY(3);
//effects.MoveFractionalNoiseX(4);
effects.MoveFractionalNoiseX(4);
patternNoiseSmearingHue++;
@ -137,10 +137,10 @@ public:
effects.FillNoise();
effects.MoveX(3);
// effects.MoveFractionalNoiseY(4);
effects.MoveFractionalNoiseY(4);
effects.MoveY(3);
// effects.MoveFractionalNoiseX(4);
effects.MoveFractionalNoiseX(4);
effects.ShowFrame();
@ -170,10 +170,10 @@ public:
effects.FillNoise();
effects.MoveX(8);
// effects.MoveFractionalNoiseX();
effects.MoveFractionalNoiseX();
effects.MoveY(8);
// effects.MoveFractionalNoiseY();
effects.MoveFractionalNoiseY();
patternNoiseSmearingHue++;
@ -206,10 +206,10 @@ public:
effects.FillNoise();
effects.MoveX(3);
// effects.MoveFractionalNoiseY(4);
effects.MoveFractionalNoiseY(4);
effects.MoveY(4);
// effects.MoveFractionalNoiseX(4);
effects.MoveFractionalNoiseX(4);
return 0;
}
@ -241,10 +241,10 @@ public:
effects.FillNoise();
effects.MoveX(3);
// effects.MoveFractionalNoiseX(4);
effects.MoveFractionalNoiseX(4);
effects.MoveY(3);
//effects.MoveFractionalNoiseY(4);
effects.MoveFractionalNoiseY(4);
return 0;
}
@ -261,8 +261,8 @@ public:
effects.DimAll(170); effects.ShowFrame();
// draw a rainbow color palette
for (uint8_t y = 0; y < MATRIX_HEIGHT; y++) {
for (uint8_t x = 0; x < MATRIX_WIDTH; x++) {
for (uint8_t y = 0; y < VPANEL_H; y++) {
for (uint8_t x = 0; x < VPANEL_W; x++) {
effects.leds[XY(x, y)] += effects.ColorFromCurrentPalette(x * 8, y * 8 + 7);
}
}
@ -280,7 +280,7 @@ public:
//effects.MoveFractionalNoiseY(4);
effects.MoveY(3);
// effects.MoveFractionalNoiseX(4);
effects.MoveFractionalNoiseX(4);
effects.ShowFrame();
return 0;
@ -327,10 +327,10 @@ public:
effects.FillNoise();
effects.MoveX(3);
// effects.MoveFractionalNoiseY(4);
effects.MoveFractionalNoiseY(4);
effects.MoveY(3);
// effects.MoveFractionalNoiseX(4);
effects.MoveFractionalNoiseX(4);
return 0;
}

View file

@ -34,6 +34,12 @@
#ifndef PatternPendulumWave_H
#define PatternPendulumWave_H
#define WAVE_BPM 25
#define AMP_BPM 2
#define SKEW_BPM 4
#define WAVE_TIMEMINSKEW VPANEL_W/8
#define WAVE_TIMEMAXSKEW VPANEL_W/2
class PatternPendulumWave : public Drawable {
public:
PatternPendulumWave() {
@ -41,15 +47,19 @@ class PatternPendulumWave : public Drawable {
}
unsigned int drawFrame() {
effects.DimAll(170); effects.ShowFrame();
effects.ClearFrame();
for (int x = 0; x < VPANEL_W; x++)
for (int x = 0; x < VPANEL_W; ++x)
{
uint8_t y = beatsin8(x + VPANEL_W, 0, VPANEL_H);
uint16_t amp = beatsin16(AMP_BPM, VPANEL_H/8, VPANEL_H-1);
uint16_t offset = (VPANEL_H - beatsin16(AMP_BPM, 0, VPANEL_H))/2;
uint8_t y = beatsin16(WAVE_BPM, 0, amp, x*beatsin16(SKEW_BPM, WAVE_TIMEMINSKEW, WAVE_TIMEMAXSKEW)) + offset;
effects.drawBackgroundFastLEDPixelCRGB(x, y, effects.ColorFromCurrentPalette(x * 7));
}
return 15;
effects.ShowFrame();
return 20;
}
};

View file

@ -0,0 +1,82 @@
/*
* Aurora: https://github.com/pixelmatix/aurora
* Copyright (c) 2014 Jason Coon
*
* Based at least in part on someone else's work that I can no longer find.
* Please let me know if you recognize any of this code!
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PatternPulse_H
#define PatternPulse_H
class PatternPulse : public Drawable {
private:
int hue;
int centerX = 0;
int centerY = 0;
int step = -1;
int maxSteps = 16;
float fadeRate = 0.8;
int diff;
public:
PatternPulse() {
name = (char *)"Pulse";
}
unsigned int drawFrame() {
effects.DimAll(235);
if (step == -1) {
centerX = random(32);
centerY = random(32);
hue = random(256); // 170;
step = 0;
}
if (step == 0) {
matrix.drawCircle(centerX, centerY, step, effects.ColorFromCurrentPalette(hue));
step++;
}
else {
if (step < maxSteps) {
// initial pulse
matrix.drawCircle(centerX, centerY, step, effects.ColorFromCurrentPalette(hue, pow(fadeRate, step - 2) * 255));
// secondary pulse
if (step > 3) {
matrix.drawCircle(centerX, centerY, step - 3, effects.ColorFromCurrentPalette(hue, pow(fadeRate, step - 2) * 255));
}
step++;
}
else {
step = -1;
}
}
effects.standardNoiseSmearing();
effects.ShowFrame();
return 30;
}
};
#endif

View file

@ -60,17 +60,17 @@ class PatternSimplexNoise : public Drawable {
effects.ShowFrame();
return 0;
return 30;
}
// show just one layer
void ShowNoiseLayer(byte layer, byte colorrepeat, byte colorshift) {
for (uint8_t i = 0; i < VPANEL_W; i++) {
for (uint8_t j = 0; j < VPANEL_H; j++) {
for (uint16_t i = 0; i < VPANEL_W; i++) {
for (uint16_t j = 0; j < VPANEL_H; j++) {
uint8_t pixel = noise[i][j];
// assign a color depending on the actual palette
effects.leds[XY(i, j)] = effects.ColorFromCurrentPalette(colorrepeat * (pixel + colorshift), pixel);
effects.leds[XY16(i, j)] = effects.ColorFromCurrentPalette(colorrepeat * (pixel + colorshift), pixel);
}
}
}

View file

@ -101,7 +101,7 @@ private:
}
};
static const int snakeCount = 40;
static const int snakeCount = 6;
Snake snakes[snakeCount];
public:

View file

@ -0,0 +1,113 @@
/*
* Aurora: https://github.com/pixelmatix/aurora
* Copyright (c) 2014 Jason Coon
*
* Portions of this code are adapted from FastLED Fire2012 example by Mark Kriegsman: https://github.com/FastLED/FastLED/tree/master/examples/Fire2012WithPalette
* Copyright (c) 2013 FastLED
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PatternSpark_H
#define PatternSpark_H
class PatternSpark : public Drawable {
private:
public:
PatternSpark() {
name = (char *)"Spark";
}
// There are two main parameters you can play with to control the look and
// feel of your fire: COOLING (used in step 1 above), and SPARKING (used
// in step 3 above).
//
// COOLING: How much does the air cool as it rises?
// Less cooling = taller flames. More cooling = shorter flames.
// Default 55, suggested range 20-100
uint8_t cooling = 100;
// SPARKING: What chance (out of 255) is there that a new spark will be lit?
// Higher chance = more roaring fire. Lower chance = more flickery fire.
// Default 120, suggested range 50-200.
uint8_t sparking = 50;
unsigned int drawFrame() {
// Add entropy to random number generator; we use a lot of it.
random16_add_entropy( random16());
effects.DimAll(235); effects.ShowFrame();
for (uint8_t x = 0; x < VPANEL_W; x++) {
// Step 1. Cool down every cell a little
for (int y = 0; y < VPANEL_H; y++) {
int xy = XY(x, y);
heat[xy] = qsub8(heat[xy], random8(0, ((cooling * 10) / VPANEL_H) + 2));
}
// Step 2. Heat from each cell drifts 'up' and diffuses a little
for (int y = 0; y < VPANEL_H; y++) {
heat[XY(x, y)] = (heat[XY(x, y + 1)] + heat[XY(x, y + 2)] + heat[XY(x, y + 2)]) / 3;
}
// Step 2. Randomly ignite new 'sparks' of heat
if (random8() < sparking) {
uint8_t xt = random8(MATRIX_CENTRE_X - 2, MATRIX_CENTER_X + 3);
int xy = XY(xt, VPANEL_H - 1);
heat[xy] = qadd8(heat[xy], random8(160, 255));
}
// Step 4. Map from heat cells to LED colors
for (int y = 0; y < VPANEL_H; y++) {
int xy = XY(x, y);
byte colorIndex = heat[xy];
// Recommend that you use values 0-240 rather than
// the usual 0-255, as the last 15 colors will be
// 'wrapping around' from the hot end to the cold end,
// which looks wrong.
colorIndex = scale8(colorIndex, 240);
// override color 0 to ensure a black background?
if (colorIndex != 0)
// effects.leds[xy] = CRGB::Black;
// else
effects.leds[xy] = effects.ColorFromCurrentPalette(colorIndex);
}
}
// Noise
noise_x += 1000;
noise_y += 1000;
noise_z += 1000;
noise_scale_x = 4000;
noise_scale_y = 4000;
effects.FillNoise();
effects.MoveX(3);
effects.MoveFractionalNoiseX(4);
effects.ShowFrame();
return 15;
}
};
#endif

View file

@ -0,0 +1,100 @@
/*
* Aurora: https://github.com/pixelmatix/aurora
* Copyright (c) 2014 Jason Coon
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PatternSpin_H
class PatternSpin : public Drawable {
public:
PatternSpin() {
name = (char *)"Spin";
}
float degrees = 0;
float radius = 16;
float speedStart = 1;
float velocityStart = 0.6;
float maxSpeed = 30;
float speed = speedStart;
float velocity = velocityStart;
void start() {
speed = speedStart;
velocity = velocityStart;
degrees = 0;
}
unsigned int drawFrame() {
effects.DimAll(190); effects.ShowFrame();
CRGB color = effects.ColorFromCurrentPalette(speed * 8);
// start position
int x;
int y;
// target position
float targetDegrees = degrees + speed;
float targetRadians = radians(targetDegrees);
int targetX = (int) (MATRIX_CENTER_X + radius * cos(targetRadians));
int targetY = (int) (MATRIX_CENTER_Y - radius * sin(targetRadians));
float tempDegrees = degrees;
do{
float radians = radians(tempDegrees);
x = (int) (MATRIX_CENTER_X + radius * cos(radians));
y = (int) (MATRIX_CENTER_Y - radius * sin(radians));
effects.drawBackgroundFastLEDPixelCRGB(x, y, color);
effects.drawBackgroundFastLEDPixelCRGB(y, x, color);
tempDegrees += 1;
if (tempDegrees >= 360)
tempDegrees = 0;
} while (x != targetX || y != targetY);
degrees += speed;
// add velocity to the particle each pass around the accelerator
if (degrees >= 360) {
degrees = 0;
speed += velocity;
if (speed <= speedStart) {
speed = speedStart;
velocity *= -1;
}
else if (speed > maxSpeed){
speed = maxSpeed - velocity;
velocity *= -1;
}
}
return 0;
}
};
#endif

View file

@ -37,7 +37,7 @@ class PatternSpiro : public Drawable {
uint8_t spirocount = 1;
uint8_t spirooffset = 256 / spirocount;
boolean spiroincrement = false;
boolean spiroincrement = true;
boolean handledChange = false;
@ -46,8 +46,12 @@ class PatternSpiro : public Drawable {
name = (char *)"Spiro";
}
void start(){
effects.ClearFrame();
};
unsigned int drawFrame() {
effects.DimAll(254); effects.ShowFrame();
blur2d(effects.leds, VPANEL_W > 255 ? 255 : VPANEL_W, VPANEL_H > 255 ? 255 : VPANEL_H, 192);
boolean change = false;
@ -100,6 +104,7 @@ class PatternSpiro : public Drawable {
hueoffset += 1;
}
effects.ShowFrame();
return 0;
}
};

View file

@ -36,6 +36,7 @@ class PatternSwirl : public Drawable {
}
void start() {
effects.ClearFrame();
}
unsigned int drawFrame() {
@ -46,24 +47,25 @@ class PatternSwirl : public Drawable {
uint8_t blurAmount = beatsin8(2, 10, 255);
#if FASTLED_VERSION >= 3001000
blur2d(effects.leds, VPANEL_W, VPANEL_H, blurAmount);
blur2d(effects.leds, VPANEL_W > 255 ? 255 : VPANEL_W, VPANEL_H > 255 ? 255 : VPANEL_H, blurAmount);
#else
effects.DimAll(blurAmount);
#endif
// Use two out-of-sync sine waves
uint8_t i = beatsin8(27, borderWidth, VPANEL_H - borderWidth);
uint8_t j = beatsin8(41, borderWidth, VPANEL_W - borderWidth);
uint8_t i = beatsin8(256/VPANEL_H, borderWidth, VPANEL_W - borderWidth);
uint8_t j = beatsin8(2048/VPANEL_W, borderWidth, VPANEL_H - borderWidth);
// Also calculate some reflections
uint8_t ni = (VPANEL_W - 1) - i;
uint8_t nj = (VPANEL_W - 1) - j;
uint8_t nj = (VPANEL_H - 1) - j;
// The color of each point shifts over time, each at a different speed.
uint16_t ms = millis();
effects.leds[XY(i, j)] += effects.ColorFromCurrentPalette(ms / 11);
effects.leds[XY(j, i)] += effects.ColorFromCurrentPalette(ms / 13);
//effects.leds[XY(j, i)] += effects.ColorFromCurrentPalette(ms / 13); // this doesn't work for non-square matrixes
effects.leds[XY(ni, nj)] += effects.ColorFromCurrentPalette(ms / 17);
effects.leds[XY(nj, ni)] += effects.ColorFromCurrentPalette(ms / 29);
//effects.leds[XY(nj, ni)] += effects.ColorFromCurrentPalette(ms / 29); // this doesn't work for non-square matrixes
effects.leds[XY(i, nj)] += effects.ColorFromCurrentPalette(ms / 37);
effects.leds[XY(ni, j)] += effects.ColorFromCurrentPalette(ms / 41);

View file

@ -0,0 +1,20 @@
#ifndef PatternTest_H
#define PatternTest_H
class PatternTest : public Drawable {
private:
public:
PatternTest() {
name = (char *)"Test Pattern";
}
unsigned int drawFrame() {
matrix.fillScreen(matrix.color565(128, 0, 0));
return 1000;
}
};
#endif

View file

@ -34,52 +34,75 @@
*
* Commented out patterns are due to the fact they either didn't work properly with a non-square display,
* or from my personal opinion, are crap.
*
* Kosso: I have removed the crappy ones and added a less crappy (and working!) Fire demo ;)
*
*/
#include "PaletteFireKoz.h" // Added by Kosso
#include "PatternFireKoz.h" // Added by Kosso
#include "PatternTest.h"
//#include "PatternNoiseSmearing.h" // Doesn't seem to work, omitting.
#include "PatternSpiro.h"
#include "PatternRadar.h"
#include "PatternSwirl.h"
#include "PatternPendulumWave.h"
#include "PatternFlowField.h"
#include "PatternIncrementalDrift.h"
#include "PatternIncrementalDrift2.h" // Doesn't seem to work, omitting.
#include "PatternMunch.h"
#include "PatternElectricMandala.h"
//#include "PatternSpin.h" // Doesn't seem to work, omitting.
#include "PatternSimplexNoise.h"
#include "PatternWave.h"
#include "PatternAttract.h"
//#include "PatternBounce.h" // Doesn't seem to work, omitting.
#include "PatternFlock.h"
#include "PatternInfinity.h"
#include "PatternPlasma.h"
#include "PatternSnake.h"
#include "PatternFire.h" // Not very good.
#include "PatternInvaders.h"
//#include "PatternCube.h" // Doesn't seem to work, omitting.
//#include "PatternFire.h" // Doesn't seem to work, omitting.
#include "PatternLife.h"
#include "PatternMaze.h"
//#include "PatternPulse.h" // Doesn't seem to work, omitting.
//#include "PatternSpark.h" // Doesn't seem to work, omitting.
#include "PatternSpiral.h"
class Patterns : public Playlist {
private:
PatternFireKoz fireKoz;
PatternTest patternTest;
// PatternRainbowFlag rainbowFlag; // doesn't work
// PatternPaletteSmear paletteSmear;
// PatternMultipleStream multipleStream; // doesn't work
// PatternMultipleStream2 multipleStream2; // doesn't work
// PatternMultipleStream3 multipleStream3; // doesn't work
// PatternMultipleStream4 multipleStream4; // doesn't work
// PatternMultipleStream5 multipleStream5; // doesn't work
// PatternMultipleStream8 multipleStream8; // doesn't work
PatternSpiro spiro;
// PatternRadar radar;
PatternSwirl swirl;
PatternPendulumWave pendulumWave;
PatternFlowField flowField;
PatternIncrementalDrift incrementalDrift;
PatternIncrementalDrift2 incrementalDrift2;
PatternMunch munch;
PatternElectricMandala electricMandala;
// PatternSpin spin;
PatternSimplexNoise simplexNoise;
PatternWave wave;
PatternAttract attract;
// PatternBounce bounce;
PatternFlock flock;
PatternInfinity infinity;
PatternPlasma plasma;
PatternInvadersSmall invadersSmall;
// PatternInvadersMedium invadersMedium;
// PatternInvadersLarge invadersLarge;
PatternSnake snake;
PatternFire fire;
// PatternCube cube;
// PatternFire fire;
PatternLife life;
PatternMaze maze;
// PatternPulse pulse;
// PatternSpark spark;
PatternSpiral spiral;
int currentIndex = 0;
@ -89,29 +112,49 @@ class Patterns : public Playlist {
return currentIndex;
}
const static int PATTERN_COUNT = 18;
const static int PATTERN_COUNT = 14;
Drawable* shuffledItems[PATTERN_COUNT];
Drawable* items[PATTERN_COUNT] = {
&fireKoz, // added by Kosso
&spiro,
&life,
// &patternTest, // ok
&spiro, // cool
// &paletteSmear, // fail
// &multipleStream, // fail
// &multipleStream8,// fail
// &multipleStream5,// fail
// &multipleStream3,// fail
// &radar, // fail
// &multipleStream4, // fail
// &multipleStream2, // fail
&life, // ok
&flowField,
&pendulumWave,
&incrementalDrift,
&munch,
&electricMandala,
&simplexNoise,
&wave,
&attract,
&swirl,
&flock,
&plasma,
&snake,
&fire,
&maze,
&spiral,
&pendulumWave, //11 ok
&incrementalDrift, //12 ok
&incrementalDrift2, // 13 fail
&munch, // 14 ok
// &electricMandala, // 15 ok, but ugly (vortigont)
// &spin, // 16 ok but repeditivev
// &simplexNoise, // 17 - cool!
// &wave, // 18 ok (can't work with 256+ matrix due to uint8_t vars)
// &rainbowFlag, //20 // fail
&attract, // 21 ok
// &swirl, // 22 ok, but ugly (vortigont)
// &bounce, // boncing line crap
&flock, // works
&infinity, // works
&plasma, // works
// &invadersSmall, // works ish, but ugly (vortigont)
// &invadersMedium, // fail
// &invadersLarge, // fail
&snake, // ok
// &cube, // works ish
// &fire, // ok ish
&maze, // ok
// &pulse,// fail
// &spark, // same as fire
&spiral, // ok
};
public:
@ -212,11 +255,6 @@ class Patterns : public Playlist {
Serial.println("}");
}
int getPatternIndex()
{
return currentIndex;
}
char * getCurrentPatternName()
{
return currentItem->name;