fix: 档位信号处理,信号显示界面无法进入问题解决
This commit is contained in:
		
							parent
							
								
									c717b169d0
								
							
						
					
					
						commit
						b92d31b661
					
				| @ -5,7 +5,6 @@ import apiJudgeSdk from 'libJudgeSdk.so' | ||||
| import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker' | ||||
| import { examJudgeMapSetScaling } from '../Judge/JudgeUtils' | ||||
| import { dConsole } from '../../utils/LogWorker' | ||||
| import { SignDisplayTag } from '../../config' | ||||
| 
 | ||||
| 
 | ||||
| @Component | ||||
| @ -24,20 +23,14 @@ export default struct SignalDisplayComponent { | ||||
|   @State laneSignal: PerLane = InitialPerLane | ||||
| 
 | ||||
|   aboutToAppear(): void { | ||||
|     DifferentialAndSignal.onMsg(this.getMsg) | ||||
|   } | ||||
| 
 | ||||
|   getMsg(data: string) { | ||||
|     const result: WorkerBackMessage = JSON.parse(data) | ||||
|     dConsole.log(SignDisplayTag, "wzj", data) | ||||
|     if (result.type === "obtainUdpData") { | ||||
|       this.getSignal(result.data as string) | ||||
|       this.rawData = result.data as string | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   aboutToDisappear(): void { | ||||
|     DifferentialAndSignal.offMsg(this.getMsg) | ||||
|     DifferentialAndSignal.onMsg((data: string) => { | ||||
|       const result: WorkerBackMessage = JSON.parse(data) | ||||
|       dConsole.log("wzj", data) | ||||
|       if (result.type === "obtainUdpData") { | ||||
|         this.getSignal(result.data as string) | ||||
|         this.rawData = result.data as string | ||||
|       } | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|   getSignal = (msg: string) => { | ||||
| @ -46,9 +39,11 @@ export default struct SignalDisplayComponent { | ||||
|       return | ||||
|     } | ||||
|     this.signArr = newArr | ||||
| 
 | ||||
|     for (let i = 0; i <= 12; i++) { | ||||
|       this.vehicleSignal[i].value = this.signArr[i+2] | ||||
|     } | ||||
| 
 | ||||
|     this.vehicleSignal[13].value = this.signArr[17] | ||||
|     this.vehicleSignal[14].value = this.signArr[18] | ||||
|     this.vehicleSignal[15].value = this.signArr[19] | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user