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.
*/
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; // make sure to set this to the correct pin
NeoPixelBus<NeoGrbwFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
const uint8_t PixelPin = 21;
/*
Change nothing else unless you're really sure.
@ -98,6 +102,7 @@ NeoPixelBus<NeoGrbwFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
//// device objects
Strobe *strobe = new Strobe(strobe_address);
NeoPixelBus<NeoGrbwFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
ESPAsyncE131 *e131 = new ESPAsyncE131();
//// Global button variables
@ -145,25 +150,32 @@ void setup() {
Serial.println("STA Failed to configure");
}
//// start sACN
//// start fixtures hardware:
// button
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
if (STRIP) {
strip.Begin();
strip.Show();
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.");
}
// pixels
strip.Begin();
strip.Show();
}
@ -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) {