调试更改+挡板电机添加线程和配置文件

This commit is contained in:
2026-03-24 16:52:10 +08:00
parent e7e6693798
commit 91b1b394bb
19 changed files with 1125 additions and 252 deletions

View File

@ -110,6 +110,7 @@ sensor_name_map = {
CONVEYOR2_SENSOR: '传送带2开关'
}
class RelayController:
def __init__(self):
"""初始化继电器控制器"""
@ -253,6 +254,7 @@ class RelayController:
# private
_GLOBAL_RELAY = RelayController()
def ng_push():
"""NG推料流程"""
try:
@ -272,6 +274,7 @@ def ng_push():
print(f"NG推料失败:{e}")
raise RuntimeError("NG推料流程异常") from e
def write_do(device_name: str, state: bool):
"""
控制单个数字输出设备DO的开关状态
@ -297,6 +300,7 @@ def write_do(device_name: str, state: bool):
except Exception as e:
raise RuntimeError(f"控制设备 '{device_name}' 失败: {e}")
def read_all_io() -> dict[str, dict[str, bool]]:
"""
读取所有DI传感器和DO设备状态
@ -314,6 +318,7 @@ def read_all_io() -> dict[str, dict[str, bool]]:
print(f"读取IO状态失败:{e}")
raise RuntimeError("读取IO失败") from e
# ------------测试接口-------------
if __name__ == '__main__':