forked from forkineye/ESPixelStick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ESPixelStick.h
80 lines (68 loc) · 3 KB
/
ESPixelStick.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* ESPixelStick.h
*
* Project: ESPixelStick - An ESP8266 and E1.31 based pixel driver
* Copyright (c) 2015 Shelby Merrick
* http://www.forkineye.com
*
* This program is provided free for you to use in any way that you wish,
* subject to the laws and regulations where you are using it. Due diligence
* is strongly suggested before using this code. Please give credit where due.
*
* The Author makes no warranty of any kind, express or implied, with regard
* to this program or the documentation contained in this document. The
* Author shall not be liable in any event for incidental or consequential
* damages in connection with, or arising out of, the furnishing, performance
* or use of these programs.
*
*/
#ifndef ESPIXELSTICK_H
#define ESPIXELSTICK_H
#include "ESPixelDriver.h"
#include "_E131.h"
/* Name and version */
const char VERSION[] PROGMEM = "1.2 beta";
#define HTTP_PORT 80 /* Default web server port */
#define DATA_PIN 2 /* Pixel output - GPIO2 */
#define EEPROM_BASE 0 /* EEPROM configuration base address */
#define UNIVERSE_LIMIT 510 /* Universe boundary - 510 Channels */
#define PPU_MAX 170 /* Max pixels per Universe */
#define PIXEL_LIMIT 1360 /* Total pixel limit - 40.85ms for 8 universes */
#define E131_TIMEOUT 1000 /* Force refresh every second an E1.31 packet is not seen */
#define CONNECT_TIMEOUT 10000 /* 10 seconds */
/* Configuration ID and Version */
#define CONFIG_VERSION 2
const uint8_t CONFIG_ID[4] PROGMEM = { 'F', 'O', 'R', 'K'};
/* Configuration structure */
typedef struct {
/* header */
uint8_t id[4]; /* Configuration structure ID */
uint8_t version; /* Configuration structure version */
/* general config */
char name[32]; /* Device Name */
/* network config */
char ssid[32]; /* 31 bytes max - null terminated */
char passphrase[64]; /* 63 bytes max - null terminated */
uint8_t ip[4];
uint8_t netmask[4];
uint8_t gateway[4];
uint8_t dhcp; /* DHCP enabled boolean */
uint8_t multicast; /* Multicast listener enabled boolean */
/* dmx and pixel config */
uint16_t universe; /* Universe to listen for */
uint16_t channel_start; /* Channel to start listening at - 1 based */
uint16_t pixel_count; /* Number of pixels */
pixel_t pixel_type; /* Pixel type */
color_t pixel_color; /* Pixel color order */
uint8_t ppu; /* Pixels per Universe boundary - Max PIXELS_MAX (Default 170) */
float gamma; /* Value used to build gamma correction table */
} __attribute__((packed)) config_t;
/* Globals */
E131 e131;
ESP8266WebServer web(HTTP_PORT);
config_t config;
uint32_t *seqError; /* Sequence error tracking for each universe */
uint16_t uniLast = 1; /* Last Universe to listen for */
void saveConfig();
void updatePixelConfig();
#endif