luacheck fixes

This commit is contained in:
Mikayla Fischler 2024-02-18 15:30:18 -05:00
parent 1984b63837
commit 56e69e3a29
3 changed files with 5 additions and 5 deletions

View File

@ -113,6 +113,8 @@ function coordinator.load_config()
mon_cfv.assert_eq(#config.UnitDisplays, config.UnitCount) mon_cfv.assert_eq(#config.UnitDisplays, config.UnitCount)
if mon_cfv.valid() then if mon_cfv.valid() then
local w, h, _
mon_cfv.assert(util.table_contains(names, config.MainDisplay)) mon_cfv.assert(util.table_contains(names, config.MainDisplay))
if not mon_cfv.valid() then return 2, "Main monitor is not connected." end 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 = ppm.get_periph(config.MainDisplay)
monitors.primary_name = 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) mon_cfv.assert(w == 8)
if not mon_cfv.valid() then return 2, "Main monitor width is incorrect." end 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 = ppm.get_periph(config.FlowDisplay)
monitors.flow_name = 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) mon_cfv.assert(w == 8)
if not mon_cfv.valid() then return 2, "Flow monitor width is incorrect." end if not mon_cfv.valid() then return 2, "Flow monitor width is incorrect." end

View File

@ -3,8 +3,6 @@
-- --
local log = require("scada-common.log") local log = require("scada-common.log")
local util = require("scada-common.util")
local ppm = require("scada-common.ppm")
local iocontrol = require("coordinator.iocontrol") local iocontrol = require("coordinator.iocontrol")

View File

@ -427,7 +427,7 @@ end
---@nodiscard ---@nodiscard
---@param w integer character width ---@param w integer character width
---@param h 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) function ppm.monitor_block_size(w, h)
local width = math.floor((w - 15) / 21) + 1 local width = math.floor((w - 15) / 21) + 1
local height = math.floor((h - 10) / 14) + 1 local height = math.floor((h - 10) / 14) + 1