#150 save and automatically set priority groups, added checks to set waste and set group commands, restore waste mode control if operation failed

This commit is contained in:
Mikayla Fischler
2023-02-03 16:40:58 -05:00
parent 72791d042b
commit a117d5ee97
6 changed files with 36 additions and 7 deletions

View File

@ -268,7 +268,7 @@ function coordinator.new_session(id, in_queue, out_queue, facility)
log.debug(log_header .. "CRDN unit command burn rate missing option")
end
elseif cmd == UNIT_COMMANDS.SET_WASTE then
if pkt.length == 3 then
if (pkt.length == 3) and (type(pkt.data[3]) == "number") and (pkt.data[3] > 0) and (pkt.data[3] <= 4) then
unit.set_waste(pkt.data[3])
else
log.debug(log_header .. "CRDN unit command set waste missing option")
@ -289,7 +289,7 @@ function coordinator.new_session(id, in_queue, out_queue, facility)
log.debug(log_header .. "CRDN unit command reset alarm missing alarm id")
end
elseif cmd == UNIT_COMMANDS.SET_GROUP then
if pkt.length == 3 then
if (pkt.length == 3) and (type(pkt.data[3]) == "number") and (pkt.data[3] >= 0) and (pkt.data[3] <= 4) then
facility.set_group(unit.get_id(), pkt.data[3])
_send(SCADA_CRDN_TYPES.UNIT_CMD, { cmd, uid, pkt.data[3] })
else