Skip to content

Commit

Permalink
[led_strip] Fix a minor bug on the led_strip example.
Browse files Browse the repository at this point in the history
This bug occure if you have modulo 128 + 1 leds.
  • Loading branch information
nicolas-rabault committed May 23, 2024
1 parent 6d2109d commit 0d1fab6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/projects/l0/led_strip/lib/Led_strip/led_strip.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ void LedStrip_Loop(void)
******************************************************************************/
static void LedStrip_MsgHandler(service_t *service, const msg_t *msg)
{

static bool img_complete = true;
if (msg->header.cmd == COLOR)
{
// change led target color
if (msg->header.size == 3)
if (msg->header.size == 3 && img_complete)
{
// there is only one color copy it in the entire matrix
for (int i = 0; i < imgsize; i++)
Expand All @@ -69,7 +71,7 @@ static void LedStrip_MsgHandler(service_t *service, const msg_t *msg)
else
{
// image management
Luos_ReceiveData(service, msg, (void *)matrix);
img_complete = Luos_ReceiveData(service, msg, (void *)matrix) != 0;
}
return;
}
Expand Down

0 comments on commit 0d1fab6

Please sign in to comment.