summaryrefslogtreecommitdiff
path: root/trunk/software/host/src/org/reprap/AxisMotor.java
blob: a5a37dfde091233d7e70353f3c328d06937001f4 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package org.reprap;

import java.io.IOException;
import org.reprap.ReprapException;
import org.reprap.comms.IncomingMessage.InvalidPayloadException;

public interface AxisMotor {


	/**
	 * Dispose of this object
	 */
	public void dispose(); 
	
	
	/**
	 * 
	 *
	 */
	public void waitTillNotBusy() throws IOException;
	
	/**
	 * Reload the preferences
	 *
	 */
	public void refreshPreferences();

	
	/**
	 * Add an XY point to the firmware buffer for plotting
	 * Only works for recent firmware.
	 * 
	 * @param endX
	 * @param endY
	 * @param movementSpeed
	 * @return
	 */
	public boolean queuePoint(int endX, int endY, int movementSpeed, int control) throws IOException; 

	
	/**
	 * Set the motor speed (or turn it off) 
	 * @param speed A value between -255 and 255.
	 * @throws ReprapException
	 * @throws IOException
	 */
	public void setSpeed(int speed) throws IOException; 

	/**
	 * @throws IOException
	 */
	public void setIdle() throws IOException; 
	
	/**
	 * @throws IOException
	 */
	public void stepForward() throws IOException; 
	
	/**
	 * @throws IOException
	 */
	public void stepBackward() throws IOException; 
	
	/**
	 * @throws IOException
	 */
	public void resetPosition() throws IOException; 
	
	/**
	 * @param position
	 * @throws IOException
	 */
	public void setPosition(int position) throws IOException;
	
	/**
	 * Is the comms working?
	 * @return
	 */
	public boolean isAvailable();
	public boolean wasAvailable();
	
	/**
	 * @return current position of the motor
	 * @throws IOException
	 */
	public int getPosition() throws IOException; 
	
	/**
	 * @param speed
	 * @param position
	 * @throws IOException
	 */
	public void seek(int speed, int position) throws IOException; 
	/**
	 * @param speed
	 * @param position
	 * @throws IOException
	 */
	public void seekBlocking(int speed, int position) throws IOException; 

	/**
	 * @param speed
	 * @return range of the motor
	 * @throws IOException
	 * @throws InvalidPayloadException
	 */
	public Range getRange(int speed) throws IOException, InvalidPayloadException; 
	
	/**
	 * @param speed
	 * @throws IOException
	 * @throws InvalidPayloadException
	 */
	public void homeReset(int speed) throws IOException, InvalidPayloadException; 
	
	/**
	 * @param syncType
	 * @throws IOException
	 */
	public void setSync(byte syncType) throws IOException; 
	
	/**
	 * @param speed
	 * @param x1
	 * @param deltaY
	 * @throws IOException
	 */
	public void dda(int speed, int x1, int deltaY) throws IOException; 

	/**
	 * 
	 * @param maxTorque An integer value 0 to 100 representing the maximum torque percentage
	 * @throws IOException
	 */
	public void setMaxTorque(int maxTorque) throws IOException; 
	
	public class Range {
		
		/**
		 * 
		 */
		public int minimum;
		
		/**
		 * 
		 */
		public int maximum;
		
		public Range()
		{
			minimum = 0;
			maximum = 0;
		}
	}

}