diff options
author | David Crocker <dcrocker@eschertech.com> | 2019-04-23 01:11:52 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2019-04-23 01:11:52 +0300 |
commit | cb0a782b673773037185ff73e53230251c2dff51 (patch) | |
tree | d8485db2ff5799a34fa0474f9264945ba70e4442 /src/Endstops/EndstopDefs.h | |
parent | 6814c342969a471fa3b32c5e859f66b528de1131 (diff) |
Duet 3 initial working build
Only the Duet_NG configuration builds at present.
New features:
- Pins are named instead of numbered
- Support multiple endstops per axis
- Support multiple Z probes
- Support M950 for heater and fan mapping
- GPIO pins now need to be allocated before they can be used by M42 or M280
- Laser power velocity ramping
- New codes for 12864 display
- Added LinearAnalogSensor
- Height following mode is mostly implemented
Bug fixes:
- M109 didn't run the tool change files if no tool was selected initially
- The M290 command written to resurrect.g didn't use absolute babystepping
- The M32 command written to resurrect.g didn't quote the filename
- M291 no longer locks the movement system, it stopped the jog buttons working
- M302 now waits for standstill
Diffstat (limited to 'src/Endstops/EndstopDefs.h')
-rw-r--r-- | src/Endstops/EndstopDefs.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/src/Endstops/EndstopDefs.h b/src/Endstops/EndstopDefs.h new file mode 100644 index 00000000..8264e861 --- /dev/null +++ b/src/Endstops/EndstopDefs.h @@ -0,0 +1,88 @@ +/* + * EndstopDefs.h + * + * Created on: 5 Apr 2019 + * Author: David + */ + +#ifndef SRC_ENDSTOPS_ENDSTOPDEFS_H_ +#define SRC_ENDSTOPS_ENDSTOPDEFS_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 + reduceSpeed = 1, // reduce speed because an endstop or Z probe is close to triggering + stopDriver = 2, // stop a single motor driver + stopAxis = 3, // stop all drivers for an axis + stopAll = 4 // stop movement completely +}; + +// Struct that fits in a single register, to return info about what endstop has been triggered and what to do about it +struct EndstopHitDetails +{ + EndstopHitDetails() : action((uint32_t)EndstopHitAction::none), internalUse(0), driver(0), axis(0), setAxisLow(false), setAxisHigh(false) { } + + void SetAction(EndstopHitAction a) { action = (uint32_t)a; } + EndstopHitAction GetAction() const { return (EndstopHitAction)action; } + + uint32_t action : 4, // an EndstopHitAction + internalUse : 4, // used to pass data between CheckTriggered() and Acknowledge() + driver : 8, // which driver to stop if the action is stopDriver, or if it is a stall detection endstop + axis : 8, // which axis to stop if the action is stopAxis, and which axis to set the position of if setAxisPos 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 +}; + +// 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 +enum class EndStopInputType : unsigned int +{ + activeLow = 0, + activeHigh = 1, + zProbeAsEndstop = 2, + motorStall = 3, + numInputTypes = 4, + realZProbe = 100 +}; + +// This is used as the return type of function Stopped. +// Note the ordering: we need more-stopped-value > less-stopped-value +enum class EndStopHit +{ + noStop = 0, // no endstop hit + nearStop = 1, // approaching Z-probe threshold + atStop = 2 +}; + +enum class ZProbeType : uint8_t +{ + none = 0, + analog = 1, + dumbModulated = 2, + alternateAnalog = 3, + endstopSwitch = 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_ */ |