From 273e8c5b64fd28d1c373c6e320b0de059ab4ac94 Mon Sep 17 00:00:00 2001 From: Ollo Date: Sat, 20 Mar 2021 16:57:44 +0100 Subject: [PATCH] simulation: Color to number convertion fixed --- simulation/src/de/c3ma/ollo/mockup/ESP8266Ws2812.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/simulation/src/de/c3ma/ollo/mockup/ESP8266Ws2812.java b/simulation/src/de/c3ma/ollo/mockup/ESP8266Ws2812.java index 394f1c2..23ad6c2 100644 --- a/simulation/src/de/c3ma/ollo/mockup/ESP8266Ws2812.java +++ b/simulation/src/de/c3ma/ollo/mockup/ESP8266Ws2812.java @@ -206,10 +206,12 @@ public class ESP8266Ws2812 extends TwoArgFunction { Element e = ESP8266Ws2812.layout.getLED(offset - 1); if (e != null) { Color color = e.getColor(); - final byte[] array = new byte[3]; - array[0] = (byte) color.getRed(); - array[1] = (byte) color.getGreen(); - array[2] = (byte) color.getBlue(); + final char[] array = new char[3]; + array[0] = (char) (color.getRed() ); + array[1] = (char) (color.getGreen() ); + array[2] = (char) (color.getBlue() ); + + System.err.println("[WS2812] reading " + offset + ":" + ((int)array[0]) +"," + ((int) array[1]) + "," + ((int) array[2]) + " from " + color); return LuaString.valueOf(array); } }