Skip to content
Snippets Groups Projects
Verified Commit 7deb695f authored by codecraft's avatar codecraft :crocodile:
Browse files

fix: upper layers not working (probably)

parent 29022013
Branches new
No related tags found
No related merge requests found
...@@ -5,15 +5,16 @@ local leds = { ...@@ -5,15 +5,16 @@ local leds = {
48, 48,
36, 36,
20, 20,
16,
12,
8,
4
} }
for i = 1, #leds do for i = 1, #leds do
if leds[i] % 4 ~= 0 then 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]) error("[ledtree] led count per layer must be divisible by 4. Error location: 'leds' table, item "..i..": "..leds[i])
end 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 end
local height_increment = 3 local height_increment = 3
...@@ -38,7 +39,7 @@ local function place_layer(center, breite) ...@@ -38,7 +39,7 @@ local function place_layer(center, breite)
breite = breite * 2 + 1 breite = breite * 2 + 1
local needles = {} local needles = {}
local leds = {} 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 y = math.ceil(-height_increment / 2), math.floor(height_increment / 2) do
for x = -max_offset, max_offset do for x = -max_offset, max_offset do
for z = -max_offset, max_offset do for z = -max_offset, max_offset do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment