Localize M119 in Endstops class
This commit is contained in:
parent
5e4e535ce8
commit
5076d12344
@ -4969,41 +4969,7 @@ inline void gcode_M117() {
|
||||
/**
|
||||
* M119: Output endstop states to serial output
|
||||
*/
|
||||
inline void gcode_M119() {
|
||||
SERIAL_PROTOCOLLN(MSG_M119_REPORT);
|
||||
#if HAS_X_MIN
|
||||
SERIAL_PROTOCOLPGM(MSG_X_MIN);
|
||||
SERIAL_PROTOCOLLN(((READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
||||
#endif
|
||||
#if HAS_X_MAX
|
||||
SERIAL_PROTOCOLPGM(MSG_X_MAX);
|
||||
SERIAL_PROTOCOLLN(((READ(X_MAX_PIN)^X_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
||||
#endif
|
||||
#if HAS_Y_MIN
|
||||
SERIAL_PROTOCOLPGM(MSG_Y_MIN);
|
||||
SERIAL_PROTOCOLLN(((READ(Y_MIN_PIN)^Y_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
||||
#endif
|
||||
#if HAS_Y_MAX
|
||||
SERIAL_PROTOCOLPGM(MSG_Y_MAX);
|
||||
SERIAL_PROTOCOLLN(((READ(Y_MAX_PIN)^Y_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
||||
#endif
|
||||
#if HAS_Z_MIN
|
||||
SERIAL_PROTOCOLPGM(MSG_Z_MIN);
|
||||
SERIAL_PROTOCOLLN(((READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
||||
#endif
|
||||
#if HAS_Z_MAX
|
||||
SERIAL_PROTOCOLPGM(MSG_Z_MAX);
|
||||
SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
||||
#endif
|
||||
#if HAS_Z2_MAX
|
||||
SERIAL_PROTOCOLPGM(MSG_Z2_MAX);
|
||||
SERIAL_PROTOCOLLN(((READ(Z2_MAX_PIN)^Z2_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
||||
#endif
|
||||
#if HAS_Z_PROBE
|
||||
SERIAL_PROTOCOLPGM(MSG_Z_PROBE);
|
||||
SERIAL_PROTOCOLLN(((READ(Z_MIN_PROBE_PIN)^Z_MIN_PROBE_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
||||
#endif
|
||||
}
|
||||
inline void gcode_M119() { endstops.M119(); }
|
||||
|
||||
/**
|
||||
* M120: Enable endstops and set non-homing endstop state to "enabled"
|
||||
|
@ -157,6 +157,42 @@ void Endstops::report_state() {
|
||||
}
|
||||
} // Endstops::report_state
|
||||
|
||||
void Endstops::M119() {
|
||||
SERIAL_PROTOCOLLN(MSG_M119_REPORT);
|
||||
#if HAS_X_MIN
|
||||
SERIAL_PROTOCOLPGM(MSG_X_MIN);
|
||||
SERIAL_PROTOCOLLN(((READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
||||
#endif
|
||||
#if HAS_X_MAX
|
||||
SERIAL_PROTOCOLPGM(MSG_X_MAX);
|
||||
SERIAL_PROTOCOLLN(((READ(X_MAX_PIN)^X_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
||||
#endif
|
||||
#if HAS_Y_MIN
|
||||
SERIAL_PROTOCOLPGM(MSG_Y_MIN);
|
||||
SERIAL_PROTOCOLLN(((READ(Y_MIN_PIN)^Y_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
||||
#endif
|
||||
#if HAS_Y_MAX
|
||||
SERIAL_PROTOCOLPGM(MSG_Y_MAX);
|
||||
SERIAL_PROTOCOLLN(((READ(Y_MAX_PIN)^Y_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
||||
#endif
|
||||
#if HAS_Z_MIN
|
||||
SERIAL_PROTOCOLPGM(MSG_Z_MIN);
|
||||
SERIAL_PROTOCOLLN(((READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
||||
#endif
|
||||
#if HAS_Z_MAX
|
||||
SERIAL_PROTOCOLPGM(MSG_Z_MAX);
|
||||
SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
||||
#endif
|
||||
#if HAS_Z2_MAX
|
||||
SERIAL_PROTOCOLPGM(MSG_Z2_MAX);
|
||||
SERIAL_PROTOCOLLN(((READ(Z2_MAX_PIN)^Z2_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
||||
#endif
|
||||
#if HAS_Z_PROBE
|
||||
SERIAL_PROTOCOLPGM(MSG_Z_PROBE);
|
||||
SERIAL_PROTOCOLLN(((READ(Z_MIN_PROBE_PIN)^Z_MIN_PROBE_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
||||
#endif
|
||||
} // Endstops::M119
|
||||
|
||||
// Check endstops - Called from ISR!
|
||||
void Endstops::update() {
|
||||
|
||||
|
@ -70,6 +70,11 @@ class Endstops {
|
||||
*/
|
||||
void report_state(); //call from somewhere to create an serial error message with the locations the endstops where hit, in case they were triggered
|
||||
|
||||
/**
|
||||
* Report endstop positions in response to M119
|
||||
*/
|
||||
void M119();
|
||||
|
||||
// Enable / disable endstop checking globally
|
||||
FORCE_INLINE void enable_globally(bool onoff=true) { enabled_globally = enabled = onoff; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user