From b9945cace935daa3d170814e281ba55d908110c2 Mon Sep 17 00:00:00 2001 From: Nicolas Rabault Date: Thu, 23 May 2024 16:04:27 +0200 Subject: [PATCH] [led_strip] Fix a minor bug on the led_strip example. This bug occure if you have modulo 128 + 1 leds. --- examples/projects/l0/led_strip/lib/Led_strip/led_strip.c | 6 ++++-- examples/projects/l0/led_strip/lib/Led_strip/led_strip.h | 1 - .../projects/l0/led_strip/lib/Led_strip/led_strip_drv.h | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/projects/l0/led_strip/lib/Led_strip/led_strip.c b/examples/projects/l0/led_strip/lib/Led_strip/led_strip.c index f0e0b0c20..9bc70345a 100644 --- a/examples/projects/l0/led_strip/lib/Led_strip/led_strip.c +++ b/examples/projects/l0/led_strip/lib/Led_strip/led_strip.c @@ -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++) @@ -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; } diff --git a/examples/projects/l0/led_strip/lib/Led_strip/led_strip.h b/examples/projects/l0/led_strip/lib/Led_strip/led_strip.h index c0dfdb5ed..7210152a5 100644 --- a/examples/projects/l0/led_strip/lib/Led_strip/led_strip.h +++ b/examples/projects/l0/led_strip/lib/Led_strip/led_strip.h @@ -8,7 +8,6 @@ #define LED_STRIP_H #include "luos_engine.h" -#include "robus_network.h" /******************************************************************************* * Definitions diff --git a/examples/projects/l0/led_strip/lib/Led_strip/led_strip_drv.h b/examples/projects/l0/led_strip/lib/Led_strip/led_strip_drv.h index b30b55ad1..2eb62621e 100644 --- a/examples/projects/l0/led_strip/lib/Led_strip/led_strip_drv.h +++ b/examples/projects/l0/led_strip/lib/Led_strip/led_strip_drv.h @@ -7,7 +7,6 @@ #include "main.h" #include "tim.h" #include "luos_engine.h" -#include "robus_network.h" /******************************************************************************* * Definitions ******************************************************************************/