MMU2 Extruder Sensor support (#17886)
This commit is contained in:
parent
df04a427f3
commit
2ec482a102
|
@ -3279,7 +3279,7 @@
|
|||
// This is for Prusa MK3-style extruders. Customize for your hardware.
|
||||
#define MMU2_FILAMENTCHANGE_EJECT_FEED 80.0
|
||||
#define MMU2_LOAD_TO_NOZZLE_SEQUENCE \
|
||||
{ 7.2, 562 }, \
|
||||
{ 7.2, 1145 }, \
|
||||
{ 14.4, 871 }, \
|
||||
{ 36.0, 1393 }, \
|
||||
{ 14.4, 871 }, \
|
||||
|
@ -3299,7 +3299,25 @@
|
|||
{ -50.0, 2000 }
|
||||
#endif
|
||||
|
||||
// Using a sensor like the MMU2S
|
||||
/**
|
||||
* MMU Extruder Sensor
|
||||
* Add support for Prusa IR Sensor (or other) to detect that filament reach the extruder to make loading filament more reliable
|
||||
* If your extruder is equipped with a filament sensor located less than 38mm from the gears you can use this feature
|
||||
* During loading to the extruder, the sensor will stop the loading command when he's triggered and make a last move to load filament to the gears
|
||||
* If no filament is detected, MMU2 will make more loading attemps, if finally no filament is detected, the printer will enter in runout state
|
||||
*/
|
||||
|
||||
//#define MMU_EXTRUDER_SENSOR
|
||||
#if ENABLED(MMU_EXTRUDER_SENSOR)
|
||||
#define MMU_LOADING_ATTEMPTS_NR 5 //max. number of attempts to load filament if first load fail
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Using a sensor like the MMU2S
|
||||
* This mode only work if you have a MK3S extruder with sensor sensing the extruder idler mmu2s
|
||||
* See https://help.prusa3d.com/en/guide/3b-mk3s-mk2-5s-extruder-upgrade_41560, step 11
|
||||
*/
|
||||
|
||||
//#define PRUSA_MMU2_S_MODE
|
||||
#if ENABLED(PRUSA_MMU2_S_MODE)
|
||||
#define MMU2_C0_RETRY 5 // Number of retries (total time = timeout*retries)
|
||||
|
|
|
@ -51,8 +51,13 @@ MMU2 mmu2;
|
|||
|
||||
#define MMU_TODELAY 100
|
||||
#define MMU_TIMEOUT 10
|
||||
#define MMU_CMD_TIMEOUT 60000ul // 5min timeout for mmu commands (except P0)
|
||||
#define MMU_P0_TIMEOUT 3000ul // Timeout for P0 command: 3seconds
|
||||
#define MMU_CMD_TIMEOUT 45000UL // 45s timeout for mmu commands (except P0)
|
||||
#define MMU_P0_TIMEOUT 3000UL // Timeout for P0 command: 3seconds
|
||||
|
||||
#if ENABLED(MMU_EXTRUDER_SENSOR)
|
||||
uint8_t mmu_idl_sens = 0;
|
||||
static bool mmu_loading_flag = false;
|
||||
#endif
|
||||
|
||||
#define MMU_CMD_NONE 0
|
||||
#define MMU_CMD_T0 0x10
|
||||
|
@ -79,11 +84,7 @@ MMU2 mmu2;
|
|||
#define MMU_CMD_F3 0x73
|
||||
#define MMU_CMD_F4 0x74
|
||||
|
||||
#if ENABLED(MMU2_MODE_12V)
|
||||
#define MMU_REQUIRED_FW_BUILDNR 132
|
||||
#else
|
||||
#define MMU_REQUIRED_FW_BUILDNR 126
|
||||
#endif
|
||||
#define MMU_REQUIRED_FW_BUILDNR TERN(MMU2_MODE_12V, 132, 126)
|
||||
|
||||
#define MMU2_NO_TOOL 99
|
||||
#define MMU_BAUD 115200
|
||||
|
@ -99,7 +100,7 @@ int8_t MMU2::state = 0;
|
|||
volatile int8_t MMU2::finda = 1;
|
||||
volatile bool MMU2::finda_runout_valid;
|
||||
int16_t MMU2::version = -1, MMU2::buildnr = -1;
|
||||
millis_t MMU2::last_request, MMU2::next_P0_request;
|
||||
millis_t MMU2::prev_request, MMU2::prev_P0_request;
|
||||
char MMU2::rx_buffer[MMU_RX_SIZE], MMU2::tx_buffer[MMU_TX_SIZE];
|
||||
|
||||
#if BOTH(HAS_LCD_MENU, MMU2_MENUS)
|
||||
|
@ -159,6 +160,10 @@ uint8_t MMU2::get_current_tool() {
|
|||
return extruder == MMU2_NO_TOOL ? -1 : extruder;
|
||||
}
|
||||
|
||||
#if EITHER(PRUSA_MMU2_S_MODE, MMU_EXTRUDER_SENSOR)
|
||||
#define FILAMENT_PRESENT() (READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_INVERTING)
|
||||
#endif
|
||||
|
||||
void MMU2::mmu_loop() {
|
||||
|
||||
switch (state) {
|
||||
|
@ -248,6 +253,7 @@ void MMU2::mmu_loop() {
|
|||
int filament = cmd - MMU_CMD_T0;
|
||||
DEBUG_ECHOLNPAIR("MMU <= T", filament);
|
||||
tx_printf_P(PSTR("T%d\n"), filament);
|
||||
TERN_(MMU_EXTRUDER_SENSOR, mmu_idl_sens = 1); // enable idler sensor, if any
|
||||
state = 3; // wait for response
|
||||
}
|
||||
else if (WITHIN(cmd, MMU_CMD_L0, MMU_CMD_L4)) {
|
||||
|
@ -296,7 +302,7 @@ void MMU2::mmu_loop() {
|
|||
last_cmd = cmd;
|
||||
cmd = MMU_CMD_NONE;
|
||||
}
|
||||
else if (ELAPSED(millis(), next_P0_request)) {
|
||||
else if (ELAPSED(millis(), prev_P0_request + 300)) {
|
||||
// read FINDA
|
||||
tx_str_P(PSTR("P0\n"));
|
||||
state = 2; // wait for response
|
||||
|
@ -312,26 +318,35 @@ void MMU2::mmu_loop() {
|
|||
// This is super annoying. Only activate if necessary
|
||||
// if (finda_runout_valid) DEBUG_ECHOLNPAIR_F("MMU <= 'P0'\nMMU => ", finda, 6);
|
||||
|
||||
state = 1;
|
||||
|
||||
if (cmd == 0) ready = true;
|
||||
|
||||
if (!finda && finda_runout_valid) filament_runout();
|
||||
if (cmd == 0) ready = true;
|
||||
state = 1;
|
||||
}
|
||||
else if (ELAPSED(millis(), last_request + MMU_P0_TIMEOUT)) // Resend request after timeout (3s)
|
||||
else if (ELAPSED(millis(), prev_request + MMU_P0_TIMEOUT)) // Resend request after timeout (3s)
|
||||
state = 1;
|
||||
|
||||
TERN_(PRUSA_MMU2_S_MODE, check_filament());
|
||||
break;
|
||||
|
||||
case 3: // response to mmu commands
|
||||
#if ENABLED(MMU_EXTRUDER_SENSOR)
|
||||
if (mmu_idl_sens) {
|
||||
if (FILAMENT_PRESENT() && mmu_loading_flag) {
|
||||
DEBUG_ECHOLNPGM("MMU <= 'A'\n");
|
||||
tx_str_P(PSTR("A\n")); // send 'abort' request
|
||||
mmu_idl_sens = 0;
|
||||
DEBUG_ECHOLNPGM("MMU IDLER_SENSOR = 0 - ABORT\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (rx_ok()) {
|
||||
DEBUG_ECHOLNPGM("MMU => 'ok'");
|
||||
ready = true;
|
||||
state = 1;
|
||||
last_cmd = MMU_CMD_NONE;
|
||||
}
|
||||
else if (ELAPSED(millis(), last_request + MMU_CMD_TIMEOUT)) {
|
||||
else if (ELAPSED(millis(), prev_request + MMU_CMD_TIMEOUT)) {
|
||||
// resend request after timeout
|
||||
if (last_cmd) {
|
||||
DEBUG_ECHOLNPGM("MMU retry");
|
||||
|
@ -351,7 +366,7 @@ void MMU2::mmu_loop() {
|
|||
bool MMU2::rx_start() {
|
||||
// check for start message
|
||||
if (rx_str_P(PSTR("start\n"))) {
|
||||
next_P0_request = millis() + 300;
|
||||
prev_P0_request = millis();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -397,7 +412,7 @@ void MMU2::tx_str_P(const char* str) {
|
|||
uint8_t len = strlen_P(str);
|
||||
LOOP_L_N(i, len) mmuSerial.write(pgm_read_byte(str++));
|
||||
rx_buffer[0] = '\0';
|
||||
last_request = millis();
|
||||
prev_request = millis();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -408,7 +423,7 @@ void MMU2::tx_printf_P(const char* format, int argument = -1) {
|
|||
uint8_t len = sprintf_P(tx_buffer, format, argument);
|
||||
LOOP_L_N(i, len) mmuSerial.write(tx_buffer[i]);
|
||||
rx_buffer[0] = '\0';
|
||||
last_request = millis();
|
||||
prev_request = millis();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -419,7 +434,7 @@ void MMU2::tx_printf_P(const char* format, int argument1, int argument2) {
|
|||
uint8_t len = sprintf_P(tx_buffer, format, argument1, argument2);
|
||||
LOOP_L_N(i, len) mmuSerial.write(tx_buffer[i]);
|
||||
rx_buffer[0] = '\0';
|
||||
last_request = millis();
|
||||
prev_request = millis();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -435,7 +450,7 @@ void MMU2::clear_rx_buffer() {
|
|||
*/
|
||||
bool MMU2::rx_ok() {
|
||||
if (rx_str_P(PSTR("ok\n"))) {
|
||||
next_P0_request = millis() + 300;
|
||||
prev_P0_request = millis();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -476,32 +491,206 @@ static bool mmu2_not_responding() {
|
|||
return success;
|
||||
}
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Handle tool change
|
||||
*/
|
||||
void MMU2::tool_change(const uint8_t index) {
|
||||
|
||||
if (!enabled) return;
|
||||
|
||||
set_runout_valid(false);
|
||||
|
||||
if (index != extruder) {
|
||||
|
||||
DISABLE_AXIS_E0();
|
||||
ui.status_printf_P(0, GET_TEXT(MSG_MMU2_LOADING_FILAMENT), int(index + 1));
|
||||
|
||||
command(MMU_CMD_T0 + index);
|
||||
manage_response(true, true);
|
||||
|
||||
if (load_to_gears()) {
|
||||
extruder = index; // filament change is finished
|
||||
active_extruder = 0;
|
||||
ENABLE_AXIS_E0();
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR(STR_ACTIVE_EXTRUDER, int(extruder));
|
||||
}
|
||||
ui.reset_status();
|
||||
}
|
||||
|
||||
set_runout_valid(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle special T?/Tx/Tc commands
|
||||
*
|
||||
* T? Gcode to extrude shouldn't have to follow, load to extruder wheels is done automatically
|
||||
* Tx Same as T?, except nozzle doesn't have to be preheated. Tc must be placed after extruder nozzle is preheated to finish filament load.
|
||||
* Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
|
||||
*/
|
||||
void MMU2::tool_change(const char* special) {
|
||||
|
||||
if (!enabled) return;
|
||||
|
||||
#if ENABLED(MMU2_MENUS)
|
||||
|
||||
set_runout_valid(false);
|
||||
|
||||
switch (*special) {
|
||||
case '?': {
|
||||
uint8_t index = mmu2_choose_filament();
|
||||
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
|
||||
load_filament_to_nozzle(index);
|
||||
} break;
|
||||
|
||||
case 'x': {
|
||||
planner.synchronize();
|
||||
uint8_t index = mmu2_choose_filament();
|
||||
DISABLE_AXIS_E0();
|
||||
command(MMU_CMD_T0 + index);
|
||||
manage_response(true, true);
|
||||
|
||||
if (load_to_gears()) {
|
||||
mmu_loop();
|
||||
ENABLE_AXIS_E0();
|
||||
extruder = index;
|
||||
active_extruder = 0;
|
||||
}
|
||||
} break;
|
||||
|
||||
case 'c': {
|
||||
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
|
||||
execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, COUNT(load_to_nozzle_sequence));
|
||||
} break;
|
||||
}
|
||||
|
||||
set_runout_valid(true);
|
||||
|
||||
#endif // MMU2_MENUS
|
||||
}
|
||||
|
||||
#elif ENABLED(MMU_EXTRUDER_SENSOR)
|
||||
|
||||
/**
|
||||
* Handle tool change
|
||||
*/
|
||||
void MMU2::tool_change(const uint8_t index) {
|
||||
if (!enabled) return;
|
||||
|
||||
set_runout_valid(false);
|
||||
|
||||
if (index != extruder) {
|
||||
DISABLE_AXIS_E0();
|
||||
if (FILAMENT_PRESENT()) {
|
||||
DEBUG_ECHOLNPGM("Unloading\n");
|
||||
mmu_loading_flag = false;
|
||||
command(MMU_CMD_U0);
|
||||
manage_response(true, true);
|
||||
}
|
||||
ui.status_printf_P(0, GET_TEXT(MSG_MMU2_LOADING_FILAMENT), int(index + 1));
|
||||
mmu_loading_flag = true;
|
||||
command(MMU_CMD_T0 + index);
|
||||
manage_response(true, true);
|
||||
mmu_continue_loading();
|
||||
command(MMU_CMD_C0);
|
||||
extruder = index;
|
||||
active_extruder = 0;
|
||||
|
||||
ENABLE_AXIS_E0();
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR(STR_ACTIVE_EXTRUDER, int(extruder));
|
||||
|
||||
ui.reset_status();
|
||||
}
|
||||
|
||||
set_runout_valid(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle special T?/Tx/Tc commands
|
||||
*
|
||||
* T? Gcode to extrude shouldn't have to follow, load to extruder wheels is done automatically
|
||||
* Tx Same as T?, except nozzle doesn't have to be preheated. Tc must be placed after extruder nozzle is preheated to finish filament load.
|
||||
* Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
|
||||
*/
|
||||
void MMU2::tool_change(const char* special) {
|
||||
if (!enabled) return;
|
||||
|
||||
#if ENABLED(MMU2_MENUS)
|
||||
|
||||
set_runout_valid(false);
|
||||
|
||||
switch (*special) {
|
||||
case '?': {
|
||||
DEBUG_ECHOLNPGM("case ?\n");
|
||||
uint8_t index = mmu2_choose_filament();
|
||||
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
|
||||
load_filament_to_nozzle(index);
|
||||
} break;
|
||||
|
||||
case 'x': {
|
||||
DEBUG_ECHOLNPGM("case x\n");
|
||||
planner.synchronize();
|
||||
uint8_t index = mmu2_choose_filament();
|
||||
DISABLE_AXIS_E0();
|
||||
command(MMU_CMD_T0 + index);
|
||||
manage_response(true, true);
|
||||
mmu_continue_loading();
|
||||
command(MMU_CMD_C0);
|
||||
mmu_loop();
|
||||
|
||||
ENABLE_AXIS_E0();
|
||||
extruder = index;
|
||||
active_extruder = 0;
|
||||
} break;
|
||||
|
||||
case 'c': {
|
||||
DEBUG_ECHOLNPGM("case c\n");
|
||||
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
|
||||
execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, COUNT(load_to_nozzle_sequence));
|
||||
} break;
|
||||
}
|
||||
|
||||
set_runout_valid(true);
|
||||
|
||||
#endif // MMU2_MENUS
|
||||
}
|
||||
|
||||
void MMU2::mmu_continue_loading() {
|
||||
for (uint8_t i = 0; i < MMU_LOADING_ATTEMPTS_NR; i++) {
|
||||
DEBUG_ECHOLNPAIR("Additional load attempt #", i);
|
||||
if (FILAMENT_PRESENT()) break;
|
||||
command(MMU_CMD_C0);
|
||||
manage_response(true, true);
|
||||
}
|
||||
if (!FILAMENT_PRESENT()) {
|
||||
DEBUG_ECHOLNPGM("Filament never reached sensor, runout");
|
||||
filament_runout();
|
||||
}
|
||||
mmu_idl_sens = 0;
|
||||
}
|
||||
|
||||
#elif DISABLED(MMU_EXTRUDER_SENSOR) && DISABLED(PRUSA_MMU2_S_MODE)
|
||||
|
||||
/**
|
||||
* Handle tool change
|
||||
*/
|
||||
void MMU2::tool_change(uint8_t index) {
|
||||
|
||||
void MMU2::tool_change(const uint8_t index) {
|
||||
if (!enabled) return;
|
||||
|
||||
set_runout_valid(false);
|
||||
|
||||
if (index != extruder) {
|
||||
|
||||
DISABLE_AXIS_E0();
|
||||
ui.status_printf_P(0, GET_TEXT(MSG_MMU2_LOADING_FILAMENT), int(index + 1));
|
||||
|
||||
command(MMU_CMD_T0 + index);
|
||||
manage_response(true, true);
|
||||
|
||||
if (load_to_gears()) {
|
||||
extruder = index; // filament change is finished
|
||||
active_extruder = 0;
|
||||
ENABLE_AXIS_E0();
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR(STR_ACTIVE_EXTRUDER, int(extruder));
|
||||
}
|
||||
command(MMU_CMD_C0);
|
||||
extruder = index; //filament change is finished
|
||||
active_extruder = 0;
|
||||
ENABLE_AXIS_E0();
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR(STR_ACTIVE_EXTRUDER, int(extruder));
|
||||
ui.reset_status();
|
||||
}
|
||||
|
||||
|
@ -518,7 +707,6 @@ void MMU2::tool_change(uint8_t index) {
|
|||
*
|
||||
*/
|
||||
void MMU2::tool_change(const char* special) {
|
||||
|
||||
if (!enabled) return;
|
||||
|
||||
#if ENABLED(MMU2_MENUS)
|
||||
|
@ -527,27 +715,29 @@ void MMU2::tool_change(const char* special) {
|
|||
|
||||
switch (*special) {
|
||||
case '?': {
|
||||
DEBUG_ECHOLNPGM("case ?\n");
|
||||
uint8_t index = mmu2_choose_filament();
|
||||
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
|
||||
load_filament_to_nozzle(index);
|
||||
} break;
|
||||
|
||||
case 'x': {
|
||||
DEBUG_ECHOLNPGM("case x\n");
|
||||
planner.synchronize();
|
||||
uint8_t index = mmu2_choose_filament();
|
||||
DISABLE_AXIS_E0();
|
||||
command(MMU_CMD_T0 + index);
|
||||
manage_response(true, true);
|
||||
command(MMU_CMD_C0);
|
||||
mmu_loop();
|
||||
|
||||
if (load_to_gears()) {
|
||||
mmu_loop();
|
||||
ENABLE_AXIS_E0();
|
||||
extruder = index;
|
||||
active_extruder = 0;
|
||||
}
|
||||
ENABLE_AXIS_E0();
|
||||
extruder = index;
|
||||
active_extruder = 0;
|
||||
} break;
|
||||
|
||||
case 'c': {
|
||||
DEBUG_ECHOLNPGM("case c\n");
|
||||
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
|
||||
execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, COUNT(load_to_nozzle_sequence));
|
||||
} break;
|
||||
|
@ -556,7 +746,9 @@ void MMU2::tool_change(const char* special) {
|
|||
set_runout_valid(true);
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MMU_EXTRUDER_SENSOR
|
||||
|
||||
/**
|
||||
* Set next command
|
||||
|
@ -593,7 +785,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
|
|||
bool response = false;
|
||||
mmu_print_saved = false;
|
||||
xyz_pos_t resume_position;
|
||||
int16_t resume_hotend_temp;
|
||||
int16_t resume_hotend_temp = thermalManager.degTargetHotend(active_extruder);
|
||||
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
|
||||
|
@ -652,7 +844,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
|
|||
}
|
||||
}
|
||||
|
||||
void MMU2::set_filament_type(uint8_t index, uint8_t filamentType) {
|
||||
void MMU2::set_filament_type(const uint8_t index, const uint8_t filamentType) {
|
||||
if (!enabled) return;
|
||||
|
||||
cmd_arg = filamentType;
|
||||
|
@ -667,20 +859,21 @@ void MMU2::filament_runout() {
|
|||
}
|
||||
|
||||
#if ENABLED(PRUSA_MMU2_S_MODE)
|
||||
|
||||
void MMU2::check_filament() {
|
||||
const bool runout = READ(FIL_RUNOUT_PIN) ^ (FIL_RUNOUT_INVERTING);
|
||||
if (runout && !mmu2s_triggered) {
|
||||
const bool present = FILAMENT_PRESENT();
|
||||
if (present && !mmu2s_triggered) {
|
||||
DEBUG_ECHOLNPGM("MMU <= 'A'");
|
||||
tx_str_P(PSTR("A\n"));
|
||||
}
|
||||
mmu2s_triggered = runout;
|
||||
mmu2s_triggered = present;
|
||||
}
|
||||
|
||||
bool MMU2::can_load() {
|
||||
execute_extruder_sequence((const E_Step *)can_load_sequence, COUNT(can_load_sequence));
|
||||
|
||||
int filament_detected_count = 0;
|
||||
const int steps = MMU2_CAN_LOAD_RETRACT / MMU2_CAN_LOAD_INCREMENT;
|
||||
const int steps = (MMU2_CAN_LOAD_RETRACT) / (MMU2_CAN_LOAD_INCREMENT);
|
||||
DEBUG_ECHOLNPGM("MMU can_load:");
|
||||
LOOP_L_N(i, steps) {
|
||||
execute_extruder_sequence((const E_Step *)can_load_increment_sequence, COUNT(can_load_increment_sequence));
|
||||
|
@ -689,7 +882,7 @@ void MMU2::filament_runout() {
|
|||
if (mmu2s_triggered) ++filament_detected_count;
|
||||
}
|
||||
|
||||
if (filament_detected_count <= steps - (MMU2_CAN_LOAD_DEVIATION / MMU2_CAN_LOAD_INCREMENT)) {
|
||||
if (filament_detected_count <= steps - (MMU2_CAN_LOAD_DEVIATION) / (MMU2_CAN_LOAD_INCREMENT)) {
|
||||
DEBUG_ECHOLNPGM(" failed.");
|
||||
return false;
|
||||
}
|
||||
|
@ -702,7 +895,7 @@ void MMU2::filament_runout() {
|
|||
#if BOTH(HAS_LCD_MENU, MMU2_MENUS)
|
||||
|
||||
// Load filament into MMU2
|
||||
void MMU2::load_filament(uint8_t index) {
|
||||
void MMU2::load_filament(const uint8_t index) {
|
||||
if (!enabled) return;
|
||||
command(MMU_CMD_L0 + index);
|
||||
manage_response(false, false);
|
||||
|
@ -714,7 +907,7 @@ void MMU2::filament_runout() {
|
|||
* Switch material and load to nozzle
|
||||
*
|
||||
*/
|
||||
bool MMU2::load_filament_to_nozzle(uint8_t index) {
|
||||
bool MMU2::load_filament_to_nozzle(const uint8_t index) {
|
||||
|
||||
if (!enabled) return false;
|
||||
|
||||
|
@ -739,7 +932,6 @@ void MMU2::filament_runout() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Load filament to nozzle of multimaterial printer
|
||||
*
|
||||
* This function is used only only after T? (user select filament) and M600 (change filament).
|
||||
|
@ -751,7 +943,7 @@ void MMU2::filament_runout() {
|
|||
execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, COUNT(load_to_nozzle_sequence));
|
||||
}
|
||||
|
||||
bool MMU2::eject_filament(uint8_t index, bool recover) {
|
||||
bool MMU2::eject_filament(const uint8_t index, const bool recover) {
|
||||
|
||||
if (!enabled) return false;
|
||||
|
||||
|
@ -798,9 +990,7 @@ void MMU2::filament_runout() {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* unload from hotend and retract to MMU
|
||||
*
|
||||
* Unload from hotend and retract to MMU
|
||||
*/
|
||||
bool MMU2::unload() {
|
||||
|
||||
|
|
|
@ -44,24 +44,24 @@ public:
|
|||
static void init();
|
||||
static void reset();
|
||||
static void mmu_loop();
|
||||
static void tool_change(uint8_t index);
|
||||
static void tool_change(const uint8_t index);
|
||||
static void tool_change(const char* special);
|
||||
static uint8_t get_current_tool();
|
||||
static void set_filament_type(uint8_t index, uint8_t type);
|
||||
static void set_filament_type(const uint8_t index, const uint8_t type);
|
||||
|
||||
#if BOTH(HAS_LCD_MENU, MMU2_MENUS)
|
||||
static bool unload();
|
||||
static void load_filament(uint8_t);
|
||||
static void load_all();
|
||||
static bool load_filament_to_nozzle(uint8_t index);
|
||||
static bool eject_filament(uint8_t index, bool recover);
|
||||
static bool load_filament_to_nozzle(const uint8_t index);
|
||||
static bool eject_filament(const uint8_t index, const bool recover);
|
||||
#endif
|
||||
|
||||
private:
|
||||
static bool rx_str_P(const char* str);
|
||||
static void tx_str_P(const char* str);
|
||||
static void tx_printf_P(const char* format, int argument);
|
||||
static void tx_printf_P(const char* format, int argument1, int argument2);
|
||||
static void tx_printf_P(const char* format, const int argument);
|
||||
static void tx_printf_P(const char* format, const int argument1, const int argument2);
|
||||
static void clear_rx_buffer();
|
||||
|
||||
static bool rx_ok();
|
||||
|
@ -89,6 +89,10 @@ private:
|
|||
FORCE_INLINE static bool load_to_gears() { return true; }
|
||||
#endif
|
||||
|
||||
#if ENABLED(MMU_EXTRUDER_SENSOR)
|
||||
static void mmu_continue_loading();
|
||||
#endif
|
||||
|
||||
static bool enabled, ready, mmu_print_saved;
|
||||
|
||||
static uint8_t cmd, cmd_arg, last_cmd, extruder;
|
||||
|
@ -96,7 +100,7 @@ private:
|
|||
static volatile int8_t finda;
|
||||
static volatile bool finda_runout_valid;
|
||||
static int16_t version, buildnr;
|
||||
static millis_t last_request, next_P0_request;
|
||||
static millis_t prev_request, prev_P0_request;
|
||||
static char rx_buffer[MMU_RX_SIZE], tx_buffer[MMU_TX_SIZE];
|
||||
|
||||
static inline void set_runout_valid(const bool valid) {
|
||||
|
|
|
@ -2742,12 +2742,14 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
|
|||
* Prusa MMU2 requirements
|
||||
*/
|
||||
#if ENABLED(PRUSA_MMU2)
|
||||
#if DISABLED(NOZZLE_PARK_FEATURE)
|
||||
#error "PRUSA_MMU2 requires NOZZLE_PARK_FEATURE."
|
||||
#elif EXTRUDERS != 5
|
||||
#if EXTRUDERS != 5
|
||||
#error "PRUSA_MMU2 requires EXTRUDERS = 5."
|
||||
#elif ENABLED(PRUSA_MMU2_S_MODE) && DISABLED(FILAMENT_RUNOUT_SENSOR)
|
||||
#error "PRUSA_MMU2_S_MODE requires FILAMENT_RUNOUT_SENSOR. Enable it to continue."
|
||||
#elif DISABLED(NOZZLE_PARK_FEATURE)
|
||||
#error "PRUSA_MMU2 requires NOZZLE_PARK_FEATURE. Enable it to continue."
|
||||
#elif EITHER(PRUSA_MMU2_S_MODE, MMU_EXTRUDER_SENSOR) && DISABLED(FILAMENT_RUNOUT_SENSOR)
|
||||
#error "PRUSA_MMU2_S_MODE or MMU_EXTRUDER_SENSOR requires FILAMENT_RUNOUT_SENSOR. Enable it to continue."
|
||||
#elif BOTH(PRUSA_MMU2_S_MODE, MMU_EXTRUDER_SENSOR)
|
||||
#error "Enable only one of PRUSA_MMU2_S_MODE or MMU_EXTRUDER_SENSOR."
|
||||
#elif DISABLED(ADVANCED_PAUSE_FEATURE)
|
||||
static_assert(nullptr == strstr(MMU2_FILAMENT_RUNOUT_SCRIPT, "M600"), "ADVANCED_PAUSE_FEATURE is required to use M600 with PRUSA_MMU2.");
|
||||
#endif
|
||||
|
|
|
@ -476,15 +476,16 @@ namespace Language_fr {
|
|||
PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("Echec sonde");
|
||||
PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: Trop froid");
|
||||
|
||||
PROGMEM Language_Str MSG_KILL_MMU2_FIRMWARE = _UxGT("MAJ firmware MMU!!");
|
||||
PROGMEM Language_Str MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("CHOISIR FILAMENT");
|
||||
PROGMEM Language_Str MSG_MMU2_MENU = _UxGT("MMU");
|
||||
PROGMEM Language_Str MSG_MMU2_NOT_RESPONDING = _UxGT("MMU ne répond plus");
|
||||
PROGMEM Language_Str MSG_MMU2_RESUME = _UxGT("Continuer impr.");
|
||||
PROGMEM Language_Str MSG_MMU2_RESUMING = _UxGT("Reprise...");
|
||||
PROGMEM Language_Str MSG_MMU2_LOAD_FILAMENT = _UxGT("Charger filament");
|
||||
PROGMEM Language_Str MSG_MMU2_LOAD_ALL = _UxGT("Charger tous");
|
||||
PROGMEM Language_Str MSG_MMU2_RESUME = _UxGT("Continuer Imp. MMU");
|
||||
PROGMEM Language_Str MSG_MMU2_RESUMING = _UxGT("Reprise MMU...");
|
||||
PROGMEM Language_Str MSG_MMU2_LOAD_FILAMENT = _UxGT("Charge dans MMU");
|
||||
PROGMEM Language_Str MSG_MMU2_LOAD_ALL = _UxGT("Charger tous dans MMU");
|
||||
PROGMEM Language_Str MSG_MMU2_LOAD_TO_NOZZLE = _UxGT("Charger dans buse");
|
||||
PROGMEM Language_Str MSG_MMU2_EJECT_FILAMENT = _UxGT("Ejecter filament");
|
||||
PROGMEM Language_Str MSG_MMU2_EJECT_FILAMENT = _UxGT("Ejecter fil. du MMU");
|
||||
PROGMEM Language_Str MSG_MMU2_EJECT_FILAMENT_N = _UxGT("Ejecter fil. ~");
|
||||
PROGMEM Language_Str MSG_MMU2_UNLOAD_FILAMENT = _UxGT("Retrait filament");
|
||||
PROGMEM Language_Str MSG_MMU2_LOADING_FILAMENT = _UxGT("Chargem. fil. %i...");
|
||||
|
|
Loading…
Reference in a new issue