新旧档位

This commit is contained in:
lixiao 2025-04-07 08:39:19 +08:00
parent c45de7c1bd
commit 3ecd0a2ef1
2 changed files with 11 additions and 10 deletions

View File

@ -301,16 +301,17 @@ function openChuankouFn(callback) {
}
function getChuankouFnMsg() {
testNapi.SerialRecvAsync(globalThis.fd, 5000, (revTestInfo) => {
const message = revTestInfo?.recevedBuf?.toString()
let msg = util.TextDecoder.create().decodeWithStream(new Uint8Array(revTestInfo?.recevedBuf))
let dang = Number(msg?.split(",")?.[1] || 0)
globalThis.chuankoMsg = dang
console.log("lixiao, chuankou", msg)
})
setTimeout(() => {
getChuankouFnMsg()
}, 200)
// 新档位
// testNapi.SerialRecvAsync(globalThis.fd, 5000, (revTestInfo) => {
// const message = revTestInfo?.recevedBuf?.toString()
// let msg = util.TextDecoder.create().decodeWithStream(new Uint8Array(revTestInfo?.recevedBuf))
// let dang = Number(msg?.split(",")?.[1] || 0)
// globalThis.chuankoMsg = dang
// console.log("lixiao, chuankou", msg)
// })
// setTimeout(() => {
// getChuankouFnMsg()
// }, 200)
let timeout = 50000; // 2秒超时
let databuff = [0x61, 0xAA, 0x0A, 0X15, 0X00]; // send ABCDE
testNapi.SerialSendAsync(globalThis.fd, databuff, (ret) => {