#142 fixed bug with setting burn rates

This commit is contained in:
Mikayla Fischler 2023-01-13 14:03:47 -05:00
parent a1c1125d54
commit b7d4bc3a5b
3 changed files with 15 additions and 11 deletions

View File

@ -22,7 +22,7 @@ local io = {}
---@diagnostic disable-next-line: redefined-local
function iocontrol.init(conf, comms)
-- pass IO control here since it can't be require'd due to a require loop
process.init(iocontrol, comms)
process.init(io, comms)
io.facility = {
auto_active = false,
@ -71,7 +71,8 @@ function iocontrol.init(conf, comms)
set_burn = function (rate) process.set_rate(i, rate) end, ---@param rate number burn rate
set_waste = function (mode) process.set_waste(i, mode) end, ---@param mode integer waste processing mode
set_group = function (g) process.set_group(i, g) end, ---@param g integer|0 group ID or 0
set_group = function (grp) process.set_group(i, grp) end, ---@param grp integer|0 group ID or 0
set_limit = function (lim) process.set_limit(i, lim) end, ---@param lim number burn rate limit
start_ack = function (success) end, ---@param success boolean
scram_ack = function (success) end, ---@param success boolean

View File

@ -48,17 +48,12 @@ function process.reset_rps(id)
log.debug(util.c("UNIT[", id, "]: RESET RPS"))
end
-- set burn rate or burn limit if part of a group
-- set burn rate
---@param id integer unit ID
---@param rate number burn rate
function process.set_rate(id, rate)
if self.io.units[id].group == 0 then
self.comms.send_command(UNIT_COMMANDS.SET_BURN, id, rate)
log.debug(util.c("UNIT[", id, "]: SET BURN = ", rate))
else
self.comms.send_command(UNIT_COMMANDS.SET_LIMIT, id, rate)
log.debug(util.c("UNIT[", id, "]: SET LIMIT = ", rate))
end
self.comms.send_command(UNIT_COMMANDS.SET_BURN, id, rate)
log.debug(util.c("UNIT[", id, "]: SET BURN = ", rate))
end
-- set waste mode
@ -100,6 +95,14 @@ function process.set_group(unit_id, group_id)
log.debug(util.c("UNIT[", unit_id, "]: SET GROUP ", group_id))
end
-- set the burn rate limit
---@param id integer unit ID
---@param limit number burn rate limit
function process.set_limit(id, limit)
self.comms.send_command(UNIT_COMMANDS.SET_LIMIT, id, limit)
log.debug(util.c("UNIT[", id, "]: SET LIMIT = ", limit))
end
--------------------------
-- SUPERVISOR RESPONSES --
--------------------------

View File

@ -19,7 +19,7 @@ local iocontrol = require("coordinator.iocontrol")
local renderer = require("coordinator.renderer")
local sounder = require("coordinator.sounder")
local COORDINATOR_VERSION = "beta-v0.8.6"
local COORDINATOR_VERSION = "beta-v0.8.7"
local print = util.print
local println = util.println