diff --git a/firmware/main.c b/firmware/main.c index 6496d13..54f39a3 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -31,7 +31,7 @@ #include "ws2812b.h" // to control WS2812B LEDs /* global variables */ -volatile uint8_t uart_in[19]; // input from USART, enough space for one atmolight message +volatile uint8_t uart_in[19*2]; // input from USART, enough space for two atmolight messages (one as buffer) volatile uint8_t uart_in_i = 0; // UART input index /* flags, set in the interrupts and handled in the main program */ @@ -140,9 +140,14 @@ int main(void) ws2812b_set_led_color(4,led,uart_in[16],uart_in[17],uart_in[18]); } } - if (uart_in_i>=sizeof(uart_in)) { // end of message - uart_in_i = 0; // start with next message + if (uart_in_i>=19) { // end of message ws2812b_show(); // show the new colors + if (uart_in_i>19) { // move buffered message + for (uint8_t i=19; i