Compare commits
No commits in common. "master" and "flame" have entirely different histories.
@ -1,21 +0,0 @@
|
|||||||
# Uncomment lines below if you have problems with $PATH
|
|
||||||
#SHELL := /bin/bash
|
|
||||||
#PATH := /usr/local/bin:$(PATH)
|
|
||||||
|
|
||||||
all:
|
|
||||||
pio.exe -f -c vim run
|
|
||||||
|
|
||||||
upload:
|
|
||||||
pio.exe -f -c vim run --target upload
|
|
||||||
|
|
||||||
clean:
|
|
||||||
pio.exe -f -c vim run --target clean
|
|
||||||
|
|
||||||
program:
|
|
||||||
pio.exe -f -c vim run --target program
|
|
||||||
|
|
||||||
uploadfs:
|
|
||||||
pio.exe -f -c vim run --target uploadfs
|
|
||||||
|
|
||||||
update:
|
|
||||||
pio.exe -f -c vim update
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
; PlatformIO Project Configuration File
|
|
||||||
;
|
|
||||||
; Build options: build flags, source filter
|
|
||||||
; Upload options: custom upload port, speed and extra flags
|
|
||||||
; Library options: dependencies, extra library storages
|
|
||||||
; Advanced options: extra scripting
|
|
||||||
;
|
|
||||||
; Please visit documentation for the other options and examples
|
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
|
||||||
|
|
||||||
[env:adafruit_matrixportal_esp32s3]
|
|
||||||
platform = espressif32
|
|
||||||
board = adafruit_matrixportal_esp32s3
|
|
||||||
framework = arduino
|
|
||||||
monitor_speed = 115200
|
|
||||||
|
|
||||||
lib_deps =
|
|
||||||
adafruit/Adafruit GFX Library
|
|
||||||
adafruit/Adafruit BusIO
|
|
||||||
Wire
|
|
||||||
fastled/FastLED
|
|
||||||
https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA.git
|
|
||||||
bitbank2/AnimatedGIF
|
|
||||||
bblanchon/ArduinoJson
|
|
||||||
|
|
||||||
build_flags =
|
|
||||||
-DS3_LCD_DIV_NUM=20
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import json
|
|
||||||
import datetime
|
|
||||||
import requests
|
|
||||||
|
|
||||||
from http.server import ThreadingHTTPServer, BaseHTTPRequestHandler
|
|
||||||
|
|
||||||
def run():
|
|
||||||
schedule = requests.get('https://api.events.ccc.de/congress/2025/schedule.json').json() # json.load(open('schedule.json', 'r'))
|
|
||||||
talks = []
|
|
||||||
for day in schedule['schedule']['conference']['days']:
|
|
||||||
for room in ['Zero', 'One', 'Fuse', 'Ground']: #day['rooms']:
|
|
||||||
talks += day['rooms'][room]
|
|
||||||
|
|
||||||
|
|
||||||
talks.sort(key=lambda talk: talk['date'])
|
|
||||||
now = datetime.datetime.now()
|
|
||||||
|
|
||||||
upcoming = []
|
|
||||||
for talk in talks:
|
|
||||||
if datetime.datetime.fromisoformat(talk['date']).timestamp() < now.timestamp():
|
|
||||||
continue
|
|
||||||
upcoming.append({'start': talk['start'], 'room': talk['room'], 'title': talk['title']})
|
|
||||||
|
|
||||||
return json.dumps(upcoming)
|
|
||||||
|
|
||||||
|
|
||||||
class Handler(BaseHTTPRequestHandler):
|
|
||||||
def do_GET(self):
|
|
||||||
data = run().encode("utf-8")
|
|
||||||
self.send_response(200)
|
|
||||||
self.send_header("Content-Type", "text/plain; charset=utf-8")
|
|
||||||
self.send_header("Content-Length", str(len(data)))
|
|
||||||
self.end_headers()
|
|
||||||
self.wfile.write(data)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
server = ThreadingHTTPServer(("0.0.0.0", 8000), Handler)
|
|
||||||
server.serve_forever()
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
// config.h
|
|
||||||
|
|
||||||
#define DISPLAY_DURATION 10000
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
#define R1 42
|
|
||||||
#define G1 40
|
|
||||||
#define BL1 41
|
|
||||||
#define R2 38
|
|
||||||
#define G2 37
|
|
||||||
#define BL2 39
|
|
||||||
#define CH_A 45
|
|
||||||
#define CH_B 36
|
|
||||||
#define CH_C 48
|
|
||||||
#define CH_D 35
|
|
||||||
#define CH_E 21
|
|
||||||
#define CLK 2
|
|
||||||
#define LAT 47
|
|
||||||
#define OE 14
|
|
||||||
|
|
||||||
#define PIN_E 21
|
|
||||||
#define PANEL_WIDTH 64
|
|
||||||
#define PANEL_HEIGHT 32 // Panel height of 64 will required PIN_E to be defined.
|
|
||||||
|
|
||||||
#define PANELS_NUMBER 1
|
|
||||||
|
|
||||||
#define PANE_WIDTH PANEL_WIDTH * PANELS_NUMBER
|
|
||||||
#define PANE_HEIGHT PANEL_HEIGHT
|
|
||||||
#define NUM_LEDS PANE_WIDTH*PANE_HEIGHT
|
|
||||||
|
|
||||||
#define ONBOARD_LED 13
|
|
||||||
@ -1,269 +0,0 @@
|
|||||||
#include <Arduino.h>
|
|
||||||
#include <ArduinoJson.h>
|
|
||||||
#include <WiFi.h>
|
|
||||||
#include <HTTPClient.h>
|
|
||||||
#include "xtensa/core-macros.h"
|
|
||||||
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
|
|
||||||
|
|
||||||
#include <AnimatedGIF.h>
|
|
||||||
|
|
||||||
#include "main.h"
|
|
||||||
#include "constants.h"
|
|
||||||
#include "config.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "pp.h"
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
MatrixPanel_I2S_DMA *matrix = nullptr;
|
|
||||||
AnimatedGIF gif;
|
|
||||||
WiFiClientSecure client;
|
|
||||||
HTTPClient http;
|
|
||||||
DynamicJsonDocument doc(32768);
|
|
||||||
|
|
||||||
long lastrefresh = 0;
|
|
||||||
bool firstRequest = true;
|
|
||||||
|
|
||||||
int current_index = 0;
|
|
||||||
long last_index_change = 0;
|
|
||||||
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
Serial.begin(BAUD_RATE);
|
|
||||||
// while (!Serial) {
|
|
||||||
// ; // wait for serial port to connect. Needed for native USB
|
|
||||||
// }
|
|
||||||
pinMode(ONBOARD_LED, OUTPUT);
|
|
||||||
|
|
||||||
// redefine pins if required
|
|
||||||
HUB75_I2S_CFG::i2s_pins _pins={R1, G1, BL1, R2, G2, BL2, CH_A, CH_B, CH_C, CH_D, CH_E, LAT, OE, CLK};
|
|
||||||
HUB75_I2S_CFG mxconfig(PANEL_WIDTH, PANEL_HEIGHT, PANELS_NUMBER, _pins);
|
|
||||||
|
|
||||||
mxconfig.gpio.e = PIN_E;
|
|
||||||
mxconfig.driver = HUB75_I2S_CFG::FM6126A; // for panels using FM6126A chips
|
|
||||||
|
|
||||||
mxconfig.latch_blanking = 4;
|
|
||||||
mxconfig.i2sspeed = HUB75_I2S_CFG::HZ_10M;
|
|
||||||
mxconfig.clkphase = false;
|
|
||||||
|
|
||||||
// mxconfig.double_buff = true;
|
|
||||||
|
|
||||||
matrix = new MatrixPanel_I2S_DMA(mxconfig);
|
|
||||||
matrix->begin();
|
|
||||||
matrix->setBrightness8(255);
|
|
||||||
matrix->fillScreenRGB888(0, 0, 0);
|
|
||||||
|
|
||||||
gif.begin(LITTLE_ENDIAN_PIXELS);
|
|
||||||
|
|
||||||
matrix->setCursor(0, 0);
|
|
||||||
char ssid[] = "YOUR_SSID";
|
|
||||||
char pw[] = "YOUR_PSK";
|
|
||||||
matrix->print(ssid);
|
|
||||||
//Serial.print("Connecting");
|
|
||||||
WiFi.begin(ssid, pw);
|
|
||||||
// WiFi.begin(ssid, NULL);
|
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
|
||||||
delay(500);
|
|
||||||
matrix->fillScreenRGB888(0, 0, 0);
|
|
||||||
matrix->setCursor(0, 0);
|
|
||||||
matrix->print(WiFi.status());
|
|
||||||
//Serial.print(".");
|
|
||||||
}
|
|
||||||
matrix->fillScreenRGB888(0, 0, 0);
|
|
||||||
|
|
||||||
client.setInsecure();
|
|
||||||
http.useHTTP10(true);
|
|
||||||
http.begin(client, "https://www.theresno.cloud/schedhelp");
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw_title(const std::string& title, uint16_t color) {
|
|
||||||
int y_pos = 0;
|
|
||||||
int x_pos = 0;
|
|
||||||
//matrix->setCursor(x_pos, y_pos);
|
|
||||||
for (size_t idx = 0; idx < title.size(); idx++) {
|
|
||||||
char current = title[idx];
|
|
||||||
if (current != ' ') {
|
|
||||||
if (current == 'I') {
|
|
||||||
x_pos -=1;
|
|
||||||
}
|
|
||||||
matrix->drawChar(x_pos, y_pos, current, color, matrix->color444(0,0,0), 1);
|
|
||||||
if (current == 'I') {
|
|
||||||
x_pos += 5;
|
|
||||||
} else {
|
|
||||||
x_pos += 6; // char width + 1px gap
|
|
||||||
}
|
|
||||||
} else if (x_pos != 0) {
|
|
||||||
x_pos += 2; // small space
|
|
||||||
}
|
|
||||||
|
|
||||||
if (y_pos >= 16 && x_pos >= (63 - 6)) {
|
|
||||||
// ellipsis
|
|
||||||
matrix->drawPixel(x_pos, y_pos + 6, color);
|
|
||||||
matrix->drawPixel(x_pos + 2, y_pos + 6, color);
|
|
||||||
matrix->drawPixel(x_pos + 4, y_pos + 6, color);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (x_pos > (63 - 5)) { // new line
|
|
||||||
if (current != ' ') {
|
|
||||||
matrix->drawChar(x_pos, y_pos, '-', color, matrix->color444(0,0,0), 1);
|
|
||||||
}
|
|
||||||
x_pos = 0;
|
|
||||||
y_pos = y_pos + 8; //char height + 1px
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw_time(const std::string &time) {
|
|
||||||
int x_pos = 0;
|
|
||||||
int y_pos = 32 - 7;
|
|
||||||
|
|
||||||
for (size_t idx = 0; idx < time.size(); idx++) {
|
|
||||||
char current = time[idx];
|
|
||||||
int offset = 0;
|
|
||||||
switch (current) {
|
|
||||||
case '1':
|
|
||||||
offset = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (current == ':') {
|
|
||||||
matrix->drawPixel(x_pos, y_pos + 2, matrix->color565(255,255,255));
|
|
||||||
matrix->drawPixel(x_pos, y_pos + 4, matrix->color565(255,255,255));
|
|
||||||
x_pos = x_pos + 2;
|
|
||||||
} else {
|
|
||||||
x_pos = x_pos - offset;
|
|
||||||
matrix->drawChar(x_pos, y_pos, current, matrix->color565(255,255,255), matrix->color444(0,0,0), 1);
|
|
||||||
x_pos = x_pos + (6 - offset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw_location(const std::string &location) {
|
|
||||||
int pixel_size = (location.size() * 6) - 1;
|
|
||||||
matrix->setCursor(63 - pixel_size, 32 - 7);
|
|
||||||
matrix->print(location.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GIFDraw(GIFDRAW *pDraw) {
|
|
||||||
uint8_t *s;
|
|
||||||
uint16_t *d, *usPalette, usTemp[320];
|
|
||||||
int x, y, iWidth;
|
|
||||||
|
|
||||||
usPalette = pDraw->pPalette;
|
|
||||||
y = pDraw->iY + pDraw->y; // current line
|
|
||||||
|
|
||||||
s = pDraw->pPixels;
|
|
||||||
if (pDraw->ucDisposalMethod == 2) // restore to background color
|
|
||||||
{
|
|
||||||
for (x = 0; x < iWidth; x++)
|
|
||||||
{
|
|
||||||
if (s[x] == pDraw->ucTransparent)
|
|
||||||
s[x] = pDraw->ucBackground;
|
|
||||||
}
|
|
||||||
pDraw->ucHasTransparency = 0;
|
|
||||||
}
|
|
||||||
// Apply the new pixels to the main image
|
|
||||||
if (pDraw->ucHasTransparency) // if transparency used
|
|
||||||
{
|
|
||||||
// Serial.println("Transparency!");
|
|
||||||
uint8_t *pEnd, c, ucTransparent = pDraw->ucTransparent;
|
|
||||||
int x, iCount;
|
|
||||||
pEnd = s + pDraw->iWidth;
|
|
||||||
//x = 0;
|
|
||||||
x = pDraw->iX;
|
|
||||||
iCount = 0; // count non-transparent pixels
|
|
||||||
while (x < pDraw->iWidth)
|
|
||||||
{
|
|
||||||
c = ucTransparent - 1;
|
|
||||||
d = usTemp;
|
|
||||||
while (c != ucTransparent && s < pEnd)
|
|
||||||
{
|
|
||||||
c = *s++;
|
|
||||||
if (c == ucTransparent) // done, stop
|
|
||||||
{
|
|
||||||
s--; // back up to treat it like transparent
|
|
||||||
}
|
|
||||||
else // opaque
|
|
||||||
{
|
|
||||||
*d++ = usPalette[c];
|
|
||||||
iCount++;
|
|
||||||
}
|
|
||||||
} // while looking for opaque pixels
|
|
||||||
if (iCount) // any opaque pixels?
|
|
||||||
{
|
|
||||||
for (int xOffset = 0; xOffset < iCount; xOffset++)
|
|
||||||
{
|
|
||||||
matrix->drawPixel(28 + x + xOffset, 27 + y, usTemp[xOffset]);
|
|
||||||
}
|
|
||||||
x += iCount;
|
|
||||||
iCount = 0;
|
|
||||||
}
|
|
||||||
// no, look for a run of transparent pixels
|
|
||||||
c = ucTransparent;
|
|
||||||
while (c == ucTransparent && s < pEnd)
|
|
||||||
{
|
|
||||||
c = *s++;
|
|
||||||
if (c == ucTransparent)
|
|
||||||
iCount++;
|
|
||||||
else
|
|
||||||
s--;
|
|
||||||
}
|
|
||||||
if (iCount)
|
|
||||||
{
|
|
||||||
x += iCount; // skip these
|
|
||||||
iCount = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s = pDraw->pPixels;
|
|
||||||
// Translate the 8-bit pixels through the RGB565 palette (already byte reversed)
|
|
||||||
for (x = 0; x < pDraw->iWidth; x++)
|
|
||||||
{
|
|
||||||
matrix->drawPixel(28 + x, 27 + y, usPalette[*s++]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
if(firstRequest || (millis() - lastrefresh > 120000)) {
|
|
||||||
http.GET();
|
|
||||||
|
|
||||||
DeserializationError error = deserializeJson(doc, http.getStream());
|
|
||||||
if (error) {
|
|
||||||
//Serial.print(F("deserializeJson() failed: "));
|
|
||||||
//Serial.println(error.f_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
lastrefresh = millis();
|
|
||||||
firstRequest = false;
|
|
||||||
}
|
|
||||||
const char *j_title = doc[current_index]["title"];
|
|
||||||
const char *j_time = doc[current_index]["start"];
|
|
||||||
const char *j_room = doc[current_index]["room"];
|
|
||||||
|
|
||||||
std::string title(j_title); //= "THE ART OF TEXT RE:NDERING";
|
|
||||||
std::string time(j_time); // = "11:00";
|
|
||||||
std::string loc(j_room); //= "GRND";
|
|
||||||
//draw_title(title, matrix->color565(249, 176, 0));
|
|
||||||
draw_title(title, matrix->color565(doc[current_index]["r"], doc[current_index]["g"], doc[current_index]["b"]));
|
|
||||||
draw_time(time);
|
|
||||||
draw_location(loc);
|
|
||||||
|
|
||||||
|
|
||||||
if (gif.open((uint8_t *)reallytinypp, sizeof(reallytinypp), GIFDraw)) {
|
|
||||||
while (gif.playFrame(true, NULL)) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
gif.close();
|
|
||||||
}
|
|
||||||
if (millis() - last_index_change > DISPLAY_DURATION ) {
|
|
||||||
current_index++;
|
|
||||||
if (current_index > 4) {
|
|
||||||
current_index = 0;
|
|
||||||
}
|
|
||||||
last_index_change = millis();
|
|
||||||
matrix->fillScreenRGB888(0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
#include <FastLED.h>
|
|
||||||
|
|
||||||
#define BAUD_RATE 115200 // serial debug port baud rate
|
|
||||||
|
|
||||||
void buffclear(CRGB *buf);
|
|
||||||
uint16_t XY16( uint16_t x, uint16_t y);
|
|
||||||
void mxfill(CRGB *leds);
|
|
||||||
uint16_t colorWheel(uint8_t pos);
|
|
||||||
void drawText(int colorWheelOffset);
|
|
||||||
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
// Created with image_to_c
|
|
||||||
// https://github.com/bitbank2/image_to_c
|
|
||||||
//
|
|
||||||
// reallytinypp
|
|
||||||
// Data size = 251 bytes
|
|
||||||
//
|
|
||||||
// GIF, Compression=LZW, Size: 7 x 5, 3-Bpp
|
|
||||||
// 4 frames
|
|
||||||
//
|
|
||||||
// for non-Arduino builds...
|
|
||||||
#ifndef PROGMEM
|
|
||||||
#define PROGMEM
|
|
||||||
#endif
|
|
||||||
const uint8_t reallytinypp[] PROGMEM = {
|
|
||||||
0x47,0x49,0x46,0x38,0x39,0x61,0x07,0x00,0x05,0x00,0xf2,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x20,0x67,0x2c,0xee,0x00,0x00,0x06,0x94,0x20,0x1b,0x4c,0x85,0x1f,0x54,0x90,0xff,
|
|
||||||
0xff,0xff,0x00,0x00,0x00,0x21,0xff,0x0b,0x4e,0x45,0x54,0x53,0x43,0x41,0x50,0x45,
|
|
||||||
0x32,0x2e,0x30,0x03,0x01,0x00,0x00,0x00,0x21,0xfe,0x27,0x47,0x49,0x46,0x20,0x63,
|
|
||||||
0x72,0x6f,0x70,0x70,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x68,0x74,0x74,0x70,
|
|
||||||
0x73,0x3a,0x2f,0x2f,0x65,0x7a,0x67,0x69,0x66,0x2e,0x63,0x6f,0x6d,0x2f,0x63,0x72,
|
|
||||||
0x6f,0x70,0x00,0x21,0xf9,0x04,0x05,0x1e,0x00,0x07,0x00,0x2c,0x00,0x00,0x00,0x00,
|
|
||||||
0x07,0x00,0x05,0x00,0x00,0x03,0x0f,0x78,0x17,0xb3,0x1d,0x06,0x8c,0xc8,0x84,0xb5,
|
|
||||||
0x6c,0x68,0x4d,0x8a,0xff,0x09,0x00,0x21,0xf9,0x04,0x05,0x0a,0x00,0x00,0x00,0x2c,
|
|
||||||
0x00,0x00,0x00,0x00,0x07,0x00,0x05,0x00,0x00,0x02,0x07,0x84,0x7f,0x33,0xa0,0xe8,
|
|
||||||
0xff,0x0a,0x00,0x21,0xf9,0x04,0x05,0x1e,0x00,0x01,0x00,0x2c,0x00,0x00,0x00,0x00,
|
|
||||||
0x07,0x00,0x05,0x00,0x00,0x03,0x08,0x18,0xba,0x0b,0x16,0x8e,0xc9,0x39,0x13,0x00,
|
|
||||||
0x21,0xf9,0x04,0x05,0x46,0x00,0x01,0x00,0x2c,0x00,0x00,0x00,0x00,0x07,0x00,0x05,
|
|
||||||
0x00,0x00,0x03,0x08,0x18,0xba,0x6b,0x10,0x8e,0xc9,0x39,0x13,0x00,0x21,0xf9,0x04,
|
|
||||||
0x05,0x32,0x00,0x01,0x00,0x2c,0x00,0x00,0x00,0x00,0x07,0x00,0x05,0x00,0x00,0x03,
|
|
||||||
0x08,0x18,0xba,0x0b,0x16,0x8e,0xc9,0x39,0x13,0x00,0x3b};
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
#include "constants.h"
|
|
||||||
|
|
||||||
bool is_in_bounds(int x, int y) {
|
|
||||||
return (x < PANEL_WIDTH) and (y < PANEL_HEIGHT) and (x >= 0) and (y >= 0);
|
|
||||||
}
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
bool is_in_bounds(int x, int y);
|
|
||||||
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
#include "enums.h"
|
|
||||||
#include "constants.h"
|
|
||||||
DisplayStyle next_style(DisplayStyle style) {
|
|
||||||
switch(style) {
|
|
||||||
case Rain:
|
|
||||||
return Congress;
|
|
||||||
break;
|
|
||||||
case Congress:
|
|
||||||
return Supercomputer;
|
|
||||||
break;
|
|
||||||
case Supercomputer:
|
|
||||||
return Cyber;
|
|
||||||
break;
|
|
||||||
case Cyber:
|
|
||||||
return Flame;
|
|
||||||
break;
|
|
||||||
case Flame:
|
|
||||||
return Rain;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -20,7 +20,6 @@ Mode mode = HighVis;
|
|||||||
DisplayStyle style = Rain;
|
DisplayStyle style = Rain;
|
||||||
|
|
||||||
unsigned long last_switch;
|
unsigned long last_switch;
|
||||||
bool cycling = true;
|
|
||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
pinMode(ONBOARD_LED, OUTPUT);
|
pinMode(ONBOARD_LED, OUTPUT);
|
||||||
@ -53,8 +52,9 @@ void setup(){
|
|||||||
void loop() {
|
void loop() {
|
||||||
matrix ->flipDMABuffer();
|
matrix ->flipDMABuffer();
|
||||||
matrix->clearScreen();
|
matrix->clearScreen();
|
||||||
|
//delay(25);
|
||||||
|
|
||||||
if (cycling and millis() - last_switch > CYCLE_TIME_MS) {
|
if (millis() - last_switch > CYCLE_TIME_MS) {
|
||||||
// next style
|
// next style
|
||||||
style = next_style(style); //DisplayStyle((style + 1) % (NumStyles - 1));
|
style = next_style(style); //DisplayStyle((style + 1) % (NumStyles - 1));
|
||||||
last_switch = millis();
|
last_switch = millis();
|
||||||
@ -76,15 +76,8 @@ void loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!digitalRead(NEXT_BUTTON)) {
|
if(!digitalRead(NEXT_BUTTON)) {
|
||||||
unsigned long pressed_at = millis();
|
style = next_style(style);
|
||||||
while(!digitalRead(NEXT_BUTTON)); // Wait for release
|
while(!digitalRead(NEXT_BUTTON)); // Wait for release
|
||||||
// see if the button was held or tapped
|
|
||||||
if (millis() - pressed_at > 500) {
|
|
||||||
// todo
|
|
||||||
cycling = not cycling;
|
|
||||||
} else {
|
|
||||||
style = next_style(style);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(style) {
|
switch(style) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user