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 b9945ca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 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
1 change: 0 additions & 1 deletion examples/projects/l0/led_strip/lib/Led_strip/led_strip.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#define LED_STRIP_H

#include "luos_engine.h"
#include "robus_network.h"

/*******************************************************************************
* Definitions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "main.h"
#include "tim.h"
#include "luos_engine.h"
#include "robus_network.h"
/*******************************************************************************
* Definitions
******************************************************************************/
Expand Down

0 comments on commit b9945ca

Please sign in to comment.