blob: 76781ca8e137b0197797dd57cdace30049261841 (
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
|
package org.reprap.devices;
/**
* Tiny class to hold the length of filament that an extruder has extruded so far, and
* other aspects of the state of the extruder. This is used in the extruder class.
* All logical extruders that correspond to one physical extruder share a single instance of
* this class. This means that (for example) setting the temperature of one will be reflected
* automatically in all the others.
*
* @author Adrian
*
*/
public class ExtruderState
{
private double l; // Extruded length
private double tt; // Set temperature
private double ct; // Current temperature
private double s; // Motor speed
private boolean r; // Are we going backwards?
private boolean e; // Are we extrudeing
private int pe; // The physical extruder
ExtruderState(int physEx)
{
l = 1;
tt = 0;
ct = 0;
s = 0;
r = false;
e = false;
pe = physEx;
}
public int physicalExtruder()
{
return pe;
}
public double length()
{
return l;
}
public double targetTemperature()
{
return tt;
}
public double currentTemperature()
{
return ct;
}
public double speed()
{
return s;
}
public boolean reverse()
{
return r;
}
public boolean isExtruding()
{
return e;
}
public void add(double e)
{
l += e;
}
public void zero()
{
l = 0;
}
public void setTargetTemperature(double temp)
{
tt = temp;
}
public void setCurrentTemperature(double temp)
{
ct = temp;
}
public void setSpeed(double sp)
{
s = sp;
}
public void setReverse(boolean rev)
{
r = rev;
}
public void setExtruding(boolean ex)
{
e = ex;
}
}
|