Invert each second row
This commit is contained in:
parent
78a9027ad7
commit
f51613255b
@ -10,4 +10,4 @@ color4=string.char(green, red, blue)
|
|||||||
|
|
||||||
colorBg=string.char(0,0,0) -- black is the default background color
|
colorBg=string.char(0,0,0) -- black is the default background color
|
||||||
sntpserverhostname="ptbtime1.ptb.de"
|
sntpserverhostname="ptbtime1.ptb.de"
|
||||||
|
timezoneoffset=1
|
@ -61,8 +61,8 @@ public class ESP8266Ws2812 extends TwoArgFunction {
|
|||||||
for (int i = 0; i < length; i += 3) {
|
for (int i = 0; i < length; i += 3) {
|
||||||
if (ESP8266Ws2812.layout != null) {
|
if (ESP8266Ws2812.layout != null) {
|
||||||
int r = array[i + 0]+(Byte.MIN_VALUE*-1);
|
int r = array[i + 0]+(Byte.MIN_VALUE*-1);
|
||||||
int g = array[i + 1]+(Byte.MIN_VALUE*-1);
|
int b = array[i + 1]+(Byte.MIN_VALUE*-1);
|
||||||
int b = array[i + 2]+(Byte.MIN_VALUE*-1);
|
int g = array[i + 2]+(Byte.MIN_VALUE*-1);
|
||||||
ESP8266Ws2812.layout.updateLED(i / 3, r, g, b);
|
ESP8266Ws2812.layout.updateLED(i / 3, r, g, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,6 +184,10 @@ public class WS2812Layout extends JFrame {
|
|||||||
if (mElements != null) {
|
if (mElements != null) {
|
||||||
int i = (index / mColumn);
|
int i = (index / mColumn);
|
||||||
int j = (index % mColumn);
|
int j = (index % mColumn);
|
||||||
|
// Swap each second row
|
||||||
|
if (i % 2 == 1) {
|
||||||
|
j = (mColumn-1) - j;
|
||||||
|
}
|
||||||
if ((i < mElements.length) && (j < mElements[i].length) && (mElements[i][j] != null)) {
|
if ((i < mElements.length) && (j < mElements[i].length) && (mElements[i][j] != null)) {
|
||||||
Element curlbl = mElements[i][j];
|
Element curlbl = mElements[i][j];
|
||||||
curlbl.setColor(r, g, b);
|
curlbl.setColor(r, g, b);
|
||||||
|
Loading…
Reference in New Issue
Block a user