fix: call enable() on pages after attaching to device
Opus Canvas only renders children with enabled=true. Without calling page:enable(), all widgets were skipped during render, resulting in a blank black monitor.
This commit is contained in:
@@ -450,6 +450,7 @@ local function buildMainPage()
|
|||||||
mainDevice.currentPage = mainPage
|
mainDevice.currentPage = mainPage
|
||||||
mainPage.parent = mainDevice
|
mainPage.parent = mainDevice
|
||||||
mainPage:setParent()
|
mainPage:setParent()
|
||||||
|
mainPage:enable()
|
||||||
end
|
end
|
||||||
|
|
||||||
function D.updateAmountButtons()
|
function D.updateAmountButtons()
|
||||||
@@ -886,6 +887,7 @@ local function buildSmelterPage()
|
|||||||
smelterDevice.currentPage = smelterPage
|
smelterDevice.currentPage = smelterPage
|
||||||
smelterPage.parent = smelterDevice
|
smelterPage.parent = smelterDevice
|
||||||
smelterPage:setParent()
|
smelterPage:setParent()
|
||||||
|
smelterPage:enable()
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
@@ -1015,12 +1017,7 @@ end
|
|||||||
function D.drawDashboard()
|
function D.drawDashboard()
|
||||||
if not mainPage then
|
if not mainPage then
|
||||||
if mainDevice then
|
if mainDevice then
|
||||||
log.info("DRAW", "Building main page (device=%s, side=%s)",
|
|
||||||
tostring(mainDevice), tostring(mainDevice and mainDevice.device and mainDevice.device.side or "nil"))
|
|
||||||
buildMainPage()
|
buildMainPage()
|
||||||
log.info("DRAW", "Main page built: %s", tostring(mainPage ~= nil))
|
|
||||||
else
|
|
||||||
log.warn("DRAW", "No mainDevice — skipping dashboard")
|
|
||||||
end
|
end
|
||||||
if not mainPage then return end
|
if not mainPage then return end
|
||||||
end
|
end
|
||||||
@@ -1042,21 +1039,6 @@ function D.drawDashboard()
|
|||||||
-- Draw everything
|
-- Draw everything
|
||||||
mainPage:draw()
|
mainPage:draw()
|
||||||
mainDevice:sync()
|
mainDevice:sync()
|
||||||
|
|
||||||
-- Debug: verify monitor is writable
|
|
||||||
if D._drawCount == nil then D._drawCount = 0 end
|
|
||||||
D._drawCount = D._drawCount + 1
|
|
||||||
if D._drawCount <= 3 then
|
|
||||||
log.info("DRAW", "sync complete (draw #%d, lines=%d, w=%d h=%d)",
|
|
||||||
D._drawCount,
|
|
||||||
mainDevice.lines and #mainDevice.lines or -1,
|
|
||||||
mainDevice.width or -1, mainDevice.height or -1)
|
|
||||||
-- Raw write test directly to the physical monitor
|
|
||||||
D.mon.setCursorPos(1, 1)
|
|
||||||
D.mon.setBackgroundColor(colors.red)
|
|
||||||
D.mon.setTextColor(colors.white)
|
|
||||||
D.mon.write("DRAW TEST #" .. D._drawCount)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function D.drawSmelterDashboard()
|
function D.drawSmelterDashboard()
|
||||||
|
|||||||
Reference in New Issue
Block a user