#399 working unit data updating and unit waste control

This commit is contained in:
Mikayla Fischler 2024-11-17 19:46:04 -05:00
parent edde416889
commit 7b6b1de539
3 changed files with 13 additions and 3 deletions

View File

@ -364,7 +364,7 @@ function pocket.new_session(id, s_addr, i_seq_num, in_queue, out_queue, timeout)
-- facility data
data[#db.units + 1] = {}
_send(CRDN_TYPE.API_GET_PROC, data)
_send(CRDN_TYPE.API_GET_WASTE, data)
else
log.debug(log_tag .. "handler received unsupported CRDN packet type " .. pkt.type)
end

View File

@ -85,6 +85,14 @@ function process.set_group(unit_id, group_id)
log.debug(util.c("PROCESS: UNIT[", unit_id, "] SET GROUP ", group_id))
end
-- set waste mode
---@param id integer unit ID
---@param mode integer waste mode
function process.set_unit_waste(id, mode)
self.comms.send_unit_command(U_CMD.SET_WASTE, id, mode)
log.debug(util.c("PROCESS: UNIT[", id, "] SET WASTE ", mode))
end
-- acknowledge all alarms
---@param id integer unit ID
function process.ack_all_alarms(id)

View File

@ -109,11 +109,13 @@ local function new_view(root)
TextBox{parent=u_div,y=1,text="Reactor Unit #"..i,alignment=ALIGN.CENTER}
local function set_waste(mode) process.set_unit_waste(i, mode) end
local waste_prod = StateIndicator{parent=u_div,x=16,y=3,states=style.waste.states_abbrv,value=1,min_width=6}
local waste_mode = RadioButton{parent=u_div,y=3,options=style.waste.unit_opts,callback=function()end,radio_colors=cpair(colors.lightGray,colors.gray),select_color=colors.white}
local waste_mode = RadioButton{parent=u_div,y=3,options=style.waste.unit_opts,callback=set_waste,radio_colors=cpair(colors.lightGray,colors.gray),select_color=colors.white}
waste_prod.register(u_ps, "U_WasteProduct", waste_prod.update)
waste_mode.register(u_ps, "U_WasteMode", waste_mode.update)
waste_mode.register(u_ps, "U_WasteMode", waste_mode.set_value)
TextBox{parent=u_div,y=8,text="Plutonium (Pellets)",fg_bg=style.label}
local pu = DataIndicator{parent=u_div,label="",format="%16.3f",value=0,unit="mB/t",lu_colors=lu_col,width=21,fg_bg=text_fg}