From 59a66a3ea5f91bb203d63e6fa3ce813771cf616c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Kristan?= Date: Thu, 23 Sep 2021 06:52:48 +0200 Subject: [PATCH] Buffer filling bugfix. --- wled00/bus_manager.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index 65b0df5bb..0fc1bd67b 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -387,10 +387,11 @@ class BusNetwork : public Bus { void setPixelColor(uint16_t pix, uint32_t c) { if (!_valid || pix >= _len) return; - _data[pix] = 0xFF & (c >> 16); - _data[pix+1] = 0xFF & (c >> 8); - _data[pix+2] = 0xFF & (c ); - if (_rgbw) _data[pix+3] = 0xFF & (c >> 24); + uint16_t offset = pix*(_rgbw?4:3); + _data[offset] = 0xFF & (c >> 16); + _data[offset+1] = 0xFF & (c >> 8); + _data[offset+2] = 0xFF & (c ); + if (_rgbw) _data[offset+3] = 0xFF & (c >> 24); } uint32_t getPixelColor(uint16_t pix) {