mmu.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 LongTimer 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_adj(uint8_t extruder);
  75. extern void extr_unload();
  76. extern void load_all();
  77. extern bool mmu_check_version();
  78. extern void mmu_show_warning();
  79. extern void lcd_mmu_load_to_nozzle(uint8_t filament_nr);
  80. extern void mmu_eject_filament(uint8_t filament, bool recover);
  81. #ifdef MMU_HAS_CUTTER
  82. extern void mmu_cut_filament(uint8_t filament_nr);
  83. #endif //MMU_HAS_CUTTER
  84. extern void mmu_continue_loading(bool blocking);
  85. extern void mmu_filament_ramming();
  86. extern void mmu_wait_for_heater_blocking();
  87. extern void mmu_load_step(bool synchronize = true);
  88. #endif //MMU_H