From 7deb695fd2cc93047e9089674127ee0d54627a9f Mon Sep 17 00:00:00 2001 From: Darius Auding <darius.auding@teckids.org> Date: Fri, 27 Dec 2024 14:01:59 +0100 Subject: [PATCH 1/7] fix: upper layers not working (probably) --- tree.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tree.lua b/tree.lua index 1a33372..c9a431b 100644 --- a/tree.lua +++ b/tree.lua @@ -5,15 +5,16 @@ local leds = { 48, 36, 20, + 16, + 12, + 8, + 4 } for i = 1, #leds do if leds[i] % 4 ~= 0 then error("[ledtree] led count per layer must be divisible by 4. Error location: 'leds' table, item "..i..": "..leds[i]) end - if leds[i] < 20 then - error("[ledtree] led count per layer must be greater than or qual to 20. Error location: 'leds' table, item "..i..": "..leds[i]) - end end local height_increment = 3 @@ -38,7 +39,7 @@ local function place_layer(center, breite) breite = breite * 2 + 1 local needles = {} local leds = {} - local max_offset = math.floor(breite / 2) + local max_offset = (breite - 1) / 2 for y = math.ceil(-height_increment / 2), math.floor(height_increment / 2) do for x = -max_offset, max_offset do for z = -max_offset, max_offset do -- GitLab From 738f345933be0d1c418857568ad689c60e6ca281 Mon Sep 17 00:00:00 2001 From: Darius Auding <darius.auding@teckids.org> Date: Fri, 27 Dec 2024 14:32:34 +0100 Subject: [PATCH 2/7] fix: led numbers --- tree.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tree.lua b/tree.lua index c9a431b..57d7a1b 100644 --- a/tree.lua +++ b/tree.lua @@ -1,9 +1,9 @@ -- NUR DURCH 4 TEILBARE ZAHLEN > 20 VERWENDEN!!! local leds = { - 64, - 56, - 48, + 40, 36, + 32, + 24, 20, 16, 12, -- GitLab From 6743e3e0d31524654d2ad6183d40f50ce5f717da Mon Sep 17 00:00:00 2001 From: Darius Auding <darius.auding@teckids.org> Date: Fri, 27 Dec 2024 16:44:13 +0100 Subject: [PATCH 3/7] fix: led offset --- tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tree.lua b/tree.lua index 57d7a1b..5a67554 100644 --- a/tree.lua +++ b/tree.lua @@ -64,7 +64,7 @@ local function place_leds(led_index, leds) end local function place_tree(pos) - local led_index = 0 + local led_index = 300 - 220 for index = 1, #leds do local l = leds[index] local layer_center = vector.new(pos.x, pos.y + index * height_increment - height_increment / 2, pos.z) -- GitLab From 14d2e4a18a1fc9926dd0ed85e156086bab65d38c Mon Sep 17 00:00:00 2001 From: Darius Auding <darius.auding@teckids.org> Date: Fri, 27 Dec 2024 17:02:52 +0100 Subject: [PATCH 4/7] fix: 2 --- tree.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/tree.lua b/tree.lua index 5a67554..dd63857 100644 --- a/tree.lua +++ b/tree.lua @@ -3,6 +3,7 @@ local leds = { 40, 36, 32, + 28, 24, 20, 16, -- GitLab From 70ebc9951a40c1b78e7c79a8b3549ad384b75b61 Mon Sep 17 00:00:00 2001 From: Darius Auding <darius.auding@teckids.org> Date: Fri, 27 Dec 2024 17:02:52 +0100 Subject: [PATCH 5/7] fix: 2 --- tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tree.lua b/tree.lua index dd63857..b25cbe9 100644 --- a/tree.lua +++ b/tree.lua @@ -65,7 +65,7 @@ local function place_leds(led_index, leds) end local function place_tree(pos) - local led_index = 300 - 220 + local led_index = 300 - 243 for index = 1, #leds do local l = leds[index] local layer_center = vector.new(pos.x, pos.y + index * height_increment - height_increment / 2, pos.z) -- GitLab From 45e59bf31918772f4b632cfd6f9bd1bd35e59477 Mon Sep 17 00:00:00 2001 From: Darius Auding <darius.auding@teckids.org> Date: Fri, 27 Dec 2024 17:09:36 +0100 Subject: [PATCH 6/7] fix: again --- tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tree.lua b/tree.lua index b25cbe9..0f82d34 100644 --- a/tree.lua +++ b/tree.lua @@ -65,7 +65,7 @@ local function place_leds(led_index, leds) end local function place_tree(pos) - local led_index = 300 - 243 + local led_index = 300 - 197 for index = 1, #leds do local l = leds[index] local layer_center = vector.new(pos.x, pos.y + index * height_increment - height_increment / 2, pos.z) -- GitLab From e994dcd2f97315cc6e3206e34bc6d4b57fbeb184 Mon Sep 17 00:00:00 2001 From: Darius Auding <darius.auding@teckids.org> Date: Sun, 29 Dec 2024 10:52:36 +0100 Subject: [PATCH 7/7] fix: offset (final) --- tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tree.lua b/tree.lua index 0f82d34..6768313 100644 --- a/tree.lua +++ b/tree.lua @@ -65,7 +65,7 @@ local function place_leds(led_index, leds) end local function place_tree(pos) - local led_index = 300 - 197 + local led_index = 300 - 200 for index = 1, #leds do local l = leds[index] local layer_center = vector.new(pos.x, pos.y + index * height_increment - height_increment / 2, pos.z) -- GitLab