forked from selenur/OLD---CNC-controller-version-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testSpeed.cs
59 lines (49 loc) · 2.21 KB
/
testSpeed.cs
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
using System;
using System.Windows.Forms;
namespace CNC_App
{
public partial class testSpeed : Form
{
public testSpeed()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (!Controller.Connected)
{
return;
}
int MaxSpeedX = (int)numericUpDown_maxSpeedX.Value;
int MaxSpeedY = (int)numericUpDown_maxSpeedX.Value;
int MaxSpeedZ = (int)numericUpDown_maxSpeedX.Value;
// start
Controller.SendBinaryData(BinaryData.pack_9E(0x05));
Controller.SendBinaryData(BinaryData.pack_BF(MaxSpeedX, MaxSpeedY, MaxSpeedZ,0));
Controller.SendBinaryData(BinaryData.pack_C0());
//move
int speed = (int)numericUpDown_Speed.Value;
//текущая точка
int posX0 = deviceInfo.CalcPosPulse("X", (decimal)numPosX0.Value);
int posY0 = deviceInfo.AxesY_PositionPulse;
int posZ0 = deviceInfo.AxesZ_PositionPulse;
//куда двигаться
int posX1 = deviceInfo.CalcPosPulse("X", (decimal)numPosX1.Value);
int posY1 = posY0;
int posZ1 = posZ0;
Controller.SendBinaryData(BinaryData.pack_CA(posX1, posY1, posZ1,0, speed, Task.posCodeNow, 0, 0));
Controller.SendBinaryData(BinaryData.pack_CA(posX1, posY1, posZ1,0, speed, Task.posCodeNow, 0, 0));
Controller.SendBinaryData(BinaryData.pack_CA(posX0, posY0, posZ0,0, speed, Task.posCodeNow, 0, 0));
Controller.SendBinaryData(BinaryData.pack_CA(posX0, posY0, posZ0,0, speed, Task.posCodeNow, 0, 0));
//stop
Controller.SendBinaryData(BinaryData.pack_FF());
Controller.SendBinaryData(BinaryData.pack_9D());
Controller.SendBinaryData(BinaryData.pack_9E(0x02));
Controller.SendBinaryData(BinaryData.pack_FF());
Controller.SendBinaryData(BinaryData.pack_FF());
Controller.SendBinaryData(BinaryData.pack_FF());
Controller.SendBinaryData(BinaryData.pack_FF());
Controller.SendBinaryData(BinaryData.pack_FF());
}
}
}