diff --git a/Changelog.md b/Changelog.md index b0f88bdaa..4b10057fc 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,10 +1,12 @@ Changelog ========= -### 2.1 +### 3.0-dev1 - Complete re-write of the web frontend. Requires a WebSockets capable browser. +- Migrated to ESPAsyncUDP for E131 parsing (E131 library updated). +- Increased WS2811 reset time from 50us to 300us to support newer WS2811 chips. +- Added hostname configuration. - Added GBR and BGR color order for pixels. -- Changed WS2811 reset time from 50us to 80us to better support WS2811 clones. ### 2.0 - Added web based OTA update capability. diff --git a/ESPixelStick.h b/ESPixelStick.h index 97a982342..b240dc0bb 100644 --- a/ESPixelStick.h +++ b/ESPixelStick.h @@ -27,7 +27,7 @@ #endif /* Name and version */ -const char VERSION[] = "3.0-dev (20170623)"; +const char VERSION[] = "3.0-dev1 (20170624)"; #define HTTP_PORT 80 /* Default web server port */ #define DATA_PIN 2 /* Pixel output - GPIO2 */ @@ -109,7 +109,7 @@ typedef struct { } config_t; /* Globals */ -E131 e131; +E131Async e131(10); /* E131Async with X buffers */ testing_t testing; config_t config; uint32_t *seqError; /* Sequence error tracking for each universe */ diff --git a/ESPixelStick.ino b/ESPixelStick.ino index ea6d8442d..ee9c849ae 100644 --- a/ESPixelStick.ino +++ b/ESPixelStick.ino @@ -37,13 +37,14 @@ const char passphrase[] = "ENTER_PASSPHRASE_HERE"; #include #include #include +#include #include -#include +//#include #include #include #include #include -#include +#include #include "ESPixelStick.h" #include "EFUpdate.h" #include "wshandler.h" @@ -353,7 +354,7 @@ void dsNetworkConfig(JsonObject &json) { if (!config.hostname.length()) { char chipId[7] = { 0 }; snprintf(chipId, sizeof(chipId), "%06x", ESP.getChipId()); - config.hostname = "esps_" + String(chipId); + config.hostname = "esps-" + String(chipId); } } @@ -497,61 +498,62 @@ void saveConfig() { /* Main Loop */ void loop() { - /* Reboot handler */ + e131_packet_t packet; + // Reboot handler if (reboot) { delay(REBOOT_DELAY); ESP.restart(); } if (config.testmode == TestMode::DISABLED || config.testmode == TestMode::VIEW_STREAM) { - /* Parse a packet and update pixels */ - if (e131.parsePacket()) { - if ((e131.universe >= config.universe) && (e131.universe <= uniLast)) { - /* Universe offset and sequence tracking */ - uint8_t uniOffset = (e131.universe - config.universe); - if (e131.packet->sequence_number != seqTracker[uniOffset]++) { + // Parse a packet and update pixels + if (!e131.pbuff->isEmpty(e131.pbuff)) { + e131.pbuff->pull(e131.pbuff, &packet); + uint16_t universe = htons(packet.universe); + uint8_t *data = packet.property_values + 1; + if ((universe >= config.universe) && (universe <= uniLast)) { + // Universe offset and sequence tracking + uint8_t uniOffset = (universe - config.universe); + if (packet.sequence_number != seqTracker[uniOffset]++) { seqError[uniOffset]++; - seqTracker[uniOffset] = e131.packet->sequence_number + 1; + seqTracker[uniOffset] = packet.sequence_number + 1; } - /* Offset the channels if required */ + // Offset the channels if required uint16_t offset = 0; offset = config.channel_start - 1; - /* Find start of data based off the Universe */ + // Find start of data based off the Universe int16_t dataStart = uniOffset * UNIVERSE_LIMIT - offset; - /* Calculate how much data we need for this buffer */ + // Calculate how much data we need for this buffer uint16_t dataStop = config.channel_count; if ((dataStart + UNIVERSE_LIMIT) < dataStop) dataStop = dataStart + UNIVERSE_LIMIT; - /* Set the data */ + // Set the data uint16_t buffloc = 0; - - /* ignore data from start of first Universe before channel_start */ - if(dataStart<0) { - dataStart=0; - buffloc=config.channel_start-1; + + // ignore data from start of first Universe before channel_start + if (dataStart < 0) { + dataStart = 0; + buffloc = config.channel_start-1; } for (int i = dataStart; i < dataStop; i++) { #if defined(ESPS_MODE_PIXEL) - pixels.setValue(i, e131.data[buffloc]); + pixels.setValue(i, data[buffloc]); #elif defined(ESPS_MODE_SERIAL) - serial.setValue(i, e131.data[buffloc]); + serial.setValue(i, data[buffloc]); #endif buffloc++; } } } - } else { //some other testmode - //keep feeding server so we don't overrun with packets - e131.parsePacket(); - - switch(config.testmode) { + } else { // Other testmodes + switch (config.testmode) { case TestMode::STATIC: { - //continue to update color to whole string + // Continue to update color to whole string uint16_t i = 0; while (i <= config.channel_count - 3) { #if defined(ESPS_MODE_PIXEL) @@ -621,7 +623,7 @@ void loop() { pixels.setValue(ch_offset++,255 - WheelPos * 3); pixels.setValue(ch_offset, 0); } - #elif defined(ESPS_MODE_SERIAL) +#elif defined(ESPS_MODE_SERIAL) if (WheelPos < 85) { serial.setValue(ch_offset++, 255 - WheelPos * 3); serial.setValue(ch_offset++, 0); @@ -637,7 +639,7 @@ void loop() { serial.setValue(ch_offset++,255 - WheelPos * 3); serial.setValue(ch_offset, 0); } - #endif +#endif } } else { testing.step = 0; @@ -648,6 +650,7 @@ void loop() { } } + /* Streaming refresh */ #if defined(ESPS_MODE_PIXEL) if (pixels.canRefresh()) diff --git a/README.md b/README.md index 937f06416..987204769 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Since this project began, the firmware has moved beyond just pixel support for t Requirements ------------ Along with the Arduino IDE, you'll need the following software to build this project: -- [Adruino for ESP8266](https://github.com/esp8266/Arduino) - Arduino core for ESP8266 +- [Adruino for ESP8266](https://github.com/esp8266/Arduino) - Arduino core for ESP8266 **2.40-rc1 or greater required** - [Arduino ESP8266 Filesystem Uploader](https://github.com/esp8266/arduino-esp8266fs-plugin) - Arduino plugin for uploading files to SPIFFS - [gulp](http://gulpjs.com/) - Build system to process web sources. Optional, but recommended. Refer to the html [README](html/README.md) for more information. @@ -17,6 +17,7 @@ The following libraries are required: - [E131](https://github.com/forkineye/E131) - E1.31 (sACN) Library for Arduino - [ArduinoJson](https://github.com/bblanchon/ArduinoJson) - Arduino JSON Library - [ESPAsyncTCP](https://github.com/me-no-dev/ESPAsyncTCP) - Asynchronous TCP Library +- [ESPAsyncUDP](https://github.com/me-no-dev/ESPAsyncUDP) - Asynchronous UDP LibraryA - [ESPAsyncWebServer](https://github.com/me-no-dev/ESPAsyncWebServer) - Asynchronous Web Server Library Important Notes on Compiling and Flashing @@ -45,6 +46,7 @@ Resources Credits ------- -- The people at http://diychristmas.org and http://doityourselfchristmas.com for inspiration. +- The great people at http://diychristmas.org and http://doityourselfchristmas.com for inspiration and support. - Bill Porter for initial Renard and SoftAP aupport. - Bill Porter and Grayson Lough for initial DMX support. +- Rich Danby for helping polish the front-end. diff --git a/SerialDriver.h b/SerialDriver.h index d95df01f0..8f2738fe3 100644 --- a/SerialDriver.h +++ b/SerialDriver.h @@ -29,7 +29,7 @@ GNU General Public License for more details. #include "HardwareSerial.h" /* UART for Renard / DMX output */ -#define SEROUT_UART 0 +#define SEROUT_UART 1 #if SEROUT_UART == 0 #define SEROUT_PORT Serial diff --git a/gulpfile.js b/gulpfile.js index 6f29eadf4..26aa1ae45 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -23,8 +23,9 @@ gulp.task('html', function() { /* CSS Task */ gulp.task('css', function() { - return gulp.src(['html/**/*.css']) + return gulp.src(['html/css/bootstrap.css', 'html/style.css']) .pipe(plumber()) + .pipe(concat('esps.css')) .pipe(cleancss()) .pipe(gzip()) .pipe(gulp.dest('data/www')); @@ -32,8 +33,9 @@ gulp.task('css', function() { /* JavaScript Task */ gulp.task('js', function() { - return gulp.src(['html/**/*.js']) + return gulp.src(['html/js/jquery*.js', 'html/js/bootstrap.js', 'html/js/jqColorPicker.js', 'html/script.js']) .pipe(plumber()) + .pipe(concat('esps.js')) .pipe(uglifyjs()) .pipe(gzip()) .pipe(gulp.dest('data/www')); diff --git a/html/index.html b/html/index.html index 77a95ff58..a46074945 100644 --- a/html/index.html +++ b/html/index.html @@ -5,8 +5,7 @@ - - + @@ -82,9 +81,9 @@
-
+
-
+
@@ -110,7 +109,7 @@
- +
@@ -362,10 +361,7 @@
- - - - +