测试模块
This commit is contained in:
@ -51,6 +51,11 @@ class InverterController:
|
||||
|
||||
def control(self, action):
|
||||
"""控制变频器启停"""
|
||||
# 先检查动作是否有效
|
||||
if action not in ['start', 'stop']:
|
||||
print(f"无效操作: {action}")
|
||||
return False
|
||||
|
||||
try:
|
||||
if not self.relay_controller.modbus_client.connect():
|
||||
print("无法连接网络继电器Modbus服务")
|
||||
@ -70,9 +75,6 @@ class InverterController:
|
||||
slave=self.config['slave_id']
|
||||
)
|
||||
print("停止变频器")
|
||||
else:
|
||||
print(f"无效操作: {action}")
|
||||
return False
|
||||
|
||||
if isinstance(result, Exception):
|
||||
print(f"控制失败: {result}")
|
||||
|
||||
Reference in New Issue
Block a user