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/EndstopsManager.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/EndstopsManager.h')
-rw-r--r-- | src/Endstops/EndstopsManager.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/Endstops/EndstopsManager.h b/src/Endstops/EndstopsManager.h new file mode 100644 index 00000000..3eecc28a --- /dev/null +++ b/src/Endstops/EndstopsManager.h @@ -0,0 +1,78 @@ +/* + * Endstop.h + * + * Created on: 3 Apr 2019 + * Author: David + */ + +#ifndef SRC_ENDSTOPS_ENDSTOPMANAGER_H_ +#define SRC_ENDSTOPS_ENDSTOPMANAGER_H_ + +#include "RepRapFirmware.h" +#include "EndstopDefs.h" +#include "ZProbeProgrammer.h" +#include "GCodes/GCodeResult.h" + +// Endstop manager class +class EndstopsManager +{ +public: + EndstopsManager(); + + void Init(); + + // Set up the active endstop list according to the axes commanded to move in a G0/G1 S1/S3 command + void EnableAxisEndstops(AxesBitmap axes); + + // Set up the active endstops for Z probing + void EnableZProbe(size_t probeNumber); + + // Set up the active endstops for Z probing with the current probe + void EnableCurrentZProbe() { EnableZProbe(currentZProbeNumber); } + +#ifndef NO_EXTRUDER_ENDSTOPS + // Enable extruder endstops + void EnableExtruderEndstop(size_t extruder); +#endif + + // Get the first endstop that has triggered and remove it from the active list if appropriate + EndstopHitDetails CheckEndstops(bool goingSlow); + + // Configure the endstops in response to M574 + GCodeResult HandleM574(GCodeBuffer& gb, const StringRef& reply); + + EndStopPosition GetEndStopPosition(size_t axis) const pre(axis < MaxAxes); + bool HomingZWithProbe() const; + + EndStopHit Stopped(size_t axis) const; + + void GetM119report(const StringRef& reply); + + // Z probe + GCodeResult HandleM558(GCodeBuffer& gb, const StringRef &reply); // M558 + GCodeResult HandleG31(GCodeBuffer& gb, const StringRef& reply); // G31 + + bool AssignZProbePorts(GCodeBuffer& gb, const StringRef& reply, size_t probeNumber); + ZProbe& GetCurrentZProbe() const { return *zProbes[currentZProbeNumber]; } + ZProbe *GetZProbe(size_t num) const; + void SetZProbeDefaults(); + GCodeResult ProgramZProbe(GCodeBuffer& gb, const StringRef& reply); + bool WriteZProbeParameters(FileStore *f, bool includingG31) const; + +private: + // Add an endstop to the active list + void AddToActive(EndstopOrZProbe& e); + + // Translate end stop result to text + static const char *TranslateEndStopResult(EndStopHit es, bool atHighEnd); + + EndstopOrZProbe * volatile activeEndstops; // linked list of endstops and Z probes that are active for the current move + size_t currentZProbeNumber; // which Z probe we are using + + Endstop *axisEndstops[MaxAxes]; // the endstops assigned to each axis (each one may have several switches), each may be null + ZProbe *zProbes[MaxZProbes]; // the Z probes used. The first one is always non-null. + + ZProbeProgrammer zProbeProg; +}; + +#endif /* SRC_ENDSTOPS_ENDSTOPMANAGER_H_ */ |