simulation: Color to number convertion fixed

This commit is contained in:
Ollo 2021-03-20 16:57:44 +01:00
parent d4617d9861
commit 273e8c5b64

View File

@ -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);
}
}