debug: scan all peripherals to find GPU name

This commit is contained in:
2026-05-05 18:29:33 -04:00
parent 4e3ca0a2a4
commit 70a03df8e3

View File

@@ -20,7 +20,21 @@ local tris = {
{ 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 }, { 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 },
} }
local gpu = peripheral.wrap("tm_gpu_0") print("Scanning peripherals...")
for _, name in ipairs(peripheral.getNames()) do
print(name .. " = " .. peripheral.getType(name))
end
local gpu
for _, name in ipairs(peripheral.getNames()) do
local t = peripheral.getType(name)
if t and t:find("gpu") then
gpu = peripheral.wrap(name)
print("Found GPU: " .. name)
break
end
end
if not gpu then error("No GPU peripheral found.") end
gpu.refreshSize() gpu.refreshSize()
gpu.setSize(64) gpu.setSize(64)
local pw, ph, bx, by, sb = gpu.getSize() local pw, ph, bx, by, sb = gpu.getSize()