diff --git a/README.md b/README.md index 80f450d..187faab 100644 --- a/README.md +++ b/README.md @@ -35,23 +35,23 @@ You have to short-circuit `R0` on the RS485 boards to enable the termination res ![Circuit diagram](/assets/circuit/diagram.svg) -| GPIO | Usage | -| ---- | -------------- | -| GND | GND to others | -| 3,5V | VIN on RS485 | -| 5V | VIN on W5500 | -| 0 | Onboard Button | -| 5 | Ext. Button | -| 7 | Ext. LED | -| 15 | Onboard LED | -| 17 | U1TXD | -| 18 | U1RXD | -| 21 | U0TXD | -| 33 | U0RXD | -| 34 | SPI CS | -| 35 | SPI MOS | -| 36 | SPI SCK | -| 37 | SPI MISO | +| GPIO | Usage | +| ------- | -------------- | +| GND | GND to others | +| 3,3V | VIN on RS485 | +| 5V/VBUS | VIN on W5500 | +| 0 | Onboard Button | +| 5 | Ext. Button | +| 7 | Ext. LED | +| 15 | Onboard LED | +| 17 | U1TXD | +| 18 | U1RXD | +| 21 | U0TXD | +| 33 | U0RXD | +| 34 | SPI CS | +| 35 | SPI MOS | +| 36 | SPI SCK | +| 37 | SPI MISO | --- diff --git a/src/main.cpp b/src/main.cpp index 08cd9e6..c782905 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,8 +26,6 @@ #include "routes/networks.h" #include "routes/status.h" -// DMXESPSerial dmx1; -// DMXESPSerial dmx2; dmx_port_t dmx1 = DMX_NUM_0; // for esp32s2 dmx_port_t dmx2 = DMX_NUM_1; byte dmx1_data[DMX_PACKET_SIZE]; @@ -197,15 +195,8 @@ void setup() direction1 = static_cast(config.getUInt("direction-1", DEFAULT_DIRECTION1)); direction2 = static_cast(config.getUInt("direction-2", DEFAULT_DIRECTION2)); - Serial.print("Port A: Universe "); - Serial.print(universe1); - Serial.print(" "); - Serial.println((direction1 == Input) ? "DMX -> Art-Net" : "Art-Net -> DMX"); - - Serial.print("Port B: Universe "); - Serial.print(universe2); - Serial.print(" "); - Serial.println((direction2 == Input) ? "DMX -> Art-Net" : "Art-Net -> DMX"); + Serial.printf("Port A: Universe %d %s\n", universe1, (direction1 == Input) ? "DMX -> Art-Net" : "Art-Net -> DMX"); + Serial.printf("Port B: Universe %d %s\n", universe2, (direction2 == Input) ? "DMX -> Art-Net" : "Art-Net -> DMX"); Connection connection = static_cast(config.getUInt("connection", DEFAULT_CONNECTION)); IpMethod ipMethod = static_cast(config.getUInt("ip-method"), DEFAULT_IP_METHOD); @@ -323,44 +314,21 @@ void setup() Serial.println("Initialize DMX..."); #ifdef CONFIG_IDF_TARGET_ESP32S2 - // dmx1.init(21, 33, Serial0); - // dmx2.init(17, 18, Serial1); - - Serial.print("DMX driver 1 installed: "); - Serial.println(dmx_driver_is_installed(dmx1)); - - Serial.print("DMX driver 2 installed: "); - Serial.println(dmx_driver_is_installed(dmx2)); dmx_config_t dmx_config = DMX_CONFIG_DEFAULT; - dmx_personality_t personalities[] = {}; - /*dmx_personality_t personalities[] = { - {1, "Default Personality"} - };*/ - /*int personality_count = 1;*/ int personality_count = 0; + dmx_driver_install(dmx1, &dmx_config, personalities, personality_count); dmx_set_pin(dmx1, 21, 33, -1); dmx_driver_install(dmx2, &dmx_config, personalities, personality_count); dmx_set_pin(dmx2, 17, 18, -1); - Serial.print("DMX driver 1 installed: "); - Serial.println(dmx_driver_is_installed(dmx1)); + Serial.printf("DMX driver 1 installed: %d\n", dmx_driver_is_installed(dmx1)); + Serial.printf("DMX driver 2 installed: %d\n", dmx_driver_is_installed(dmx2)); - Serial.print("DMX driver 2 installed: "); - Serial.println(dmx_driver_is_installed(dmx2)); - - Serial.print("DMX driver 1 enabled: "); - Serial.println(dmx_driver_is_enabled(dmx1)); - - Serial.print("DMX driver 2 enabled: "); - Serial.println(dmx_driver_is_enabled(dmx2)); - - // TX/RX Pins und Serial0/Serial1 ausgeben - - /* Now set the DMX hardware pins to the pins that we want to use and setup - will be complete! */ + Serial.printf("DMX driver 1 enabled: %d\n", dmx_driver_is_enabled(dmx1)); + Serial.printf("DMX driver 2 enabled: %d\n", dmx_driver_is_enabled(dmx2)); #else dmx1.init(21, 33, Serial1); @@ -374,7 +342,6 @@ void setup() // if Artnet packet comes to this universe, this function is called if (direction1 == Output) { - Serial.println("DMX1 as out"); artnet.subscribeArtDmxUniverse(universe1, [&](const uint8_t *data, uint16_t size, const ArtDmxMetadata &metadata, const ArtNetRemoteInfo &remote) { dmx_write_offset(dmx1, 1, data, size); @@ -384,7 +351,6 @@ void setup() if (direction2 == Output) { - Serial.println("DMX2 as out"); artnet.subscribeArtDmxUniverse(universe2, [&](const uint8_t *data, uint16_t size, const ArtDmxMetadata &metadata, const ArtNetRemoteInfo &remote) { dmx_write_offset(dmx2, 1, data, size); @@ -392,9 +358,6 @@ void setup() dmx_wait_sent(dmx2, DMX_TIMEOUT_TICK); }); } - // if Artnet packet comes, this function is called to every universe - // artnet.subscribeArtDmx([&](const uint8_t *data, uint16_t size, const ArtDmxMetadata &metadata, const ArtNetRemoteInfo &remote) {}); - if (!LittleFS.begin(true)) { Serial.println("An Error has occurred while mounting LittleFS");