From 2b8b3290cff84156de4c0e41d58fe975875d9969 Mon Sep 17 00:00:00 2001 From: Mateusz Salamon Date: Sun, 10 May 2020 20:05:48 +0200 Subject: [PATCH] Fix low count of LEDs --- Core/Src/ws2812b_fx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Core/Src/ws2812b_fx.c b/Core/Src/ws2812b_fx.c index b9a3067..c210a88 100644 --- a/Core/Src/ws2812b_fx.c +++ b/Core/Src/ws2812b_fx.c @@ -192,7 +192,14 @@ void (*mMode[MODE_COUNT])(void) = FX_STATUS WS2812BFX_Init(uint16_t Segments) { - if(Segments == 0 || Segments >= (WS2812B_LEDS / 2)) return FX_ERROR; + if(Segments == 0) return FX_ERROR; + if(Segments > (WS2812B_LEDS / 2)) + { + if(Segments > WS2812B_LEDS) + { + return FX_ERROR; + } + } uint16_t div = 0; ws2812bfx_s *SegmentsTmp = NULL;