Compare commits
No commits in common. "9e2d2b39f0aa7de5c714c1b16ef17921a4dd15e8" and "661d7544889150c84fbb6eab0fe1c4ad94b96bfd" have entirely different histories.
9e2d2b39f0
...
661d754488
28
README.md
28
README.md
|
@ -16,34 +16,6 @@ form different ideas about what it's displaying.
|
||||||
That's cool.
|
That's cool.
|
||||||
|
|
||||||
|
|
||||||
Network Server
|
|
||||||
--------------
|
|
||||||
|
|
||||||
If you provide a wallart server in
|
|
||||||
`network-server.h`,
|
|
||||||
the program will periodically fetch an image/animation from it,
|
|
||||||
and display that image/animation.
|
|
||||||
|
|
||||||
Because the fetch takes some time,
|
|
||||||
one of the animation patterns actually shows progress of the fetch.
|
|
||||||
It's the one with the four lights of the same color.
|
|
||||||
After it's either succeeded or failed,
|
|
||||||
it stays on that color for a while,
|
|
||||||
so you can tell how everything is going.
|
|
||||||
Here's what the colors indicate:
|
|
||||||
|
|
||||||
Color it stays on | Status
|
|
||||||
--- | ---
|
|
||||||
Blue | Unable to connect to access point
|
|
||||||
Aqua | Some sort of problem initiating the HTTPS request (DNS?)
|
|
||||||
Green | HTTPS server request failed (404 or similar)
|
|
||||||
Yellow | Image download failed
|
|
||||||
Orange | Everything worked!
|
|
||||||
|
|
||||||
A happy setup will cycle through each color once,
|
|
||||||
and then display orange for a while.
|
|
||||||
|
|
||||||
|
|
||||||
Philosophy
|
Philosophy
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Define these to fetch from a wallart-server
|
|
||||||
*
|
|
||||||
* https://git.woozle.org/neale/wallart-server
|
|
||||||
*/
|
|
||||||
#define ART_HOSTNAME "www.woozle.org"
|
|
||||||
#define ART_PORT 443
|
|
||||||
#define ART_PATH "/wallart/wallart.bin"
|
|
67
wallart.ino
67
wallart.ino
|
@ -3,12 +3,15 @@
|
||||||
#include <WiFiClientSecure.h>
|
#include <WiFiClientSecure.h>
|
||||||
#include "picker.h"
|
#include "picker.h"
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include "network-server.h"
|
|
||||||
|
|
||||||
#define NEOPIXEL_PIN 32
|
#define NEOPIXEL_PIN 32
|
||||||
#define GRIDLEN 64
|
#define GRIDLEN 64
|
||||||
#define WFM_PASSWORD "artsy fartsy"
|
#define WFM_PASSWORD "artsy fartsy"
|
||||||
|
|
||||||
|
#define ART_HOSTNAME "sweetums.woozle.org"
|
||||||
|
#define ART_PORT 443
|
||||||
|
#define ART_PATH "/public/wallart.bin"
|
||||||
|
|
||||||
#define MILLISECOND 1
|
#define MILLISECOND 1
|
||||||
#define SECOND (1000 * MILLISECOND)
|
#define SECOND (1000 * MILLISECOND)
|
||||||
|
|
||||||
|
@ -18,9 +21,7 @@ CRGB grid[GRIDLEN];
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
FastLED.addLeds<WS2812, NEOPIXEL_PIN, GRB>(grid, GRIDLEN);
|
FastLED.addLeds<WS2812, NEOPIXEL_PIN, GRB>(grid, GRIDLEN);
|
||||||
FastLED.setBrightness(64);
|
FastLED.setBrightness(32);
|
||||||
// Maybe it's the plexiglass but for my build I really need to dial back the red
|
|
||||||
FastLED.setCorrection(0xc0ffff);
|
|
||||||
network_setup(WFM_PASSWORD);
|
network_setup(WFM_PASSWORD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,8 +30,7 @@ void fade(int cycles = 2) {
|
||||||
int hue = random(256);
|
int hue = random(256);
|
||||||
for (int i = 0; i < reps; i++) {
|
for (int i = 0; i < reps; i++) {
|
||||||
for (int pos = 0; pos < 8; pos++) {
|
for (int pos = 0; pos < 8; pos++) {
|
||||||
uint8_t p = cm5xlat(8, (i+pos) % GRIDLEN);
|
grid[(i+pos) % GRIDLEN] = CHSV(hue, 255, pos * 32);
|
||||||
grid[p] = CHSV(hue, 255, pos * 32);
|
|
||||||
}
|
}
|
||||||
FastLED.show();
|
FastLED.show();
|
||||||
pause(80);
|
pause(80);
|
||||||
|
@ -123,28 +123,14 @@ void conwayish(int cycles=5000) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t cm5xlat(uint8_t width, uint8_t pos) {
|
void cm5(int cycles=200) {
|
||||||
if (width == 0) {
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t x = pos % width;
|
|
||||||
uint8_t y = pos / width;
|
|
||||||
uint8_t odd = y % 2;
|
|
||||||
|
|
||||||
return (y*width) + ((width-x-1)*odd) + (x*(1-odd));
|
|
||||||
}
|
|
||||||
|
|
||||||
void cm5(uint8_t width=0, int cycles=200) {
|
|
||||||
for (int frame = 0; frame < cycles; frame++) {
|
for (int frame = 0; frame < cycles; frame++) {
|
||||||
int val = 127 * random(2);
|
int val = 127 * random(2);
|
||||||
for (uint8_t pos = 0; pos < GRIDLEN; pos++) {
|
for (int pos = 0; pos < GRIDLEN; pos++) {
|
||||||
uint8_t xpos = cm5xlat(width, pos);
|
|
||||||
if (pos < GRIDLEN-1) {
|
if (pos < GRIDLEN-1) {
|
||||||
uint8_t x2pos = cm5xlat(width, pos+1);
|
grid[pos] = grid[pos + 1];
|
||||||
grid[xpos] = grid[x2pos];
|
|
||||||
} else {
|
} else {
|
||||||
grid[xpos] = CHSV(0, 255, val);
|
grid[pos] = CHSV(0, 255, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FastLED.show();
|
FastLED.show();
|
||||||
|
@ -183,28 +169,26 @@ uint8_t netgetStatus(uint8_t hue) {
|
||||||
void netget(int count=60) {
|
void netget(int count=60) {
|
||||||
uint8_t hue = netgetStatus(HUE_BLUE);
|
uint8_t hue = netgetStatus(HUE_BLUE);
|
||||||
|
|
||||||
#if defined(ART_HOSTNAME) && defined(ART_PORT) && defined(ART_PATH)
|
|
||||||
if (connected()) {
|
if (connected()) {
|
||||||
WiFiClientSecure scli;
|
WiFiClientSecure scli;
|
||||||
|
|
||||||
hue = netgetStatus(HUE_AQUA);
|
hue = netgetStatus(hue - 32);
|
||||||
scli.setInsecure();
|
scli.setInsecure();
|
||||||
|
|
||||||
HttpClient https(scli, ART_HOSTNAME, ART_PORT);
|
HttpClient https(scli, ART_HOSTNAME, ART_PORT);
|
||||||
do {
|
do {
|
||||||
if (https.get(ART_PATH) != 0) break;
|
if (https.get(ART_PATH) != 0) break;
|
||||||
hue = netgetStatus(HUE_GREEN);
|
hue = netgetStatus(hue - 32);
|
||||||
|
|
||||||
if (https.skipResponseHeaders() != HTTP_SUCCESS) break;
|
if (https.skipResponseHeaders() != HTTP_SUCCESS) break;
|
||||||
hue = netgetStatus(HUE_YELLOW);
|
hue = netgetStatus(hue - 32);
|
||||||
|
|
||||||
int artlen = https.read((uint8_t *)NetArt, sizeof(NetArt));
|
int artlen = https.read((uint8_t *)NetArt, sizeof(NetArt));
|
||||||
hue = netgetStatus(HUE_ORANGE);
|
hue = netgetStatus(hue - 32);
|
||||||
NetArtFrames = (artlen / 3) / GRIDLEN;
|
NetArtFrames = (artlen / 3) / GRIDLEN;
|
||||||
} while(false);
|
} while(false);
|
||||||
https.stop();
|
https.stop();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
netgetStatus(hue);
|
netgetStatus(hue);
|
||||||
|
@ -224,17 +208,8 @@ void spinner(int count=32) {
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
Picker p;
|
Picker p;
|
||||||
uint8_t getprob = 4;
|
|
||||||
|
|
||||||
if ((NetArtFrames == 0) || !connected()) {
|
if (p.Pick(1)) {
|
||||||
getprob = 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p.Pick(getprob)) {
|
|
||||||
netget();
|
|
||||||
} else if (p.Pick(4)) {
|
|
||||||
netart();
|
|
||||||
} else if (p.Pick(1)) {
|
|
||||||
fade();
|
fade();
|
||||||
singleCursor(20);
|
singleCursor(20);
|
||||||
} else if (p.Pick(1)) {
|
} else if (p.Pick(1)) {
|
||||||
|
@ -245,11 +220,11 @@ void loop() {
|
||||||
conwayish();
|
conwayish();
|
||||||
} else if (p.Pick(8)) {
|
} else if (p.Pick(8)) {
|
||||||
glitchPulse();
|
glitchPulse();
|
||||||
} else if (p.Pick(2)) {
|
} else if (p.Pick(8)) {
|
||||||
cm5(0);
|
cm5();
|
||||||
} else if (p.Pick(2)) {
|
} else if (p.Pick(8)) {
|
||||||
cm5(8);
|
netart();
|
||||||
} else if (p.Pick(2)) {
|
} else if (p.Pick(4) || !connected()) {
|
||||||
cm5(16);
|
netget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue