COT001\DEV 2026-03-31 13:35:42 +08:00
parent 316dc36077
commit 8c57551006
3 changed files with 4234 additions and 4 deletions

View File

@ -9,8 +9,8 @@ from serial_manager import SerialManager
class ConfigService:
"""配置服务类 - 专注于配置管理,通过回调与串口通信"""
def __init__(self, default_config_path=None, host="127.0.0.1",
port=5000, debug=False, logger=None,
def __init__(self, default_config_path=None, host="0.0.0.0",
port=5000, debug=False, logger=True,
serial_command_callback=None):
"""
初始化配置服务
@ -25,7 +25,7 @@ class ConfigService:
"""
self.app = Flask(__name__)
CORS(self.app)
print("===========================================host:",host)
# 服务配置
self.host = host
self.port = port
@ -507,9 +507,10 @@ def main():
# 创建串口管理器(单例,只会初始化一次)
serial_manager = SerialManager(port="COM1", baudrate=9600) # 根据实际情况修改端口
print("===========================================")
# 创建配置服务,传入串口命令回调
config_service = ConfigService(
host="127.0.0.1",
host="0.0.0.0",
port=5000,
debug=False,
serial_command_callback=serial_command_handler

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff