Skip to content

Commit

Permalink
Fix ESP8266
Browse files Browse the repository at this point in the history
  • Loading branch information
mustang-highTower committed Apr 11, 2020
1 parent 4c27baa commit 6410160
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions wled00/wled00.ino
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//#define WLED_DISABLE_INFRARED //there is no pin left for this on ESP8266-01, saves 12kb
#define WLED_ENABLE_MQTT //saves 12kb
#define WLED_ENABLE_ADALIGHT //saves 500b only
//#define WLED_ENABLE_DMX //uses 10.7kb
#define WLED_ENABLE_DMX //uses 10.7kb (ESP32) and 8.0kb (ESP8266)

#define WLED_DISABLE_FILESYSTEM //SPIFFS is not used by any WLED feature yet
//#define WLED_ENABLE_FS_SERVING //Enable sending html file from SPIFFS before serving progmem version
Expand All @@ -36,7 +36,7 @@
#include <Arduino.h>
#ifdef WLED_ENABLE_DMX
#ifdef ESP8266
#include <LXESP8266DMX.h>
#include <LXESP8266UARTDMX.h>
#else
#include <LXESP32DMX.h>
#endif
Expand Down
2 changes: 1 addition & 1 deletion wled00/wled05_init.ino
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void wledInit()
ESP8266DMX.setDirectionPin(DMXDirectionPin);
ESP8266DMX.startOutput();
#else
digitalWrite(DMXDirectionPin, HIGH);
ESP32DMX.setDirectionPin(DMXDirectionPin);
ESP32DMX.startOutput(DMXSerialOutputPin);
#endif
DEBUG_PRINT("Start DMX output");
Expand Down
16 changes: 14 additions & 2 deletions wled00/wled21_dmx.ino
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@
*/
#ifdef WLED_ENABLE_DMX

#ifdef ESP8266
#include <LXESP8266UARTDMX.h>
#else
#include <LXESP32DMX.h>
#endif

static uint8_t level;
static uint8_t dmxbuffer[DMX_MAX_FRAME];
static bool changed = true;

void copyDMXToOutput(void) {
xSemaphoreTake( ESP32DMX.lxDataLock, portMAX_DELAY );
#ifndef ESP8266
xSemaphoreTake( ESP32DMX.lxDataLock, portMAX_DELAY );
#endif
for (int i=1; i<DMX_MAX_FRAME; i++) {
#ifdef ESP8266
ESP8266DMX.setSlot(i, dmxbuffer[i]);
Expand All @@ -19,7 +27,9 @@ void copyDMXToOutput(void) {
#endif
}
changed = false;
xSemaphoreGive( ESP32DMX.lxDataLock );
#ifndef ESP8266
xSemaphoreGive( ESP32DMX.lxDataLock );
#endif
}

void setDMX(uint16_t DMXAddr, byte value) {
Expand All @@ -34,6 +44,8 @@ void handleDMX() {

uint8_t brightness = strip.getBrightness();
bool calc_brightness = true;

// check if no shutter channel is set
for (byte i = 0; i < DMXChannels; i++)
{
if (DMXFixtureMap[i] == 5) calc_brightness = false;
Expand Down

0 comments on commit 6410160

Please sign in to comment.