Skip to content

Commit

Permalink
Fixes for v3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
forkineye committed Jan 11, 2020
1 parent 5e099c3 commit 4ea1417
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .vscode/arduino.json
Original file line number Diff line number Diff line change
@@ -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"
}
12 changes: 8 additions & 4 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
13 changes: 1 addition & 12 deletions EFUpdate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@
#include <lwip/def.h>
#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;
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion ESPixelStick.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 18 additions & 18 deletions ESPixelStick.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1235,8 +1235,8 @@ void sendZCPPConfig(ZCPP_packet_t& packet) {
packet.QueryConfigurationResponse.PortConfig[0].gamma = 0;
#endif
}
zcpp.sendConfigResponse(&packet);

zcpp.sendConfigResponse(&packet);
}

/////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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<uint32_t>(ourLocalIP), static_cast<uint32_t>(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));
Expand All @@ -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:
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -1531,7 +1531,7 @@ void loop() {
|| (config.ds == DataSource::MQTT) ) {
effects.run();
}

/* Streaming refresh */
#if defined(ESPS_MODE_PIXEL)
if (pixels.canRefresh())
Expand All @@ -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);
Expand Down
40 changes: 16 additions & 24 deletions SerialDriver.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/******************************************************************
*
*
* Project: ESPixelStick - An ESP8266 and E1.31 based pixel (And Serial!) driver
* Orginal ESPixelStickproject by 2015 Shelby Merrick
*
Expand All @@ -8,16 +8,16 @@
* 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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
<http://www.gnu.org/licenses/>
*
*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.
******************************************************************/
Expand Down Expand Up @@ -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<uint8_t *>(malloc(_size + 2));
_serialdata[0] = 0x7E;
_serialdata[1] = 0x80;
// Create buffer
} else if (_type == SerialType::DMX512) {
_serialdata = static_cast<uint8_t *>(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;
}

Expand Down Expand Up @@ -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);
Expand All @@ -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);
}


Expand Down
17 changes: 8 additions & 9 deletions SerialDriver.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/******************************************************************
*
*
* Project: ESPixelStick - An ESP8266 and E1.31 based pixel (And Serial!) driver
* Orginal ESPixelStickproject by 2015 Shelby Merrick
*
Expand All @@ -8,16 +8,16 @@
* 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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
<http://www.gnu.org/licenses/>
*
*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.
******************************************************************/
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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;

This comment has been minimized.

Copy link
@LabRat3K

LabRat3K May 28, 2020

Contributor

This update backed out the changes to support Serial port 0.

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;

This comment has been minimized.

Copy link
@LabRat3K

LabRat3K May 28, 2020

Contributor

... and here.

}
};

Expand Down
8 changes: 4 additions & 4 deletions dist/firmware/firmware.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
],

Expand Down
6 changes: 0 additions & 6 deletions html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,6 @@
</div>
</div>

<!-- Display Layout -->
<div class="t_layout">
<legend class="esps-legend">Display Layout</legend>
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.
</div>

</form>
</fieldset>
</div>
Expand Down
4 changes: 2 additions & 2 deletions travis/firmware.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"file": "serial-travis.bin"
}
],

"devices": [
{
"name": "ESP01_1MB_128K",
"esptool": {
"reset": "none",
"reset": "nodemcu",
"baudrate": "115200",
"spiffsloc": "0xDB000"
},
Expand Down
Loading

0 comments on commit 4ea1417

Please sign in to comment.