From 77d75677077d5ceb8c972bee50ff503c4bde5251 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Sat, 18 Feb 2023 13:17:09 +0000 Subject: [PATCH] Inital code on adding DMX input support --- wled00/dmx.cpp | 8 ++++++++ wled00/fcn_declare.h | 1 + wled00/wled.cpp | 3 +++ wled00/wled.h | 1 + 4 files changed, 13 insertions(+) diff --git a/wled00/dmx.cpp b/wled00/dmx.cpp index 933bfe62..56748972 100644 --- a/wled00/dmx.cpp +++ b/wled00/dmx.cpp @@ -94,3 +94,11 @@ void initDMX() { void handleDMX() {} void initDMX() {} #endif + +#ifdef WLED_ENABLE_DMX_INPUT +void handleDMXInput() { + dmx.update(); + dmx.read(1); // TODO - handle code + DEBUG_PRINTF("DMX channel 1 = %u", dmx.read(1)); // TODO: remove from final code +} +#endif \ No newline at end of file diff --git a/wled00/fcn_declare.h b/wled00/fcn_declare.h index 5ebbcbd9..f4ef9f8c 100644 --- a/wled00/fcn_declare.h +++ b/wled00/fcn_declare.h @@ -78,6 +78,7 @@ uint32_t gamma32(uint32_t); //dmx.cpp void initDMX(); void handleDMX(); +void handleDMXInput(); //e131.cpp void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol); diff --git a/wled00/wled.cpp b/wled00/wled.cpp index ead5e37b..bc11c3d1 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -56,6 +56,9 @@ void WLED::loop() handleTransitions(); #ifdef WLED_ENABLE_DMX handleDMX(); +#endif +#ifdef WLED_ENABLE_DMX_INPUT + handleDMXInput(); #endif userLoop(); diff --git a/wled00/wled.h b/wled00/wled.h index 52f05c15..2147cce3 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -33,6 +33,7 @@ #endif #define WLED_ENABLE_ADALIGHT // saves 500b only (uses GPIO3 (RX) for serial) //#define WLED_ENABLE_DMX // uses 3.5kb (use LEDPIN other than 2) +#define WLED_ENABLE_DMX_INPUT // Listen for DMX over Serial //#define WLED_ENABLE_JSONLIVE // peek LED output via /json/live (WS binary peek is always enabled) #ifndef WLED_DISABLE_LOXONE #define WLED_ENABLE_LOXONE // uses 1.2kb