Commit ae8f81d1 authored by Nick Price's avatar Nick Price

fix

parent e05d9414
......@@ -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)
{
tft.fillScreen(ST77XX_BLACK);
......@@ -38,9 +51,9 @@ void randomize()
{
tft.fillScreen(ST77XX_BLACK);
//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.writePixel(x, y, random(0, 65535));
......@@ -52,11 +65,11 @@ void randomize()
void rule30()
{
uint16_t color = random(0, 65536);
int prev_row[128];
int prev_row[WIDTH];
tft.setRotation(0);
tft.fillScreen(ST77XX_BLACK);
//initial seed
for (int x = 0; x < 128; x++)
for (int x = 0; x < WIDTH; x++)
{
tft.startWrite();
if (random(0, 2) == 0)
......@@ -73,12 +86,12 @@ void rule30()
}
//100 011 010 001
for (int y = 1; y < 160; y++)
for (int y = 1; y < HEIGHT; y++)
{
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;
b = x;
......@@ -87,7 +100,7 @@ void rule30()
{
a = 127;
}
if (c == 128)
if (c == WIDTH)
{
c = 0;
}
......@@ -101,23 +114,20 @@ void rule30()
{
this_row[x] = 1;
tft.writePixel(x, y, color);
continue;
}
} else {
this_row[x] = 0;
tft.writePixel(x, y, ST77XX_BLACK);
}
tft.endWrite();
}
for (int i=0; i<128; i++) {
for (int i=0; i<WIDTH; i++) {
prev_row[i] = this_row[i];
}
}
}
void rotate() {
}
void setup()
{
tft.initR(INITR_BLACKTAB);
......@@ -159,4 +169,5 @@ void loop()
randomize();
delay(200);
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