123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
-
-
-
-
- #ifndef ENDSTOPS_H
- #define ENDSTOPS_H
-
- enum EndstopEnum {X_MIN = 0, Y_MIN = 1, Z_MIN = 2, Z_MIN_PROBE = 3, X_MAX = 4, Y_MAX = 5, Z_MAX = 6, Z2_MIN = 7, Z2_MAX = 8};
-
- class Endstops {
-
- public:
-
- volatile char endstop_hit_bits;
-
- #if ENABLED(Z_DUAL_ENDSTOPS)
- uint16_t current_endstop_bits = 0,
- old_endstop_bits = 0;
- #else
- byte current_endstop_bits = 0,
- old_endstop_bits = 0;
- #endif
-
-
- bool enabled = true;
- bool enabled_globally =
- #if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
- false
- #else
- true
- #endif
- ;
-
- Endstops();
-
-
-
- void init();
-
-
-
- void update();
-
-
-
- void report_state();
-
-
-
- void M119();
-
-
- FORCE_INLINE void enable_globally(bool onoff=true) { enabled_globally = enabled = onoff; }
-
-
- FORCE_INLINE void enable(bool onoff=true) { enabled = onoff; }
-
-
- FORCE_INLINE void not_homing() { enabled = enabled_globally; }
-
-
- FORCE_INLINE void hit_on_purpose() { endstop_hit_bits = 0; }
-
-
- #if ENABLED(HAS_Z_MIN_PROBE)
- volatile bool z_probe_enabled = false;
- FORCE_INLINE void enable_z_probe(bool onoff=true) { z_probe_enabled = onoff; }
- #endif
-
- private:
-
- #if ENABLED(Z_DUAL_ENDSTOPS)
- void test_dual_z_endstops(EndstopEnum es1, EndstopEnum es2);
- #endif
- };
-
- extern Endstops endstops;
-
- #endif // ENDSTOPS_H
|