2019-01-04 20:26:13 +00:00
|
|
|
//! @file
|
2018-08-02 16:54:00 +00:00
|
|
|
|
2019-01-22 09:56:07 +00:00
|
|
|
#ifndef MMU_H
|
|
|
|
#define MMU_H
|
2018-08-02 16:54:00 +00:00
|
|
|
|
|
|
|
#include <inttypes.h>
|
2021-08-26 21:04:48 +00:00
|
|
|
#include "Timer.h"
|
2018-08-02 16:54:00 +00:00
|
|
|
|
2018-08-07 18:37:59 +00:00
|
|
|
|
2018-08-02 16:54:00 +00:00
|
|
|
extern bool mmu_enabled;
|
2018-12-12 21:32:47 +00:00
|
|
|
extern bool mmu_fil_loaded;
|
2018-08-07 18:37:59 +00:00
|
|
|
|
|
|
|
extern uint8_t mmu_extruder;
|
|
|
|
|
2018-08-08 16:58:03 +00:00
|
|
|
extern uint8_t tmp_extruder;
|
|
|
|
|
2018-08-07 18:37:59 +00:00
|
|
|
extern int8_t mmu_finda;
|
2022-02-17 07:48:29 +00:00
|
|
|
extern LongTimer mmu_last_finda_response;
|
2019-01-24 00:12:30 +00:00
|
|
|
extern bool ir_sensor_detected;
|
2018-08-07 18:37:59 +00:00
|
|
|
|
|
|
|
extern int16_t mmu_version;
|
2018-08-09 15:43:43 +00:00
|
|
|
extern int16_t mmu_buildnr;
|
2018-08-07 18:37:59 +00:00
|
|
|
|
2018-12-21 19:56:45 +00:00
|
|
|
extern uint16_t mmu_power_failures;
|
|
|
|
|
2018-12-12 13:50:55 +00:00
|
|
|
#define MMU_FILAMENT_UNKNOWN 255
|
2018-08-07 18:37:59 +00:00
|
|
|
|
2018-12-17 20:25:07 +00:00
|
|
|
#define MMU_NO_MOVE 0
|
2018-12-12 21:32:47 +00:00
|
|
|
#define MMU_UNLOAD_MOVE 1
|
|
|
|
#define MMU_LOAD_MOVE 2
|
|
|
|
#define MMU_TCODE_MOVE 3
|
|
|
|
|
|
|
|
#define MMU_LOAD_FEEDRATE 19.02f //mm/s
|
2018-12-18 15:09:10 +00:00
|
|
|
#define MMU_LOAD_TIME_MS 2000 //should be fine tuned to load time for shortest allowed PTFE tubing and maximum loading speed
|
2018-12-12 21:32:47 +00:00
|
|
|
|
2019-02-13 16:12:35 +00:00
|
|
|
enum class MmuCmd : uint_least8_t
|
2019-02-13 00:51:39 +00:00
|
|
|
{
|
|
|
|
None,
|
|
|
|
T0,
|
|
|
|
T1,
|
|
|
|
T2,
|
|
|
|
T3,
|
|
|
|
T4,
|
|
|
|
L0,
|
|
|
|
L1,
|
|
|
|
L2,
|
|
|
|
L3,
|
|
|
|
L4,
|
|
|
|
C0,
|
|
|
|
U0,
|
|
|
|
E0,
|
|
|
|
E1,
|
|
|
|
E2,
|
|
|
|
E3,
|
|
|
|
E4,
|
2019-02-26 16:58:00 +00:00
|
|
|
K0,
|
|
|
|
K1,
|
|
|
|
K2,
|
|
|
|
K3,
|
|
|
|
K4,
|
2019-02-13 00:51:39 +00:00
|
|
|
R0,
|
|
|
|
S3,
|
2019-04-09 18:50:29 +00:00
|
|
|
W0, //!< Wait and signal load error
|
2019-02-13 00:51:39 +00:00
|
|
|
};
|
2018-08-20 18:53:53 +00:00
|
|
|
|
2019-02-13 16:12:35 +00:00
|
|
|
inline MmuCmd operator+ (MmuCmd cmd, uint8_t filament)
|
|
|
|
{
|
|
|
|
return static_cast<MmuCmd>(static_cast<uint8_t>(cmd) + filament );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline uint8_t operator- (MmuCmd cmda, MmuCmd cmdb)
|
|
|
|
{
|
|
|
|
return (static_cast<uint8_t>(cmda) - static_cast<uint8_t>(cmdb));
|
|
|
|
}
|
|
|
|
|
2018-08-07 18:37:59 +00:00
|
|
|
extern int mmu_puts_P(const char* str);
|
|
|
|
|
|
|
|
extern int mmu_printf_P(const char* format, ...);
|
|
|
|
|
|
|
|
extern int8_t mmu_rx_ok(void);
|
|
|
|
|
2019-01-24 00:12:30 +00:00
|
|
|
extern bool check_for_ir_sensor();
|
2018-08-07 18:37:59 +00:00
|
|
|
|
2018-08-09 15:43:43 +00:00
|
|
|
extern void mmu_init(void);
|
2018-08-07 18:37:59 +00:00
|
|
|
|
2018-08-09 15:43:43 +00:00
|
|
|
extern void mmu_loop(void);
|
2018-08-07 18:37:59 +00:00
|
|
|
|
|
|
|
|
2018-08-09 15:43:43 +00:00
|
|
|
extern void mmu_reset(void);
|
2018-08-07 18:37:59 +00:00
|
|
|
|
2018-08-08 16:58:03 +00:00
|
|
|
extern int8_t mmu_set_filament_type(uint8_t extruder, uint8_t filament);
|
|
|
|
|
2019-02-13 00:51:39 +00:00
|
|
|
extern void mmu_command(MmuCmd cmd);
|
2018-08-08 16:58:03 +00:00
|
|
|
|
2018-12-12 21:32:47 +00:00
|
|
|
extern bool mmu_get_response(uint8_t move = 0);
|
2018-08-08 16:58:03 +00:00
|
|
|
|
2019-01-15 00:29:59 +00:00
|
|
|
extern void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move = MMU_NO_MOVE);
|
2018-08-08 16:58:03 +00:00
|
|
|
|
|
|
|
extern void mmu_load_to_nozzle();
|
|
|
|
|
2019-03-04 21:00:24 +00:00
|
|
|
extern void mmu_M600_load_filament(bool automatic, float nozzle_temp);
|
2018-08-27 14:12:10 +00:00
|
|
|
extern void mmu_M600_wait_and_beep();
|
2018-08-02 16:54:00 +00:00
|
|
|
|
2019-05-14 16:25:43 +00:00
|
|
|
extern void extr_adj(uint8_t extruder);
|
2018-08-02 16:54:00 +00:00
|
|
|
extern void extr_unload();
|
|
|
|
extern void load_all();
|
2018-08-25 14:15:35 +00:00
|
|
|
|
|
|
|
extern bool mmu_check_version();
|
|
|
|
extern void mmu_show_warning();
|
2018-11-01 15:29:09 +00:00
|
|
|
extern void lcd_mmu_load_to_nozzle(uint8_t filament_nr);
|
2018-08-28 23:58:28 +00:00
|
|
|
extern void mmu_eject_filament(uint8_t filament, bool recover);
|
2019-03-15 02:38:37 +00:00
|
|
|
#ifdef MMU_HAS_CUTTER
|
2019-02-26 16:58:00 +00:00
|
|
|
extern void mmu_cut_filament(uint8_t filament_nr);
|
2019-03-15 02:38:37 +00:00
|
|
|
#endif //MMU_HAS_CUTTER
|
2019-04-04 16:15:37 +00:00
|
|
|
extern void mmu_continue_loading(bool blocking);
|
2019-01-22 09:56:07 +00:00
|
|
|
extern void mmu_filament_ramming();
|
|
|
|
extern void mmu_wait_for_heater_blocking();
|
|
|
|
extern void mmu_load_step(bool synchronize = true);
|
|
|
|
|
|
|
|
#endif //MMU_H
|