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 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. K0,
  43. K1,
  44. K2,
  45. K3,
  46. K4,
  47. R0,
  48. S3,
  49. W0,
  50. };
  51. inline MmuCmd operator+ (MmuCmd cmd, uint8_t filament)
  52. {
  53. return static_cast<MmuCmd>(static_cast<uint8_t>(cmd) + filament );
  54. }
  55. inline uint8_t operator- (MmuCmd cmda, MmuCmd cmdb)
  56. {
  57. return (static_cast<uint8_t>(cmda) - static_cast<uint8_t>(cmdb));
  58. }
  59. extern int mmu_puts_P(const char* str);
  60. extern int mmu_printf_P(const char* format, ...);
  61. extern int8_t mmu_rx_ok(void);
  62. extern bool check_for_ir_sensor();
  63. extern void mmu_init(void);
  64. extern void mmu_loop(void);
  65. extern void mmu_reset(void);
  66. extern int8_t mmu_set_filament_type(uint8_t extruder, uint8_t filament);
  67. extern void mmu_command(MmuCmd cmd);
  68. extern bool mmu_get_response(uint8_t move = 0);
  69. extern void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move = MMU_NO_MOVE);
  70. extern void mmu_load_to_nozzle();
  71. extern void mmu_M600_load_filament(bool automatic);
  72. extern void mmu_M600_wait_and_beep();
  73. extern void extr_mov(float shift, float feed_rate);
  74. extern void change_extr(int extr);
  75. extern int get_ext_nr();
  76. extern void display_loading();
  77. extern void extr_adj(int extruder);
  78. extern void extr_unload();
  79. //-//
  80. extern void extr_unload_();
  81. extern void extr_adj_0();
  82. extern void extr_adj_1();
  83. extern void extr_adj_2();
  84. extern void extr_adj_3();
  85. extern void extr_adj_4();
  86. extern void load_all();
  87. extern void extr_change_0();
  88. extern void extr_change_1();
  89. extern void extr_change_2();
  90. extern void extr_change_3();
  91. #ifdef SNMM
  92. extern void extr_unload_all();
  93. extern void extr_unload_used();
  94. #endif //SNMM
  95. extern void extr_unload_0();
  96. extern void extr_unload_1();
  97. extern void extr_unload_2();
  98. extern void extr_unload_3();
  99. extern void extr_unload_4();
  100. extern bool mmu_check_version();
  101. extern void mmu_show_warning();
  102. extern void lcd_mmu_load_to_nozzle(uint8_t filament_nr);
  103. extern void mmu_eject_filament(uint8_t filament, bool recover);
  104. extern void mmu_cut_filament(uint8_t filament_nr);
  105. extern void mmu_continue_loading();
  106. extern void mmu_filament_ramming();
  107. extern void mmu_wait_for_heater_blocking();
  108. extern void mmu_load_step(bool synchronize = true);
  109. #endif //MMU_H