fix some bugs
This commit is contained in:
@ -28,7 +28,7 @@ def initialization():
|
||||
pd.push_file_to_server(config_file, f"{user_settings}/{filename}")
|
||||
pd.push_file_to_server(config_file, f"{interactive_data}/{filename}")
|
||||
|
||||
io_device_autotest = {'ai_num': 0, 'ao_num': 0, 'di_num': 16, 'do_num': 16, 'extend_attr': {'mode': 'slaver', 'name': 'autotest', 'type': 'MODBUS'}, 'id': 7, 'name': 'autotest', 'type': 6}
|
||||
io_device_autotest = {"ai_num": 0, "ao_num": 0, "di_num": 16, "do_num": 16, "extend_attr": {"mode": "slaver", "name": "autotest", "type": "MODBUS"}, "id": 7, "name": "autotest", "type": 6}
|
||||
io_device_file_local = f"..\\assets\\configs\\{io_device_file}"
|
||||
io_device_file_local_tmp = f"..\\assets\\configs\\{io_device_file}_tmp"
|
||||
io_device_file_remote = f"{user_settings}/{io_device_file}"
|
||||
@ -84,8 +84,9 @@ def initialization():
|
||||
ec.modify_system_time(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())))
|
||||
|
||||
# 关闭拖动
|
||||
clibs.logger.info("关闭拖动模式...")
|
||||
hr.set_drag_params(False, 1, 2)
|
||||
if robot_type.upper()[:2] not in ["XB", "NB"]:
|
||||
clibs.logger.info("关闭拖动模式...")
|
||||
hr.set_drag_params(False, 1, 2)
|
||||
|
||||
# 关闭碰撞检测
|
||||
clibs.logger.info("关闭碰撞检测...")
|
||||
@ -114,4 +115,5 @@ def initialization():
|
||||
md.r_clear_alarm()
|
||||
|
||||
|
||||
initialization()
|
||||
if __name__ == "__main__":
|
||||
initialization()
|
||||
|
@ -139,6 +139,13 @@ class ModbusRequest(object):
|
||||
clibs.logger.info(f"40018-{action} 执行{actions}安全区 safe region 03")
|
||||
sleep(clibs.interval)
|
||||
|
||||
def r_write_signals(self, addr: int, value): # OK | 40100 - 40109: signal_0 ~ signal_9
|
||||
if -1 < addr < 10 and addr.is_integer():
|
||||
self.__c.write_register(40100+addr, value)
|
||||
clibs.logger.info(f"{40100+addr}-{value} 将寄存器 signal_{addr} 赋值为 {value}")
|
||||
else:
|
||||
clibs.logger.error(f"{40100+addr}-{value} 地址错误,无法赋值!")
|
||||
|
||||
@property
|
||||
def w_alarm_state(self): # OK
|
||||
res = self.__c.read_holding_registers(40500, 1).registers[0]
|
||||
@ -418,7 +425,10 @@ class HmiRequest(object):
|
||||
return res.get("data", f"{msg_id} has no data item")
|
||||
sleep(clibs.interval*2)
|
||||
else: # 尝试在上一次分割的日志中查找,只做一次
|
||||
res = find_response("".join([clibs.log_path, sorted(listdir(clibs.log_path))[-3]]))
|
||||
try:
|
||||
res = find_response("".join([clibs.log_path, sorted(listdir(clibs.log_path))[-3]]))
|
||||
except IndexError:
|
||||
res = None
|
||||
if res is not None:
|
||||
return res.get("data", f"{msg_id} has no data item")
|
||||
elif flag == 1:
|
||||
@ -428,7 +438,10 @@ class HmiRequest(object):
|
||||
return res
|
||||
sleep(clibs.interval*2)
|
||||
else:
|
||||
res = find_response_xs("".join([clibs.log_path, sorted(listdir(clibs.log_path))[-3]]))
|
||||
try:
|
||||
res = find_response_xs("".join([clibs.log_path, sorted(listdir(clibs.log_path))[-3]]))
|
||||
except IndexError:
|
||||
res = None
|
||||
if res is not None:
|
||||
return res
|
||||
self.__sth_wrong(11, f"无法找到请求 {msg_id} 的返回结果")
|
||||
|
Reference in New Issue
Block a user