Merge pull request #1 from andyboeh/master

Pull from upstream
This commit is contained in:
Greg Gibeling
2025-06-28 12:44:53 -07:00
committed by GitHub
6 changed files with 23 additions and 7 deletions

1
.github/FUNDING.yml vendored
View File

@@ -1,3 +1,4 @@
# These are supported funding model platforms
github: andyboeh
custom: https://www.amazon.de/hz/wishlist/ls/ROO2X0G63PCT?ref_=wl_share=

View File

@@ -2,6 +2,8 @@
This is a DMX512 custom component for ESPHome that allows Arduino-based devices to control DMX devices via UART (this requires an RS485 module, see below).
If you like my work, consider sponsoring this project via [Github Sponsors](https://github.com/sponsors/andyboeh) or by acquiring one of my [Amazon Wishlist](https://www.amazon.de/hz/wishlist/ls/ROO2X0G63PCT?ref_=wl_share) items.
## Implementation
The implementation is based on other projects:
@@ -25,7 +27,9 @@ dmx512:
id: dmx
uart_id: uart_bus
enable_pin: GPIO33 # optional
tx_pin: GPIO5
tx_pin:
number: GPIO5
allow_other_uses: true # for ESPHome 2023.12.0 or higher
uart_num: 1
periodic_update: true # optional
force_full_frames: false #optional
@@ -37,8 +41,8 @@ dmx512:
* `id`: The ID of this DMX512 hub
* `uart_id`: Set this to the ID of your UART component
* `enable_pin`: Set this to the pin number the MAX585 enable pins are connected to. Optional
* `tx_pin`: Set this to the same pin number as the UART component. This is required for the generation of the break signal. Defaults to GPIO5.
* `uart_num`: Set this to the internal ESP32 UART number. If only logging is configured, this should be set to 1 (default).
* `tx_pin`: Set this to the same pin number as the UART component. This is required for the generation of the break signal. Defaults to GPIO5. If ESPHome >= 2023.12.0 is used, the option `allow_other_uses` has to be set to `true` (here and in the UART component).
* `uart_num`: Set this to the internal ESP32 UART number. If only logging is configured, this should be set to 1 (default). (Note some ESP32 boards don't have 3 UARTs, check the datasheet of your board if using a different one.)
* `periodic_update`: If set to false, only state changes are transmitted and the bus is silent in between - violates the specification and may cause some dimmers to turn off
* `force_full_frames`: If set to true, the full 513-byte frame is always sent. Otherwise, only the configured channels are transmitted.
* `custom_mab_len`: Set a custom mark-after-break length (in uS, default 12)

View File

@@ -19,8 +19,10 @@ class DMX512ESP32 : public DMX512 {
this->uart_idx_ = U0TXD_OUT_IDX;
} else if(num == 1) {
this->uart_idx_ = U1TXD_OUT_IDX;
#ifdef U2TXD_OUT_IDX
} else if(num == 2) {
this->uart_idx_ = U2TXD_OUT_IDX;
#endif
}
}
};

View File

@@ -3,6 +3,7 @@
#include "dmx512esp8266.h"
#include "esphome/core/log.h"
#include "uart_register.h"
#include "eagle_soc.h"
namespace esphome {
namespace dmx512 {

View File

@@ -6,13 +6,17 @@
uart:
id: uart_bus
baud_rate: 250000
tx_pin: GPIO2 #ESP8266
tx_pin:
number: GPIO2 #ESP8266
allow_other_uses: true # for ESPHome >= 2023.12.0
stop_bits: 2
dmx512:
id: dmx
uart_id: uart_bus
tx_pin: GPIO2 #ESP8266
tx_pin:
number: GPIO2 #ESP8266
allow_other_uses: true # for ESPHome >= 2023.12.0
uart_num: 1
output:

View File

@@ -4,14 +4,18 @@ external_components:
uart:
id: uart_bus
baud_rate: 250000
tx_pin: GPIO5
tx_pin:
number: GPIO5
allow_other_uses: true # For ESPHome >= 2023.12.0
stop_bits: 2
dmx512:
id: dmx
uart_id: uart_bus
enable_pin: GPIO33
tx_pin: GPIO5
tx_pin:
number: GPIO5
allow_other_uses: true # For ESPHome >= 2023.12.0
uart_num: 1
output: