My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bltouch.h 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2019 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. #pragma once
  23. #include "../inc/MarlinConfigPre.h"
  24. // BLTouch commands are sent as servo angles
  25. typedef unsigned char BLTCommand;
  26. #define BLTOUCH_DEPLOY 10
  27. #define BLTOUCH_SW_MODE 60
  28. #define BLTOUCH_STOW 90
  29. #define BLTOUCH_SELFTEST 120
  30. #define BLTOUCH_5V_MODE 140
  31. #define BLTOUCH_OD_MODE 150
  32. #define BLTOUCH_RESET 160
  33. class BLTouch {
  34. public:
  35. static void init();
  36. static void command(const BLTCommand cmd);
  37. static bool triggered();
  38. FORCE_INLINE static void reset() { command(BLTOUCH_RESET); }
  39. FORCE_INLINE static void set_5V_mode() { command(BLTOUCH_5V_MODE); }
  40. FORCE_INLINE static void set_OD_mode() { command(BLTOUCH_OD_MODE); }
  41. FORCE_INLINE static void set_SW_mode() { command(BLTOUCH_SW_MODE); }
  42. FORCE_INLINE static bool deploy() { return set_deployed(true); }
  43. FORCE_INLINE static bool stow() { return set_deployed(false); }
  44. private:
  45. FORCE_INLINE static void _deploy() { command(BLTOUCH_DEPLOY); }
  46. FORCE_INLINE static void _stow() { command(BLTOUCH_STOW); }
  47. static bool set_deployed(const bool deploy);
  48. };
  49. #define BLTOUCH_ANGLES { BLTOUCH_DEPLOY, BLTOUCH_STOW }
  50. extern BLTouch bltouch;