diff --git a/wiflash_esp32/strobe_esp32.cpp b/wiflash_esp32/strobe_esp32.cpp index 07b2a6c..62e43a2 100644 --- a/wiflash_esp32/strobe_esp32.cpp +++ b/wiflash_esp32/strobe_esp32.cpp @@ -78,12 +78,12 @@ bool Strobe::begin(uint8_t pin, uint8_t pwm) { this, // parameter to pass 1, // task priority NULL); // task handle - + return success; } void Strobe::update(void * param) { - Strobe *tThis = (Strobe *) param; + Strobe *tThis = (Strobe *) param; for (;;) { // stop stobing on sACN loss of signal // if (millis() - m_e131->stats.last_seen > 10000) { diff --git a/wiflash_esp32/strobe_esp32.h b/wiflash_esp32/strobe_esp32.h index b9ba58e..ec071df 100644 --- a/wiflash_esp32/strobe_esp32.h +++ b/wiflash_esp32/strobe_esp32.h @@ -1,27 +1,27 @@ /* strobe_esp32.h -Part of WiFlash_esp32 + Part of WiFlash_esp32 -Copyright (c) 2020 Kevin Matz (kevin.matz@gmail.com) + Copyright (c) 2020 Kevin Matz (kevin.matz@gmail.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. */ #ifndef STROBE_ESP32_H_ @@ -42,26 +42,26 @@ typedef enum { class Strobe { public: Strobe(uint16_t universe = 1, uint16_t address = 1); - + bool begin(uint8_t pin, uint8_t pwm); // call in setup() static void update(void * param); // update task - + void recvData(e131_packet_t *packet); // data recieved callback private: uint16_t m_universe; // sACN universe uint16_t m_address; // DMX address - + uint16_t m_int; // state machine intensity uint8_t m_dur; // state machine durration uint8_t m_rat; // state machine rate strState m_state; // state machine cycle state uint16_t m_level; // state machine LED level - + uint8_t m_pwm; // LEDc PWM channel - + uint32_t m_time; // micros() of current cycle start - + inline void setLevel(uint16_t level) __attribute__((always_inline)); }; diff --git a/wiflash_esp32/wiflash_esp32.ino b/wiflash_esp32/wiflash_esp32.ino index 8531ff0..67ec5ba 100644 --- a/wiflash_esp32/wiflash_esp32.ino +++ b/wiflash_esp32/wiflash_esp32.ino @@ -1,29 +1,29 @@ /* WiFlash_esp32 - Concept & electronics: Phil Abeyta - System design & firmware: Kevin Matz - -Uses a GPIO to control a lighting console over OSC, whilst also -controlling an LED strobe light with DMX data recieved over sACN. -Copyright (c) 2020 Kevin Matz (kevin.matz@gmail.com) + Uses a GPIO to control a lighting console over OSC, whilst also + controlling an LED strobe light with DMX data recieved over sACN. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: + Copyright (c) 2020 Kevin Matz (kevin.matz@gmail.com) -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. */ #include @@ -33,8 +33,8 @@ SOFTWARE. /* - * This section to be configured by Lighting Control - */ + This section to be configured by Lighting Control +*/ // ----------------------------------- // Configure the WiFi network // ----------------------------------- @@ -53,9 +53,9 @@ const IPAddress gateway(127, 0, 0, 1); // ----------------------------------- const String host = "127.0.0.1"; const uint16_t port = 7001; -const String pressed_addr = "/hog/playback/go/0"; -const String pressed_value = "99.1"; -const String released_addr = "/hog/playback/go/0"; +const String pressed_addr = "/hog/playback/go/0"; +const String pressed_value = "99.1"; +const String released_addr = "/hog/playback/go/0"; const String released_value = "99.2"; // ----------------------------------- @@ -65,29 +65,29 @@ const e131_listen_t sACN_mode = E131_UNICAST; // (uni|multi)cast const uint16_t strobe_universe = 1; const uint16_t strobe_address = 501; -/* DMX Value - * | chan | Command | range | range | - * |------+-----------+-------+------------| - * | 1 | Intensity | 0- | 0-100% | 15 bit 2.4kHz PWM - * | 2 | fine | 65535 | | - * |------+-----------+-------+------------| - * | 3 | Duration | 0-255 | 0.02-0.5s | 0.002s resolution - * |------+-----------+-------+------------| - * | 4 | Rate | 0-255 | 0.5-25hz | 0.1 hz resolution - * |------+-----------+-------+------------| - */ - +/* DMX Value + | chan | Command | range | range | + |------+-----------+-------+------------| + | 1 | Intensity | 0- | 0-100% | 15 bit 2.4kHz PWM + | 2 | fine | 65535 | | + |------+-----------+-------+------------| + | 3 | Duration | 0-255 | 0.02-0.5s | 0.002s resolution + |------+-----------+-------+------------| + | 4 | Rate | 0-255 | 0.5-25hz | 0.1 hz resolution + |------+-----------+-------+------------| +*/ -/* - * 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 int led = LED_BUILTIN; // IO13 /* - * Change nothing else unless you're really sure. - */ + Change nothing else unless you're really sure. +*/ //// device objects Strobe *strobe = new Strobe(strobe_universe, strobe_address); @@ -98,12 +98,12 @@ bool pressed = false; // track button state uint32_t change_time; // time of button press (ms) /* - * Arduino powerup - */ + Arduino powerup +*/ void setup() { Serial.begin(115200); -//// start WiFi: + //// start WiFi: // set IPv4 WiFi.mode(WIFI_STA); WiFi.config(ip, gateway, subnet); @@ -128,21 +128,20 @@ void setup() { std::placeholders::_1)); Serial.println("Listening for sACN"); } - - -//// start fixtures hardware: + + + //// start fixtures hardware: // button pinMode(button, INPUT_PULLUP); - // led_trigPres_trigPress _trigPress _trigPress _trigPress s if (!strobe->begin(led, 0)) { Serial.println("Strobe failed to configure."); } } -/* - * Arduino process loop - */ +/* + Arduino process loop +*/ void loop() { if (WiFi.status() != WL_CONNECTED) { Serial.println("Waiting for WiFi...");