aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Stubs Collection/stubs/MarkHome.cs
blob: 23f59a674868f614a87e61c72be10df6fede12af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using System;
using System.Text;
using System.Linq;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using Tango.PMR.Stubs;
using Tango.Stubs.UI;

public void OnExecute(StubManager stubManager)
{

	// UInt32 : MotorID
	// UInt32 : MicroSteps
	// Boolean : SetMicroSteps
	// UInt32 : ACC
	// Boolean : SetACC
	// UInt32 : DEC
	// Boolean : SetDec
	// UInt32 : MaxSpeed
	// Boolean : SetMaxSpeed
	stubManager.Run("StubMotorInitRequest" ,0, 0, false, 0, false, 0, false, 0, false);	// UInt32 : MotorID
	
	
	//Thread.Sleep(1000);
// Request ----
// UInt32 : MotorID
// UInt32 : SetHomeMarkGOHomeMark

// Response ----
// UInt32 : MotorID
// UInt32 : Position
var response5 = stubManager.Run<StubMotorHomeMarkResponse>("StubMotorHomeMarkRequest" ,1, 0);//set home

var max_speed  = 1000;

	// Request ----
// UInt32 : MotorID
// Boolean : Direction
// UInt32 : Position
	stubManager.RequestTimeout=5000;
	
		    for (int i = 0; i < 20; i++)
    {
		// Response ----
		// UInt32 : MotorID
		// UInt32 : Position
		// UInt32 : StatusReg
		// Boolean : Direction
		// UInt32 : MotStatus
		// Boolean : STEPLOSSA
		// Boolean : STEPLOSSB
		var response2 = stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,1, true, 60000);
		
		stubManager.Run("StubMotorStopRequest" ,111, 1); // 0 - SoftHiZ / 1 - HardHiZ  / 2 - SoftStop / 3 - HardStop
		
		
		
		max_speed = max_speed -100;
		stubManager.Run("StubMotorInitRequest" ,0, 0, false, 0, false, 0, false, max_speed, true);	// UInt32 : MotorID
		// Request ----
		// UInt32 : MotorID
		// UInt32 : SetHomeMarkGOHomeMark
		
		// Response ----
		// UInt32 : MotorID
		// UInt32 : Position
		var response3 = stubManager.Run<StubMotorHomeMarkResponse>("StubMotorHomeMarkRequest" ,1, 2);//go home
	}
}