mmu.h 3.0 KB

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