新旧档位

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