G425 — Auto-calibrate Backlash and Nozzle Offsets (#13050)

This commit is contained in:
Marcio Teixeira
2019-02-06 16:20:17 -07:00
committed by Scott Lahteine
parent 113af46a1b
commit e1604198ff
77 changed files with 4334 additions and 3 deletions

View File

@ -218,6 +218,16 @@ void Endstops::init() {
#endif
#endif
#if HAS_CALIBRATION_PIN
#if ENABLED(CALIBRATION_PIN_PULLUP)
SET_INPUT_PULLUP(CALIBRATION_PIN);
#elif ENABLED(CALIBRATION_PIN_PULLDOWN)
SET_INPUT_PULLDOWN(CALIBRATION_PIN);
#else
SET_INPUT(CALIBRATION_PIN);
#endif
#endif
#if ENABLED(Z_MIN_PROBE_ENDSTOP)
#if ENABLED(ENDSTOPPULLUP_ZMIN_PROBE)
SET_INPUT_PULLUP(Z_MIN_PROBE_PIN);

View File

@ -97,6 +97,8 @@ class Endstops {
);
}
static inline bool global_enabled() { return enabled_globally; }
/**
* Periodic call to poll endstops if required. Called from temperature ISR
*/
@ -173,3 +175,17 @@ class Endstops {
};
extern Endstops endstops;
/**
* A class to save and change the endstop state,
* then restore it when it goes out of scope.
*/
class TemporaryGlobalEndstopsState {
bool saved;
public:
TemporaryGlobalEndstopsState(const bool enable) : saved(endstops.global_enabled()) {
endstops.enable_globally(enable);
}
~TemporaryGlobalEndstopsState() { endstops.enable_globally(saved); }
};