fix: 档位数据
This commit is contained in:
		
							parent
							
								
									4e3c3bf465
								
							
						
					
					
						commit
						02a8750ce6
					
				| @ -296,19 +296,26 @@ async function openChuankouFn() { | |||||||
|   console.log('daihairet', ret) |   console.log('daihairet', ret) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | let readSerials = true | ||||||
|  | 
 | ||||||
| async function getChuankouFnMsg() { | async function getChuankouFnMsg() { | ||||||
|  |   if (!readSerials) { | ||||||
|  |     return | ||||||
|  |   } | ||||||
|   let timeout = 5000; // 2秒超时
 |   let timeout = 5000; // 2秒超时
 | ||||||
|   let databuff = [0x61, 0xAA, 0x0A, 0X15, 0X00]; // send ABCDE
 |   let databuff = [0x61, 0xAA, 0x0A, 0X15, 0X00]; // send ABCDE
 | ||||||
|   let uint8Arr = new Uint8Array(databuff); |   let uint8Arr = new Uint8Array(databuff); | ||||||
|   console.log('daihai', globalThis.fd) |   console.log('daihai', globalThis.fd) | ||||||
|  |   readSerials = false | ||||||
|   let ret = await testNapi.SerialSend(globalThis.fd, uint8Arr); |   let ret = await testNapi.SerialSend(globalThis.fd, uint8Arr); | ||||||
|   console.log('daihai SerialSend ret: ' + ret) |   console.log('daihai SerialSend ret: ' + ret) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|   testNapi.SerialRecv(globalThis.fd, timeout, 12).then(revTestInfo => { |   testNapi.SerialRecv(globalThis.fd, timeout, 12).then(revTestInfo => { | ||||||
|  |     readSerials = true | ||||||
|     console.log('daihai', revTestInfo?.recevedBuf?.toString()) |     console.log('daihai', revTestInfo?.recevedBuf?.toString()) | ||||||
|     const message = revTestInfo?.recevedBuf?.toString() |     const message = revTestInfo?.recevedBuf?.toString() | ||||||
|     console.log("chuankou xinxi",message) |     console.log("chuankou xinxi", message) | ||||||
|     if (message == '') { |     if (message == '') { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
| @ -319,11 +326,14 @@ async function getChuankouFnMsg() { | |||||||
|     if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) { |     if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
|     console.log("chuankou 档位", msg[9]) |     console.log("chuankou xinxi 档位", msg[9]) | ||||||
|     if(msg[9]==0||msg[9]==1||msg[9]==2||msg[9]==3||msg[9]==4||msg[9]==5){ |     if (msg[9] == 0 || msg[9] == 1 || msg[9] == 2 || msg[9] == 3 || msg[9] == 4 || msg[9] == 5) { | ||||||
|  |       console.log("chuankou xinxi 111 message", message) | ||||||
|       globalThis.chuankoMsg = msg[9] |       globalThis.chuankoMsg = msg[9] | ||||||
|  |       console.log("chuankou xinxi 111 档位", msg[9]) | ||||||
|     } |     } | ||||||
|   }).catch((err) => { |   }).catch((err) => { | ||||||
|  |     readSerials = true | ||||||
|     console.log('daihaierror', JSON.stringify(err)) |     console.log('daihaierror', JSON.stringify(err)) | ||||||
|   }) |   }) | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user