Commit ae8f81d1 authored by Nick Price's avatar Nick Price

fix

parent e05d9414
...@@ -23,6 +23,19 @@ void rainbow(int count) ...@@ -23,6 +23,19 @@ void rainbow(int count)
} }
} }
void wiper(int count)
{
for (int x = 0; x < count; x++)
{
tft.setRotation(random(0, 4));
if(random(0,2) == 1) {
tft.fillScreen(ST77XX_WHITE);
} else {
tft.fillScreen(ST77XX_BLACK);
}
}
}
void text(int count) void text(int count)
{ {
tft.fillScreen(ST77XX_BLACK); tft.fillScreen(ST77XX_BLACK);
...@@ -38,9 +51,9 @@ void randomize() ...@@ -38,9 +51,9 @@ void randomize()
{ {
tft.fillScreen(ST77XX_BLACK); tft.fillScreen(ST77XX_BLACK);
//this is hacky but the display will just drop pixels it doesn't have lol //this is hacky but the display will just drop pixels it doesn't have lol
for (int x = 0; x < 160; x++) for (int x = 0; x < HEIGHT; x++)
{ {
for (int y = 0; y < 160; y++) for (int y = 0; y < HEIGHT; y++)
{ {
tft.startWrite(); tft.startWrite();
tft.writePixel(x, y, random(0, 65535)); tft.writePixel(x, y, random(0, 65535));
...@@ -52,11 +65,11 @@ void randomize() ...@@ -52,11 +65,11 @@ void randomize()
void rule30() void rule30()
{ {
uint16_t color = random(0, 65536); uint16_t color = random(0, 65536);
int prev_row[128]; int prev_row[WIDTH];
tft.setRotation(0); tft.setRotation(0);
tft.fillScreen(ST77XX_BLACK); tft.fillScreen(ST77XX_BLACK);
//initial seed //initial seed
for (int x = 0; x < 128; x++) for (int x = 0; x < WIDTH; x++)
{ {
tft.startWrite(); tft.startWrite();
if (random(0, 2) == 0) if (random(0, 2) == 0)
...@@ -73,12 +86,12 @@ void rule30() ...@@ -73,12 +86,12 @@ void rule30()
} }
//100 011 010 001 //100 011 010 001
for (int y = 1; y < 160; y++) for (int y = 1; y < HEIGHT; y++)
{ {
int a, b, c; int a, b, c;
int this_row[128]; int this_row[WIDTH];
for (int x = 0; x < 128; x++) for (int x = 0; x < WIDTH; x++)
{ {
a = x - 1; a = x - 1;
b = x; b = x;
...@@ -87,7 +100,7 @@ void rule30() ...@@ -87,7 +100,7 @@ void rule30()
{ {
a = 127; a = 127;
} }
if (c == 128) if (c == WIDTH)
{ {
c = 0; c = 0;
} }
...@@ -101,23 +114,20 @@ void rule30() ...@@ -101,23 +114,20 @@ void rule30()
{ {
this_row[x] = 1; this_row[x] = 1;
tft.writePixel(x, y, color); tft.writePixel(x, y, color);
continue; } else {
this_row[x] = 0;
tft.writePixel(x, y, ST77XX_BLACK);
} }
this_row[x] = 0;
tft.writePixel(x, y, ST77XX_BLACK);
tft.endWrite(); tft.endWrite();
} }
for (int i=0; i<128; i++) { for (int i=0; i<WIDTH; i++) {
prev_row[i] = this_row[i]; prev_row[i] = this_row[i];
} }
} }
} }
void rotate() {
}
void setup() void setup()
{ {
tft.initR(INITR_BLACKTAB); tft.initR(INITR_BLACKTAB);
...@@ -159,4 +169,5 @@ void loop() ...@@ -159,4 +169,5 @@ void loop()
randomize(); randomize();
delay(200); delay(200);
rainbow(35); rainbow(35);
wiper(35);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment