My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

endstops.h 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. /**
  23. * endstops.h - manages endstops
  24. */
  25. #ifndef ENDSTOPS_H
  26. #define ENDSTOPS_H
  27. #include "enum.h"
  28. class Endstops {
  29. public:
  30. static bool enabled, enabled_globally;
  31. static volatile char endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT value
  32. #if ENABLED(Z_DUAL_ENDSTOPS)
  33. static uint16_t
  34. #else
  35. static byte
  36. #endif
  37. current_endstop_bits, old_endstop_bits;
  38. Endstops() {};
  39. /**
  40. * Initialize the endstop pins
  41. */
  42. void init();
  43. /**
  44. * Update the endstops bits from the pins
  45. */
  46. static void update();
  47. /**
  48. * Print an error message reporting the position when the endstops were last hit.
  49. */
  50. static void report_state(); //call from somewhere to create an serial error message with the locations the endstops where hit, in case they were triggered
  51. /**
  52. * Report endstop positions in response to M119
  53. */
  54. static void M119();
  55. // Enable / disable endstop checking globally
  56. static void enable_globally(bool onoff=true) { enabled_globally = enabled = onoff; }
  57. // Enable / disable endstop checking
  58. static void enable(bool onoff=true) { enabled = onoff; }
  59. // Disable / Enable endstops based on ENSTOPS_ONLY_FOR_HOMING and global enable
  60. static void not_homing() { enabled = enabled_globally; }
  61. // Clear endstops (i.e., they were hit intentionally) to suppress the report
  62. static void hit_on_purpose() { endstop_hit_bits = 0; }
  63. // Enable / disable endstop z-probe checking
  64. #if HAS_BED_PROBE
  65. static volatile bool z_probe_enabled;
  66. static void enable_z_probe(bool onoff=true) { z_probe_enabled = onoff; }
  67. #endif
  68. private:
  69. #if ENABLED(Z_DUAL_ENDSTOPS)
  70. static void test_dual_z_endstops(EndstopEnum es1, EndstopEnum es2);
  71. #endif
  72. };
  73. extern Endstops endstops;
  74. #endif // ENDSTOPS_H