check for features [en|dis]abled

This commit is contained in:
Kevin Matz 2020-12-09 10:48:22 -05:00
parent e11b8fce9d
commit 73eb72a638

View File

@ -85,12 +85,16 @@ const uint16_t strobe_address = 501;
/* /*
This section to be configured by the Fixtures Dept. This section to be configured by the Fixtures Dept.
*/ */
const int button = A0; // A0, use 100nF to ground const bool BUTTON = true;
const int led = LED_BUILTIN; // IO13 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<NeoGrbwFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
/* /*
Change nothing else unless you're really sure. Change nothing else unless you're really sure.
@ -98,6 +102,7 @@ NeoPixelBus<NeoGrbwFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
//// device objects //// device objects
Strobe *strobe = new Strobe(strobe_address); Strobe *strobe = new Strobe(strobe_address);
NeoPixelBus<NeoGrbwFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
ESPAsyncE131 *e131 = new ESPAsyncE131(); ESPAsyncE131 *e131 = new ESPAsyncE131();
//// Global button variables //// Global button variables
@ -145,25 +150,32 @@ void setup() {
Serial.println("STA Failed to configure"); 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: //// start fixtures hardware:
// button // button
pinMode(button, INPUT_PULLUP); if (BUTTON) {
if (!strobe->begin(led, 0)) { pinMode(button, INPUT_PULLUP);
Serial.println("Strobe failed to configure.");
} }
// 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 // pixels
strip.Begin(); if (STRIP) {
strip.Show(); 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 // Be a remote trigger
// //
bool val = !digitalRead(button); bool val = !digitalRead(button);
if (val != pressed) { if (val != pressed && BUTTON) {
pressed = val; pressed = val;
change_time = millis(); change_time = millis();
if (pressed) { if (pressed) {