From 2790a621754937a451755f849dcfed74b0e16caf Mon Sep 17 00:00:00 2001 From: Ollo Date: Thu, 28 Oct 2021 21:26:08 +0200 Subject: [PATCH] buffer is filled with expected color --- simulation/src/de/c3ma/ollo/mockup/ESP8266Ws2812.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/simulation/src/de/c3ma/ollo/mockup/ESP8266Ws2812.java b/simulation/src/de/c3ma/ollo/mockup/ESP8266Ws2812.java index 69a4d75..38da090 100644 --- a/simulation/src/de/c3ma/ollo/mockup/ESP8266Ws2812.java +++ b/simulation/src/de/c3ma/ollo/mockup/ESP8266Ws2812.java @@ -126,10 +126,11 @@ public class ESP8266Ws2812 extends TwoArgFunction { } public Varargs invoke(Varargs varargs) { - if (varargs.narg() >= 3) { - final int red = varargs.arg(1).toint(); - final int green = varargs.arg(2).toint(); - final int blue = varargs.arg(3).toint(); + if (varargs.narg() == 4) { + /* first argument is the object itself */ + final int red = varargs.arg(2).toint(); + final int green = varargs.arg(3).toint(); + final int blue = varargs.arg(4).toint(); /* update local buffer */ for(int i=0; i < ledList.size(); i++) { ledList.set(i, new Color(red, green, blue));