From d182766236a75fa40b73ccff664df8333305d626 Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Wed, 15 Aug 2018 19:29:23 -0400 Subject: [PATCH] reduce color palette to 28 entries to make room for future control codes (loses a dupe brown entry, and light blue and pink, which don't really work well on a LED display) --- README.md | 4 ++-- init.lua | 8 ++++---- textures/led_marquee_palette.png | Bin 146 -> 120 bytes 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c8f52c8..7015cae 100644 --- a/README.md +++ b/README.md @@ -40,13 +40,13 @@ The panels also respond to these control messages: * "off_multi" turns all panels in a lineup off * "allon_multi" turns on all LEDs of all panels in a lineup. -A byte value of 0 to 30 will change colors (i.e. string.char(0 to 30) ). Color values 0 to 11 are: +A byte value of 0 to 27 will change colors (i.e. string.char(0 to 27) ). Color values 0 to 11 are: Red (0), orange, yellow, lime, green, aqua, cyan, sky blue, blue, violet, magenta, or red-violet (11) Colors 12 to 23 are the same as 0 to 11, but lower brightness. -Colors 24 - 30 are white, light grey, medium grey, dim grey, light blue, brown, and pink. +Colors 24 - 27 are white, light grey, medium grey, and dim grey. The left-most/"master" panel will remember the last color used, and defaults to red. diff --git a/init.lua b/init.lua index 4d163a1..ea075a9 100644 --- a/init.lua +++ b/init.lua @@ -61,7 +61,7 @@ local display_string = function(pos, channel, string) local last_color = master_meta:get_int("last_color") local pos2 = pos - if not last_color or last_color < 0 or last_color > 30 then + if not last_color or last_color < 0 or last_color > 27 then last_color = 0 master_meta:set_int("last_color", 0) end @@ -76,7 +76,7 @@ local display_string = function(pos, channel, string) minetest.swap_node(pos2, { name = "led_marquee:char_"..asc, param2 = master_fdir + (last_color*8)}) pos2.x = pos2.x + fdir_to_right[fdir+1][1] pos2.z = pos2.z + fdir_to_right[fdir+1][2] - elseif asc < 31 then + elseif asc < 28 then last_color = asc master_meta:set_int("last_color", asc) end @@ -87,7 +87,7 @@ local on_digiline_receive_string = function(pos, node, channel, msg) local meta = minetest.get_meta(pos) local setchan = meta:get_string("channel") local last_color = meta:get_int("last_color") - if not last_color or last_color < 0 or last_color > 30 then + if not last_color or last_color < 0 or last_color > 27 then last_color = 0 meta:set_int("last_color", 0) end @@ -115,7 +115,7 @@ local on_digiline_receive_string = function(pos, node, channel, msg) local asc = string.byte(msg) if asc > 30 and asc < 256 then minetest.swap_node(pos, { name = "led_marquee:char_"..asc, param2 = fdir + (last_color*8)}) - elseif asc < 31 then + elseif asc < 28 then last_color = asc meta:set_int("last_color", asc) elseif msg == "get" then -- get value as ASCII numerical value diff --git a/textures/led_marquee_palette.png b/textures/led_marquee_palette.png index 5a9d1ddf01d2c672ea04e223f2b8c470e1c0632e..f1818577d07191961e2152cc64ad816917b6c010 100644 GIT binary patch delta 101 zcmbQlSTR8|o{52h;a>mgWkAZ_)5S4_<9g`vjl2yEJj@5vk9(|{T&Ocqwm{98b z)l8W}Rv+f8DK2EyQt^`E(9mFeCTftbcYAmC?d?CS7}lGsJW_x8*8pe~gQu&X%Q~lo FCIIe4Bl-XU delta 127 zcmV-_0D%8^k^ztzc?JLg08#B+@c;k-SxH1eR0!8i$w3XnFc1L2HJLmLqB00aB~cIu z=cJfJ&LHwBneC^lqJ51PK?4;-eub!n_pO8p=D$NzktchgQ{Y!MOD%J h$>VD5?+@*{@dbhxH_