mmu.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. //! @file
  2. #ifndef MMU_H
  3. #define MMU_H
  4. #include <inttypes.h>
  5. extern bool mmu_enabled;
  6. extern bool mmu_fil_loaded;
  7. extern uint8_t mmu_extruder;
  8. extern uint8_t tmp_extruder;
  9. extern int8_t mmu_finda;
  10. extern bool ir_sensor_detected;
  11. extern int16_t mmu_version;
  12. extern int16_t mmu_buildnr;
  13. extern uint16_t mmu_power_failures;
  14. #define MMU_FILAMENT_UNKNOWN 255
  15. #define MMU_NO_MOVE 0
  16. #define MMU_UNLOAD_MOVE 1
  17. #define MMU_LOAD_MOVE 2
  18. #define MMU_TCODE_MOVE 3
  19. #define MMU_LOAD_FEEDRATE 19.02f //mm/s
  20. #define MMU_LOAD_TIME_MS 2000 //should be fine tuned to load time for shortest allowed PTFE tubing and maximum loading speed
  21. enum class MmuCmd : uint_least8_t
  22. {
  23. None,
  24. T0,
  25. T1,
  26. T2,
  27. T3,
  28. T4,
  29. L0,
  30. L1,
  31. L2,
  32. L3,
  33. L4,
  34. C0,
  35. U0,
  36. E0,
  37. E1,
  38. E2,
  39. E3,
  40. E4,
  41. K0,
  42. K1,
  43. K2,
  44. K3,
  45. K4,
  46. R0,
  47. S3,
  48. W0, //!< Wait and signal load error
  49. };
  50. inline MmuCmd operator+ (MmuCmd cmd, uint8_t filament)
  51. {
  52. return static_cast<MmuCmd>(static_cast<uint8_t>(cmd) + filament );
  53. }
  54. inline uint8_t operator- (MmuCmd cmda, MmuCmd cmdb)
  55. {
  56. return (static_cast<uint8_t>(cmda) - static_cast<uint8_t>(cmdb));
  57. }
  58. extern int mmu_puts_P(const char* str);
  59. extern int mmu_printf_P(const char* format, ...);
  60. extern int8_t mmu_rx_ok(void);
  61. extern bool check_for_ir_sensor();
  62. extern void mmu_init(void);
  63. extern void mmu_loop(void);
  64. extern void mmu_reset(void);
  65. extern int8_t mmu_set_filament_type(uint8_t extruder, uint8_t filament);
  66. extern void mmu_command(MmuCmd cmd);
  67. extern bool mmu_get_response(uint8_t move = 0);
  68. extern void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move = MMU_NO_MOVE);
  69. extern void mmu_load_to_nozzle();
  70. extern void mmu_M600_load_filament(bool automatic, float nozzle_temp);
  71. extern void mmu_M600_wait_and_beep();
  72. extern void extr_mov(float shift, float feed_rate);
  73. extern void change_extr(int extr);
  74. extern int get_ext_nr();
  75. extern void display_loading();
  76. extern void extr_adj(uint8_t extruder);
  77. extern void extr_unload();
  78. extern void extr_adj_0();
  79. extern void extr_adj_1();
  80. extern void extr_adj_2();
  81. extern void extr_adj_3();
  82. extern void extr_adj_4();
  83. extern void load_all();
  84. extern void extr_change_0();
  85. extern void extr_change_1();
  86. extern void extr_change_2();
  87. extern void extr_change_3();
  88. #ifdef SNMM
  89. extern void extr_unload_all();
  90. extern void extr_unload_used();
  91. #endif //SNMM
  92. extern void extr_unload_0();
  93. extern void extr_unload_1();
  94. extern void extr_unload_2();
  95. extern void extr_unload_3();
  96. extern void extr_unload_4();
  97. extern bool mmu_check_version();
  98. extern void mmu_show_warning();
  99. extern void lcd_mmu_load_to_nozzle(uint8_t filament_nr);
  100. extern void mmu_eject_filament(uint8_t filament, bool recover);
  101. #ifdef MMU_HAS_CUTTER
  102. extern void mmu_cut_filament(uint8_t filament_nr);
  103. #endif //MMU_HAS_CUTTER
  104. extern void mmu_continue_loading(bool blocking);
  105. extern void mmu_filament_ramming();
  106. extern void mmu_wait_for_heater_blocking();
  107. extern void mmu_load_step(bool synchronize = true);
  108. #endif //MMU_H