From d7c5070bb96147faffb62ceb81adfcd8935a2ab7 Mon Sep 17 00:00:00 2001 From: Thomas Kolb Date: Tue, 23 Jun 2020 21:30:11 +0200 Subject: [PATCH] sk6812: send END_OF_UPDATE in the last packet --- sk6812.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sk6812.c b/sk6812.c index 056051f..32ee892 100644 --- a/sk6812.c +++ b/sk6812.c @@ -22,6 +22,7 @@ #define FADE_COLOR 1 #define ADD_COLOR 2 #define SET_FADESTEP 3 +#define END_OF_UPDATE 254 // creates the socket needed for steering the LED strip int sk6812_init(struct sk6812_ctx *ctx, const char *host, unsigned short port) { @@ -102,6 +103,10 @@ void sk6812_set_fadestep(struct sk6812_ctx *ctx, uint8_t fadestep) { } int sk6812_commit(struct sk6812_ctx *ctx) { + // send end-of-update packet in the end + ctx->packetQueue[ctx->queueIndex].action = END_OF_UPDATE; + ctx->queueIndex++; + if(send(ctx->socket, ctx->packetQueue, ctx->queueIndex * sizeof(struct SK6812Packet), 0) == -1) { return 1; }