diff --git a/coordinator/coordinator.lua b/coordinator/coordinator.lua index 402827c..4df3ad1 100644 --- a/coordinator/coordinator.lua +++ b/coordinator/coordinator.lua @@ -113,6 +113,8 @@ function coordinator.load_config() mon_cfv.assert_eq(#config.UnitDisplays, config.UnitCount) if mon_cfv.valid() then + local w, h, _ + mon_cfv.assert(util.table_contains(names, config.MainDisplay)) if not mon_cfv.valid() then return 2, "Main monitor is not connected." end @@ -120,7 +122,7 @@ function coordinator.load_config() monitors.primary = ppm.get_periph(config.MainDisplay) monitors.primary_name = config.MainDisplay - local w, h = ppm.monitor_block_size(monitors.primary.getSize()) + w, _ = ppm.monitor_block_size(monitors.primary.getSize()) mon_cfv.assert(w == 8) if not mon_cfv.valid() then return 2, "Main monitor width is incorrect." end @@ -133,7 +135,7 @@ function coordinator.load_config() monitors.flow = ppm.get_periph(config.FlowDisplay) monitors.flow_name = config.FlowDisplay - w, h = ppm.monitor_block_size(monitors.flow.getSize()) + w, _ = ppm.monitor_block_size(monitors.flow.getSize()) mon_cfv.assert(w == 8) if not mon_cfv.valid() then return 2, "Flow monitor width is incorrect." end diff --git a/coordinator/renderer.lua b/coordinator/renderer.lua index f9c793d..07282c4 100644 --- a/coordinator/renderer.lua +++ b/coordinator/renderer.lua @@ -3,8 +3,6 @@ -- local log = require("scada-common.log") -local util = require("scada-common.util") -local ppm = require("scada-common.ppm") local iocontrol = require("coordinator.iocontrol") diff --git a/scada-common/ppm.lua b/scada-common/ppm.lua index 37a2ecb..116264b 100644 --- a/scada-common/ppm.lua +++ b/scada-common/ppm.lua @@ -427,7 +427,7 @@ end ---@nodiscard ---@param w integer character width ---@param h integer character width ----@return integer block_width, integer block_height +---@return integer block_width, integer block_height function ppm.monitor_block_size(w, h) local width = math.floor((w - 15) / 21) + 1 local height = math.floor((h - 10) / 14) + 1