mirror of
				https://github.com/smyalygames/checklist-tester.git
				synced 2025-10-31 07:07:39 +01:00 
			
		
		
		
	feat(connector): add xpc commands
This commit is contained in:
		
							parent
							
								
									02d5ed8c35
								
							
						
					
					
						commit
						9fd9744f3a
					
				| @ -48,14 +48,14 @@ class TestScreenModel ( | |||||||
|                 posi[2] = altitude.toDouble() |                 posi[2] = altitude.toDouble() | ||||||
|                 posi[6] = 0.0 |                 posi[6] = 0.0 | ||||||
|                 xpc.setPOSI(posi) |                 xpc.setPOSI(posi) | ||||||
|  |                 delay(60000L) | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             val vdm = VDMJTransaction(actions = actions, xpc = xpc) |  | ||||||
|             val expected = vdm.expectedEndState() |  | ||||||
| 
 | 
 | ||||||
|             logger.debug { expected } | //            val vdm = VDMJTransaction(actions = actions, xpc = xpc) | ||||||
| 
 | //            val expected = vdm.expectedEndState() | ||||||
|             delay(5000L) | // | ||||||
|  | //            logger.debug { expected } | ||||||
| 
 | 
 | ||||||
|             // Starts the test in the database |             // Starts the test in the database | ||||||
|             interfaceState.testId = db.startTest(procedureId) |             interfaceState.testId = db.startTest(procedureId) | ||||||
| @ -89,20 +89,27 @@ class TestScreenModel ( | |||||||
|                 return@launch |                 return@launch | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|  |             val goal = action.goal.toInt() | ||||||
|  |             val isCommand = goal == -998 | ||||||
|  | 
 | ||||||
|             // Prerequisite before testing the action |             // Prerequisite before testing the action | ||||||
|             val initDref = xpc.getState(action.type)[0] |             val initDref = if (isCommand) goal else xpc.getState(action.type)[0] | ||||||
|             val actionTestId = db.startAction( |             val actionTestId = db.startAction( | ||||||
|                 testId = testId, |                 testId = testId, | ||||||
|                 actionId = action.id, |                 actionId = action.id, | ||||||
|                 initState = initDref.toString() |                 initState = initDref.toString() | ||||||
|             ) |             ) | ||||||
| 
 | 
 | ||||||
|             delay(1500L) |             delay(8000L) | ||||||
| 
 | 
 | ||||||
|             // Running the action in the simulator |             // Running the action in the simulator | ||||||
|             // TODO deal with action.goal being a String in the database |             // TODO deal with action.goal being a String in the database | ||||||
|             val goal = action.goal.toInt() |             val result: Float = if (!isCommand) { | ||||||
|             val result = xpc.runChecklist(action.type, goal)[0] |                 xpc.runChecklist(action.type, goal)[0] | ||||||
|  |             } else { | ||||||
|  |                 xpc.sendCOMM(action.type) | ||||||
|  |                 goal.toFloat() | ||||||
|  |             } | ||||||
| 
 | 
 | ||||||
|             // Saving result to the database |             // Saving result to the database | ||||||
|             db.finishAction( |             db.finishAction( | ||||||
|  | |||||||
| @ -74,6 +74,10 @@ class XPC { | |||||||
|         return result |         return result | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     fun sendCOMM(dref: String) { | ||||||
|  |         xpc.sendCOMM(dref) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     fun getPOSI(): DoubleArray { |     fun getPOSI(): DoubleArray { | ||||||
|         return xpc.getPOSI(0) |         return xpc.getPOSI(0) | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Anthony Berg
						Anthony Berg