From 0460d0bb5bbc9c6e0bcf60b6e0ac16ad891592ab Mon Sep 17 00:00:00 2001 From: gac-S_Changer Date: Thu, 26 Jan 2017 16:53:05 +0100 Subject: [PATCH] Closedown --- config/devices.properties | 4 ++-- script/local.py | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config/devices.properties b/config/devices.properties index 2f11020..eaae694 100644 --- a/config/devices.properties +++ b/config/devices.properties @@ -8,10 +8,10 @@ jf5=ch.psi.pshell.modbus.AnalogInput|robot_modbus 4||100| jf6=ch.psi.pshell.modbus.AnalogInput|robot_modbus 5||100| robot_sts=ch.psi.pshell.modbus.AnalogInputArray|robot_modbus 6 6||100| robot_cmd=ch.psi.pshell.modbus.AnalogOutput|robot_modbus 12||| -robot_args=ch.psi.pshell.modbus.AnalogOutputArray|robot_modbus 47 6||| +robot_args=ch.psi.pshell.modbus.AnalogOutputArray|robot_modbus 47 12||| robot_req=ch.psi.pshell.modbus.AnalogOutput|robot_modbus 13||| robot_ack=ch.psi.pshell.modbus.AnalogInput|robot_modbus 14||| -robot_ret=ch.psi.pshell.modbus.AnalogInputArray|robot_modbus 15 6||| +robot_ret=ch.psi.pshell.modbus.AnalogInputArray|robot_modbus 15 12||| dewar=ch.psi.pshell.modbus.ModbusTCP|SF-TEST-WAGO1:502||| relays=ch.psi.pshell.modbus.DigitalOutputArray|dewar 0 16||1000| relay1=ch.psi.pshell.modbus.DigitalOutput|dewar 0||1000| diff --git a/script/local.py b/script/local.py index 54280c6..e871a87 100644 --- a/script/local.py +++ b/script/local.py @@ -41,12 +41,14 @@ class RobotModbus(DeviceBase): if robot_ack.read() != 0: raise Exception("Robot is not ready") robot_cmd.write(command) - args = [0,0,0,0,0,0] + args = [0] * robot_args.size index = 0 for arg in argv: args[index] = arg index = index + 1 - robot_args.write(to_array(args, 'i')) + if index == robot_args.size: + raise Exception("Invalid number of arguments") + robot.write(to_array(args, 'i')) try: self.request() err = robot_ack.take()