app: add Art-Net receiver
This commit is contained in:
parent
af9d0d685a
commit
32aa557a00
|
@ -35,6 +35,7 @@
|
||||||
#include "terminal.h" // handle the terminal interface
|
#include "terminal.h" // handle the terminal interface
|
||||||
#include "menu.h" // menu utilities
|
#include "menu.h" // menu utilities
|
||||||
#include "font.h" // to draw text
|
#include "font.h" // to draw text
|
||||||
|
#include "radio_esp8266.h" // to receive ARTnet
|
||||||
#include "led_ws2812b.h" // control WS2812b LEDs
|
#include "led_ws2812b.h" // control WS2812b LEDs
|
||||||
|
|
||||||
/** watchdog period in ms */
|
/** watchdog period in ms */
|
||||||
|
@ -1065,6 +1066,12 @@ void main(void)
|
||||||
*/
|
*/
|
||||||
puts_debug("OK\n");
|
puts_debug("OK\n");
|
||||||
|
|
||||||
|
puts_debug("setup ESP8266 Art-Net: ");
|
||||||
|
sleep_ms(1000); // wit for ESP to boot
|
||||||
|
radio_esp8266_setup(); // connect to WiFi network
|
||||||
|
radio_esp8266_listen(true, 6454); // open UDP Art-Net
|
||||||
|
puts_debug("OK");
|
||||||
|
|
||||||
// setup terminal
|
// setup terminal
|
||||||
terminal_prefix = ""; // set default prefix
|
terminal_prefix = ""; // set default prefix
|
||||||
terminal_process = &process_command; // set central function to process commands
|
terminal_process = &process_command; // set central function to process commands
|
||||||
|
@ -1126,6 +1133,15 @@ void main(void)
|
||||||
puts("midnight reached\n");
|
puts("midnight reached\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (radio_esp8266_received_len) {
|
||||||
|
if (radio_esp8266_received_len >= 18 && 0 == memcmp((char*)radio_esp8266_received, "Art-Net", 7)) {
|
||||||
|
const uint16_t dmx_universe = radio_esp8266_received[14] + (radio_esp8266_received[15] << 8);
|
||||||
|
const uint16_t dmx_length = radio_esp8266_received[17] + (radio_esp8266_received[16] << 8);
|
||||||
|
printf("Art-Net packet (uni=%u, len=%u)\n", dmx_universe, dmx_length);
|
||||||
|
}
|
||||||
|
radio_esp8266_received_len = 0; // reset flag
|
||||||
|
action = true; // redo main loop
|
||||||
|
}
|
||||||
if (action) { // go to sleep if nothing had to be done, else recheck for activity
|
if (action) { // go to sleep if nothing had to be done, else recheck for activity
|
||||||
action = false;
|
action = false;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue