From e35c066c254855b31fa5233abb47e856ab3bbf47 Mon Sep 17 00:00:00 2001 From: Dan Esparza Date: Fri, 1 Sep 2023 10:04:36 -0400 Subject: [PATCH] Basic RGBW support working --- .idea/.gitignore | 8 ++++++++ .idea/ledctl.iml | 9 +++++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ pixarray/pixarray.go | 42 ++++++++++++++++++++++++++++++------------ 5 files changed, 61 insertions(+), 12 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/ledctl.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/ledctl.iml b/.idea/ledctl.iml new file mode 100644 index 0000000..5e764c4 --- /dev/null +++ b/.idea/ledctl.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..70dd05d --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/pixarray/pixarray.go b/pixarray/pixarray.go index c4a839d..922678f 100644 --- a/pixarray/pixarray.go +++ b/pixarray/pixarray.go @@ -12,24 +12,42 @@ const ( GBR RGB RBG + GRBW + BRGW + BGRW + GBRW + RGBW + RBGW ) var StringOrders map[string]int = map[string]int{ - "GRB": GRB, - "BRG": BRG, - "BGR": BGR, - "GBR": GBR, - "RGB": RGB, - "RBG": RBG, + "GRB": GRB, + "BRG": BRG, + "BGR": BGR, + "GBR": GBR, + "RGB": RGB, + "RBG": RBG, + "GRBW": GRBW, + "BRGW": BRGW, + "BGRW": BGRW, + "GBRW": GBRW, + "RGBW": RGBW, + "RBGW": RBGW, } var offsets map[int][]int = map[int][]int{ - GRB: {0, 1, 2, -1}, - BRG: {2, 1, 0, -1}, - BGR: {1, 2, 0, -1}, - GBR: {0, 2, 1, -1}, - RGB: {1, 0, 2, -1}, - RBG: {2, 0, 1, -1}, + GRB: {0, 1, 2, -1}, + BRG: {2, 1, 0, -1}, + BGR: {1, 2, 0, -1}, + GBR: {0, 2, 1, -1}, + RGB: {1, 0, 2, -1}, + RBG: {2, 0, 1, -1}, + GRBW: {0, 1, 2, 3}, + BRGW: {2, 1, 0, 3}, + BGRW: {1, 2, 0, 3}, + GBRW: {0, 2, 1, 3}, + RGBW: {1, 0, 2, 3}, + RBGW: {2, 0, 1, 3}, } func abs(i int) int {