aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Stubs Collection/stubs/mot run.cs
blob: b9c2c938c098835237cc794f738d788264a13835 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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;

public void OnExecute(StubManager stubManager)
{

//stubManager.Run("StubMotorStopRequest" ,22, 1); // 0 - SoftHiZ / 1 - HardHiZ  / 2 - SoftStop / 3 - HardStop
//Thread.Sleep(1000);

// Request ----
// UInt32 : MotorID
// UInt32 : MicroSteps
// Boolean : SetMicroSteps
// UInt32 : ACC
// Boolean : SetACC
// UInt32 : DEC
// Boolean : SetDec
// UInt32 : MaxSpeed
// Boolean : SetMaxSpeed

	//stubManager.Run<StubMotorInitResponse>("StubMotorInitRequest" ,22, 1, true, 0x0ff, true, 0x0ff, true, 0x3ff, true);	// 0x3ff for QSH2818-32-07-006 roker
	//stubManager.Run<StubMotorInitResponse>("StubMotorInitRequest" ,21, 0, true, 0x0ff, true, 0x0ff, true, 50000, true);	// fidder
	//stubManager.Run<StubMotorInitResponse>("StubMotorInitRequest" ,0, 0, true, 0, true, 0, true, 0, true);
	
	// Request ----
// UInt32 : MotorID
// UInt32 : MicroSteps
// Boolean : SetMicroSteps
// UInt32 : ACC
// Boolean : SetACC
// UInt32 : DEC
// Boolean : SetDec
// UInt32 : MaxSpeed
// Boolean : SetMaxSpeed
// UInt32 : MinSpeedLSPDOPT
// Boolean : SetMinSpeedLSPDOPT
// UInt32 : Config
// UInt32 : KVALHOLD
// UInt32 : KVALRUN
// UInt32 : KVALACC
// UInt32 : KVALDEC
// UInt32 : STSLP
// UInt32 : INTSPD
// UInt32 : FNSLPACC
// UInt32 : FNSLPDEC

// Response ----
// UInt32 : MotorID
// UInt32 : Status

	
	//stubManager.Run<StubMotorInitResponse>("StubMotorInitRequest" ,18, 0, true, 0x0ff, true, 0x0ff, true, 50000, true, 0, true, 1, 1, 1, 1, 1, 1, 1, 1, 1);
	
	//stubManager.Run("StubMotorStopRequest" ,18, 1); // 0 - SoftHiZ / 1 - HardHiZ  / 2 - SoftStop / 3 - HardStop
	
	//Thread.Sleep(1000);
	
	for (int i= 0 ;i<10;i++)
		{
	stubManager.Run("StubMotorRunRequest" ,14, false, 8000 ); //5000 fidder (18 TESTED)
	Thread.Sleep(590);
	var response = stubManager.Run<StubMotorSpeedResponse>("StubMotorSpeedRequest" ,14);
	stubManager.Write(response.Speed);
		stubManager.Write("\n\n");

	Thread.Sleep(10);
	
	stubManager.Run("StubMotorRunRequest" ,14, true, 8000 ); //5000 fidder (18 TESTED)
	Thread.Sleep(600);
	}
	//stubManager.Run<StubMotorStatusResponse>("StubMotorStatusRequest" ,15, true);
	
	//Thread.Sleep(1000);
	// Request ----
// UInt32 : MotorID

// Response ----
// UInt32 : MotorID
// Double : Speed
	//stubManager.Run<StubMotorSpeedResponse>("StubMotorSpeedRequest" ,15);
	
stubManager.Run("StubMotorStopRequest" ,14, 2); // 3 - SoftHiZ / 2 - HardHiZ  / 1 - SoftStop / 0 - HardStop
}