基本跑通

This commit is contained in:
Developer
2026-07-07 15:26:23 +08:00
parent ee19d2fdfa
commit a33cc60b9d
2 changed files with 10 additions and 1 deletions
@@ -371,6 +371,15 @@ public class Ch934xSerialPlugin implements FlutterPlugin, MethodCallHandler, Act
// 注意:不注册 IDataCallback — SDK 在有回调注册时会通过回调
// 投递数据并释放内部缓冲区,导致 readData() 返回空。
// 通过 dataStream 轮询 readData() 拉取数据。
// 配置串口参数:115200, 8数据位, 1停止位, 无校验, 关闭流控
try {
CH934XManager.getInstance().setSerialParameter(
activeDevice, activeSerialNumber, 115200, 8, 1, 0, false);
} catch (Exception ignored) {
// 设置失败不影响串口使用(使用芯片默认值)
}
ensureModemCallback();
return true;
}