diff --git a/.vscode/arduino.json b/.vscode/arduino.json index b9157fb1b..7e627b4c2 100644 --- a/.vscode/arduino.json +++ b/.vscode/arduino.json @@ -1,6 +1,6 @@ { "board": "esp8266com:esp8266:generic", - "configuration": "xtal=160,vt=flash,exception=disabled,ResetMethod=nodemcu,CrystalFreq=26,FlashFreq=40,FlashMode=dio,eesz=1M128,led=2,ip=hb2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200", + "configuration": "xtal=160,vt=flash,exception=disabled,ssl=all,ResetMethod=nodemcu,CrystalFreq=26,FlashFreq=40,FlashMode=dio,eesz=1M128,led=2,sdk=nonosdk_190703,ip=hb2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200", "sketch": "ESPixelStick.ino", "output": ".build" } \ No newline at end of file diff --git a/Changelog.md b/Changelog.md index 890960f18..b70d80528 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,17 +1,21 @@ # Changelog -### 3.1-dev (on-going) +### 3.1 +- Compiled against [2.6.3 Arduino Core](https://github.com/esp8266/Arduino/releases/tag/2.6.3) +- ESPSFlashTool support for ESPixelStick v3.0 Hardware +- Fixed DMX issues - [Issue #101](https://github.com/forkineye/ESPixelStick/issues/101) - Added brightness support. - Added calculated gamma support. - Added grouping and zigzag for pixels. - Added startup and idle effect options. +- Added FPP Discovery support. +- Added xLights ZCPP support. +- Added DDP support. - Added Home Assistant MQTT Discovery support. -- Better MQTT support (usage detailed in the README). -- New effects for standalone or MQTT usage. +- New effects for standalone and MQTT usage. - Changed GECE output from bit-banging to a UART based implementation. -- Removed PWM support. A version supporting PWM is maintaned by [penfold42](https://github.com/penfold42/ESPixelBoard). ### 3.0 diff --git a/EFUpdate.cpp b/EFUpdate.cpp index bb4ab6528..5ff07b028 100644 --- a/EFUpdate.cpp +++ b/EFUpdate.cpp @@ -22,16 +22,6 @@ #include #include "EFUpdate.h" -#ifndef U_SPIFFS -/* - * Arduino 8266 libraries removed U_SPIFFS on master, replacing it with U_FS to allow for other FS types - - * See https://github.com/esp8266/Arduino/commit/a389a995fb12459819e33970ec80695f1eaecc58#diff-6c6d762c616bd0b92156f152d128ad51 - * - * Substitute the value here, while not breaking things for people using older SDKs. - */ -#define U_SPIFFS U_FS -#endif - void EFUpdate::begin() { _maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000; _state = State::HEADER; @@ -75,8 +65,7 @@ bool EFUpdate::process(uint8_t *data, size_t len) { } } else if (_record.type == RecordType::SPIFFS_IMAGE) { // Begin spiffs update - SPIFFS.end(); - if (!Update.begin(_record.size, U_SPIFFS)) { + if (!Update.begin(_record.size, U_FS)) { _state = State::FAIL; _error = Update.getError(); } else { diff --git a/ESPixelStick.h b/ESPixelStick.h index d52622d1a..2c995d9e3 100644 --- a/ESPixelStick.h +++ b/ESPixelStick.h @@ -20,7 +20,7 @@ #ifndef ESPIXELSTICK_H_ #define ESPIXELSTICK_H_ -const char VERSION[] = "3.1-dev"; +const char VERSION[] = "3.1"; const char BUILD_DATE[] = __DATE__; // Mode configuration moved to Mode.h to ease things with Travis diff --git a/ESPixelStick.ino b/ESPixelStick.ino index 3a4c776a6..ca7207318 100644 --- a/ESPixelStick.ino +++ b/ESPixelStick.ino @@ -181,7 +181,7 @@ void setup() { { LOG_PORT.println("Failed to read file system details"); } - + // Load configuration from SPIFFS and set Hostname loadConfig(); if (config.hostname) @@ -279,9 +279,9 @@ void setup() { fppDiscovery.begin(); if (ddp.begin(ourLocalIP)) { - LOG_PORT.println(F("- DDP Enabled")); + LOG_PORT.println(F("- DDP Enabled")); } else { - LOG_PORT.println(F("*** DDP INIT FAILED ****")); + LOG_PORT.println(F("*** DDP INIT FAILED ****")); } lastZCPPConfig = -1; @@ -443,7 +443,7 @@ void onMqttDisconnect(AsyncMqttClientDisconnectReason reason) { void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties properties, size_t len, size_t index, size_t total) { - + DynamicJsonDocument r(1024); DeserializationError error = deserializeJson(r, payload); @@ -1031,7 +1031,7 @@ void loadConfig() { void serializeConfig(String &jsonString, bool pretty, bool creds) { // Create buffer and root object DynamicJsonDocument json(1024); - + // Device JsonObject device = json.createNestedObject("device"); device["id"] = config.id.c_str(); @@ -1115,7 +1115,7 @@ void serializeConfig(String &jsonString, bool pretty, bool creds) { #endif if (pretty) - serializeJsonPretty(json, jsonString); + serializeJsonPretty(json, jsonString); else serializeJson(json, jsonString); } @@ -1176,7 +1176,7 @@ void sendZCPPConfig(ZCPP_packet_t& packet) { packet.QueryConfigurationResponse.PortConfig[0].port = 0; #if defined(ESPS_MODE_SERIAL) packet.QueryConfigurationResponse.PortConfig[0].port |= 0x80; - #endif + #endif packet.QueryConfigurationResponse.PortConfig[0].string = 0; packet.QueryConfigurationResponse.PortConfig[0].startChannel = ntohl((uint32_t)config.channel_start); #if defined(ESPS_MODE_PIXEL) @@ -1235,8 +1235,8 @@ void sendZCPPConfig(ZCPP_packet_t& packet) { packet.QueryConfigurationResponse.PortConfig[0].gamma = 0; #endif } - - zcpp.sendConfigResponse(&packet); + + zcpp.sendConfigResponse(&packet); } ///////////////////////////////////////////////////////// @@ -1367,14 +1367,14 @@ void loop() { memset(version, 0x00, sizeof(version)); for (uint8_t i = 0; i < min(strlen_P(VERSION), sizeof(version)-1); i++) version[i] = pgm_read_byte(VERSION + i); - + uint8_t mac[WL_MAC_ADDR_LENGTH]; zcpp.sendDiscoveryResponse(&zcppPacket, version, WiFi.macAddress(mac), config.id.c_str(), pixelPorts, serialPorts, 680 * 3, 512, 680 * 3, static_cast(ourLocalIP), static_cast(ourSubnetMask)); } break; case ZCPP_TYPE_CONFIG: // config LOG_PORT.println("ZCPP Config received."); - if (htons(zcppPacket.Configuration.sequenceNumber) != lastZCPPConfig) { + if (htons(zcppPacket.Configuration.sequenceNumber) != lastZCPPConfig) { // a new config to apply LOG_PORT.print(" The config is new: "); LOG_PORT.println(htons(zcppPacket.Configuration.sequenceNumber)); @@ -1388,7 +1388,7 @@ void loop() { if (p->port == 0) { switch(p->protocol) { #if defined(ESPS_MODE_PIXEL) - case ZCPP_PROTOCOL_WS2811: + case ZCPP_PROTOCOL_WS2811: config.pixel_type = PixelType::WS2811; break; case ZCPP_PROTOCOL_GECE: @@ -1405,7 +1405,7 @@ void loop() { default: LOG_PORT.print("Attempt to configure invalid protocol "); LOG_PORT.print(p->protocol); - break; + break; } LOG_PORT.print(" Protocol: "); #if defined(ESPS_MODE_PIXEL) @@ -1416,7 +1416,7 @@ void loop() { config.channel_start = htonl(p->startChannel); LOG_PORT.print(" Start Channel: "); LOG_PORT.println(config.channel_start); - config.channel_count = htonl(p->channels); + config.channel_count = htonl(p->channels); LOG_PORT.print(" Channel Count: "); LOG_PORT.println(config.channel_count); #if defined(ESPS_MODE_PIXEL) @@ -1461,8 +1461,8 @@ void loop() { LOG_PORT.print("Attempt to configure invalid port "); LOG_PORT.print(p->port); } - - p += sizeof(zcppPacket.Configuration.PortConfig); + + p += sizeof(zcppPacket.Configuration.PortConfig); } if (zcppPacket.Configuration.flags & ZCPP_CONFIG_FLAG_LAST) { @@ -1531,7 +1531,7 @@ void loop() { || (config.ds == DataSource::MQTT) ) { effects.run(); } - + /* Streaming refresh */ #if defined(ESPS_MODE_PIXEL) if (pixels.canRefresh()) @@ -1541,7 +1541,7 @@ void loop() { serial.show(); #endif } - + // workaround crash - consume incoming bytes on serial port if (LOG_PORT.available()) { while (LOG_PORT.read() >= 0); diff --git a/SerialDriver.cpp b/SerialDriver.cpp index 889f08baa..0d9d68926 100644 --- a/SerialDriver.cpp +++ b/SerialDriver.cpp @@ -1,5 +1,5 @@ /****************************************************************** -* +* * Project: ESPixelStick - An ESP8266 and E1.31 based pixel (And Serial!) driver * Orginal ESPixelStickproject by 2015 Shelby Merrick * @@ -8,8 +8,8 @@ * www.billporter.info * * See Readme for other info and version history -* -* +* +* *This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or(at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,7 +17,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * -*This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. +*This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. *To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or *send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. ******************************************************************/ @@ -119,23 +119,14 @@ int SerialDriver::begin(HardwareSerial *theSerial, SerialType type, return retval; } -/* move buffer creation to being, added header bytes on eneqeue / fill fifo */ -void SerialDriver::startPacket() { - // Create a buffer and fill in header - if (_type == SerialType::RENARD) { - _serialdata = static_cast(malloc(_size + 2)); - _serialdata[0] = 0x7E; - _serialdata[1] = 0x80; - // Create buffer - } else if (_type == SerialType::DMX512) { - _serialdata = static_cast(malloc(_size)); - } -} - const uint8_t* ICACHE_RAM_ATTR SerialDriver::fillFifo(const uint8_t *buff, const uint8_t *tail) { uint8_t avail = (UART_TX_FIFO_SIZE - getFifoLength()); - if (tail - buff > avail) tail = buff + avail; - while (buff < tail) enqueue(*buff++); + if (tail - buff > avail) + tail = buff + avail; + + while (buff < tail) + enqueue(*buff++); + return buff; } @@ -168,8 +159,11 @@ void ICACHE_RAM_ATTR SerialDriver::serial_handle(void *param) { void SerialDriver::show() { if (!_serialdata) return; - uart_buffer = _serialdata; - uart_buffer_tail = _serialdata + _size; + /* Copy data to the idle buffer and swap it */ + memcpy(_asyncdata, _serialdata, _size); + + uart_buffer = _asyncdata; + uart_buffer_tail = _asyncdata + _size; if (_type == SerialType::DMX512) { SET_PERI_REG_MASK(UART_CONF0(SEROUT_UART), UART_TXD_BRK); @@ -182,9 +176,7 @@ void SerialDriver::show() { startTime = micros(); - /* Copy data to the idle buffer and swap it */ - memcpy(_asyncdata, _serialdata, _size); - std::swap(_asyncdata, _serialdata); +// std::swap(_asyncdata, _serialdata); } diff --git a/SerialDriver.h b/SerialDriver.h index 8f2738fe3..c140febc2 100644 --- a/SerialDriver.h +++ b/SerialDriver.h @@ -1,5 +1,5 @@ /****************************************************************** -* +* * Project: ESPixelStick - An ESP8266 and E1.31 based pixel (And Serial!) driver * Orginal ESPixelStickproject by 2015 Shelby Merrick * @@ -8,8 +8,8 @@ * www.billporter.info * * See Readme for other info and version history -* -* +* +* *This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or(at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,7 +17,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * -*This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. +*This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. *To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or *send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. ******************************************************************/ @@ -63,7 +63,6 @@ class SerialDriver { int begin(HardwareSerial *theSerial, SerialType type, uint16_t length); int begin(HardwareSerial *theSerial, SerialType type, uint16_t length, BaudRate baud); - void startPacket(); void show(); uint8_t* getData(); @@ -109,14 +108,14 @@ class SerialDriver { /* Serial interrupt handler */ static void ICACHE_RAM_ATTR serial_handle(void *param); - /* Returns number of bytes waiting in the TX FIFO of SEROUT_UART */ + /* Returns number of bytes waiting in the TX FIFO of UART1 */ static inline uint8_t getFifoLength() { - return (ESP8266_REG(U0F+(0xF00*SEROUT_UART)) >> USTXC) & 0xff; + return (U1S >> USTXC) & 0xff; } - /* Append a byte to the TX FIFO of SEROUT_UART */ + /* Append a byte to the TX FIFO of UART1 */ static inline void enqueue(uint8_t byte) { - ESP8266_REG(U0F+(0xF00*SEROUT_UART)) = byte; + U1F = byte; } }; diff --git a/dist/firmware/firmware.json b/dist/firmware/firmware.json index b220c8c68..5db527c44 100644 --- a/dist/firmware/firmware.json +++ b/dist/firmware/firmware.json @@ -3,14 +3,14 @@ { "name": "Pixel (WS2811 / GECE)", "description": "Pixel Mode", - "version": "3.0 (20171120)", - "file": "pixel-3.0-1m_128k.bin" + "version": "3.1 (20200110)", + "file": "pixel-3.1-1m_128k.bin" }, { "name": "Serial (DMX / Renard)", "description": "Serial Mode", - "version": "3.0 (20171120)", - "file": "serial-3.0-1m_128k.bin" + "version": "3.1 (20200110)", + "file": "serial-3.1-1m_128k.bin" } ], diff --git a/html/index.html b/html/index.html index f9bbcc675..46c3c9042 100644 --- a/html/index.html +++ b/html/index.html @@ -353,12 +353,6 @@ - -
- Display Layout - Placeholder for layout configuration to assist in effect rendering. Selectable type (string, matrix, tree, etc..) and size / orientation where applicable (20x30 matrix - horizontal or veritcal? where does feed start?). Should also be used to render view stream which is moved to the Diagnostics tab. -
- diff --git a/travis/firmware.json b/travis/firmware.json index 01171c4ea..3d1318a26 100644 --- a/travis/firmware.json +++ b/travis/firmware.json @@ -13,12 +13,12 @@ "file": "serial-travis.bin" } ], - + "devices": [ { "name": "ESP01_1MB_128K", "esptool": { - "reset": "none", + "reset": "nodemcu", "baudrate": "115200", "spiffsloc": "0xDB000" }, diff --git a/wshandler.h b/wshandler.h index 98e69b1e4..0b3be2a75 100644 --- a/wshandler.h +++ b/wshandler.h @@ -105,7 +105,7 @@ void procX(uint8_t *data, AsyncWebSocketClient *client) { ddpJ["num_bytes"] = (String)ddp.stats.bytesReceived; ddpJ["max_channel"] = (String)ddp.stats.ddpMaxChannel; ddpJ["min_channel"] = (String)ddp.stats.ddpMinChannel; - + String response; serializeJson(json, response); client->text("XJ" + response); @@ -387,8 +387,6 @@ void handle_fw_upload(AsyncWebServerRequest *request, String filename, String(efupdate.getError())); if (final) { - request->send(200, "text/plain", "Update Finished: " + - String(efupdate.getError())); LOG_PORT.println(F("* Upload Finished.")); efupdate.end(); SPIFFS.begin();