From 56802601363154384bd4f7b611d52c22273c573c Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 17 Dec 2023 20:43:08 -0500 Subject: [PATCH] use existing is_valid_port rather than repeating the code --- scada-common/rsio.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scada-common/rsio.lua b/scada-common/rsio.lua index fcdc56b..6d1e688 100644 --- a/scada-common/rsio.lua +++ b/scada-common/rsio.lua @@ -246,8 +246,7 @@ assert(rsio.NUM_PORTS == #RS_DIO_MAP, "RS_DIO_MAP length incorrect") ---@param port IO_PORT ---@return IO_DIR function rsio.get_io_dir(port) - if util.is_int(port) and port > 0 and port <= rsio.NUM_PORTS then - return RS_DIO_MAP[port].mode + if rsio.is_valid_port(port) then return RS_DIO_MAP[port].mode else return IO_DIR.IN end end @@ -256,8 +255,7 @@ end ---@param port IO_PORT ---@return IO_MODE function rsio.get_io_mode(port) - if util.is_int(port) and port > 0 and port <= rsio.NUM_PORTS then - return MODES[port] + if rsio.is_valid_port(port) then return MODES[port] else return IO_MODE.ANALOG_IN end end