diff --git a/wiflash_esp32/wiflash_esp32.ino b/wiflash_esp32/wiflash_esp32.ino index b53ef60..e35c63d 100644 --- a/wiflash_esp32/wiflash_esp32.ino +++ b/wiflash_esp32/wiflash_esp32.ino @@ -85,12 +85,16 @@ const uint16_t strobe_address = 501; /* This section to be configured by the Fixtures Dept. */ -const int button = A0; // A0, use 100nF to ground -const int led = LED_BUILTIN; // IO13 +const bool BUTTON = true; +const int button = A0; // A0, use 100nF to ground + +const bool STROBE = true; +const int led = LED_BUILTIN; // IO13 + +const bool STRIP = true; +const uint16_t PixelCount = 8; // not less than 4 +const uint8_t PixelPin = 21; -const uint16_t PixelCount = 8; // not less than 4 -const uint8_t PixelPin = 21; // make sure to set this to the correct pin -NeoPixelBus strip(PixelCount, PixelPin); /* Change nothing else unless you're really sure. @@ -98,6 +102,7 @@ NeoPixelBus strip(PixelCount, PixelPin); //// device objects Strobe *strobe = new Strobe(strobe_address); +NeoPixelBus strip(PixelCount, PixelPin); ESPAsyncE131 *e131 = new ESPAsyncE131(); //// Global button variables @@ -145,25 +150,32 @@ void setup() { Serial.println("STA Failed to configure"); } - //// start sACN - if (e131->subscribe(strobe_universe, sACN_mode)) { - e131->universe(strobe_universe)->onData(std::bind(&Strobe::recvData, - strobe, std::placeholders::_1)); - } - if (e131->subscribe(pixel_universe, sACN_mode)) { - e131->universe(pixel_universe)->onData(std::bind(&recvPixelData, - std::placeholders::_1)); - } - //// start fixtures hardware: // button - pinMode(button, INPUT_PULLUP); - if (!strobe->begin(led, 0)) { - Serial.println("Strobe failed to configure."); + if (BUTTON) { + pinMode(button, INPUT_PULLUP); } + + // strobe + if (STROBE) { + if (!strobe->begin(led, 0)) { + Serial.println("Strobe failed to configure."); + } + if (e131->subscribe(strobe_universe, sACN_mode)) { + e131->universe(strobe_universe)->onData(std::bind(&Strobe::recvData, + strobe, std::placeholders::_1)); + } + } + // pixels - strip.Begin(); - strip.Show(); + if (STRIP) { + strip.Begin(); + strip.Show(); + if (e131->subscribe(pixel_universe, sACN_mode)) { + e131->universe(pixel_universe)->onData(std::bind(&recvPixelData, + std::placeholders::_1)); + } + } } @@ -180,7 +192,7 @@ void loop() { // Be a remote trigger // bool val = !digitalRead(button); - if (val != pressed) { + if (val != pressed && BUTTON) { pressed = val; change_time = millis(); if (pressed) {