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
|
/*
* EndstopDefs.h
*
* Created on: 5 Apr 2019
* Author: David
*/
#ifndef SRC_ENDSTOPS_ENDSTOPDEFS_H_
#define SRC_ENDSTOPS_ENDSTOPDEFS_H_
#include <General/NamedEnum.h>
// Forward declarations
class EndstopOrZProbe;
class Endstop;
class ZProbe;
// Actions to take when an endstop is triggered. Note, these values are ordered!
enum class EndstopHitAction : uint8_t
{
none = 0, // don't stop anything
stopDriver = 1, // stop a single motor driver
stopAxis = 2, // stop all drivers for an axis
stopAll = 3 // stop movement completely
};
// Struct to return info about what endstop has been triggered and what to do about it
struct EndstopHitDetails
{
EndstopHitDetails() noexcept : action((uint32_t)EndstopHitAction::none), internalUse(0), axis(NO_AXIS), setAxisLow(false), setAxisHigh(false), isZProbe(false)
{
}
void SetAction(EndstopHitAction a) noexcept { action = (uint32_t)a; }
EndstopHitAction GetAction() const noexcept { return (EndstopHitAction)action; }
uint16_t action : 2, // an EndstopHitAction
internalUse : 4, // used to pass the port index between CheckTriggered() and Acknowledge()
axis : 6, // which axis to stop if the action is stopAxis, and which axis to set the position of if setAxisLow or SetAxisHigh is true
setAxisLow : 1, // whether or not to set the axis position to its min
setAxisHigh : 1, // whether or not to set the axis position to its max
isZProbe : 1; // whether this is a Z probe
DriverId driver;
};
// The values of the following enumeration must tally with the X,Y,... parameters for the M574 command
enum class EndStopPosition : unsigned int
{
noEndStop = 0,
lowEndStop = 1,
highEndStop = 2,
numPositions = 3
};
// Type of an endstop input - values must tally with the M574 command S parameter
NamedEnum
( EndStopType, unsigned int,
unused_wasActiveLow,
inputPin,
zProbeAsEndstop,
motorStallAny,
motorStallIndividual,
numInputTypes
);
enum class ZProbeType : uint8_t
{
none = 0,
analog = 1,
dumbModulated = 2,
alternateAnalog = 3,
endstopSwitch_obsolete = 4,
digital = 5,
e1Switch_obsolete = 6,
zSwitch_obsolete = 7,
unfilteredDigital = 8,
blTouch = 9,
zMotorStall = 10,
numTypes = 11 // must be 1 higher than the last type
};
#endif /* SRC_ENDSTOPS_ENDSTOPDEFS_H_ */
|