From 273340189d381dcf55e42b1c1e641938b2ed55c3 Mon Sep 17 00:00:00 2001 From: surenjun Date: Mon, 27 Oct 2025 14:57:59 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E4=B8=B2=E5=8F=A3=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E6=97=B6=E6=9C=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/common/service/indexService.ts | 1 + entry/src/main/ets/common/service/initable.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/entry/src/main/ets/common/service/indexService.ts b/entry/src/main/ets/common/service/indexService.ts index f10a5294..4abacc93 100644 --- a/entry/src/main/ets/common/service/indexService.ts +++ b/entry/src/main/ets/common/service/indexService.ts @@ -444,6 +444,7 @@ function openChuankouFn(callback) { if(carInfo.kscx == 'C1'){ testNapi.SerialOpenAsync(devPath, (fd) => { globalThis.fd = fd; + globalThis.ChounkouInit = true; globalThis.num = 0 let parity = 0x4e; // 'N' let ret = testNapi.SerialSetAsync(globalThis.fd, 115200, 0, 8, 1, parity, (ret) => { diff --git a/entry/src/main/ets/common/service/initable.ts b/entry/src/main/ets/common/service/initable.ts index def04b15..27f2245b 100644 --- a/entry/src/main/ets/common/service/initable.ts +++ b/entry/src/main/ets/common/service/initable.ts @@ -32,6 +32,7 @@ import { GlobalConfig } from '../../config/index'; import prompt from '@ohos.promptAction' import DB, { ColumnType } from '../database/DbSql'; import { MA_SYS_SET_COLUMN } from '../../model/Table'; +import { getChuankouFn } from '../service/indexService' // @ts-nocheck //读表 @@ -455,6 +456,10 @@ export async function upDataZhongxinginitialization(param) { resolve(false) } } + // 初始化串口 + if(!globalThis.ChounkouInit){ + getChuankouFn() + } resolve(true) }).catch((Error) => { console.log("init table5", JSON.stringify(Error))