fix: 档位串口读取优化

This commit is contained in:
surenjun 2025-06-28 09:54:28 +08:00
parent e36b0f018b
commit 448a16fab9

View File

@ -433,19 +433,21 @@ let fd
const devPath = "/dev/ttyS3" const devPath = "/dev/ttyS3"
function openChuankouFn(callback) { function openChuankouFn(callback) {
console.log('SerialOpen in indexservice, path=' + devPath) getSyncData('ES_CARINFO').then(result => {
const carInfo = result[0] || {};
//自动挡车不读取串口 globalThis.carInfo.kscx = carInfo.kscx
if(globalThis.carInfo && globalThis.carInfo.kscx == 'C1'){ console.info('srj ES_CARINFO=>',JSON.stringify(carInfo))
testNapi.SerialOpenAsync(devPath, (fd) => { if(carInfo.kscx == 'C1'){
globalThis.fd = fd; testNapi.SerialOpenAsync(devPath, (fd) => {
globalThis.num = 0 globalThis.fd = fd;
let parity = 0x4e; // 'N' globalThis.num = 0
let ret = testNapi.SerialSetAsync(globalThis.fd, 115200, 0, 8, 1, parity, (ret) => { let parity = 0x4e; // 'N'
callback() let ret = testNapi.SerialSetAsync(globalThis.fd, 115200, 0, 8, 1, parity, (ret) => {
callback()
});
}); });
}); }
} })
} }
function getChuankouFnMsg() { function getChuankouFnMsg() {