mmu.h 3.1 KB

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