Address 3 different start scenarios 1st lay cal + MMU
This PR tries to address the 3 different startup scenarios for 1st layer calibration with the MMU: - 1st lay cal started with correct filament already loaded in the nozzle - we should continue, but skip the first 58mm (first 2 g-codes in the hard coded sequence) of purge line extrusion - 1st lay cal started with other filament already loaded in the nozzle - we should unload and then issue a toolchange with no extra unload - 1st lay cal started without loaded filament - we should just do a toolchange with no extra unload PFW-1457
This commit is contained in:
parent
52a3beb931
commit
85d27e6e5e
|
|
@ -32,21 +32,39 @@ void lay1cal_wait_preheat()
|
|||
//! @brief Load filament
|
||||
//! @param cmd_buffer character buffer needed to format gcodes
|
||||
//! @param filament filament to use (applies for MMU only)
|
||||
void lay1cal_load_filament(char *cmd_buffer, uint8_t filament)
|
||||
//! @returns true if extra purge distance is needed in case of MMU prints (after a toolchange), otherwise false
|
||||
bool lay1cal_load_filament(char *cmd_buffer, uint8_t filament)
|
||||
{
|
||||
if (MMU2::mmu2.Enabled())
|
||||
{
|
||||
enquecommand_P(PSTR("M83"));
|
||||
enquecommand_P(PSTR("G1 Y-3.0 F1000.0"));
|
||||
enquecommand_P(PSTR("G1 Z0.4 F1000.0"));
|
||||
sprintf_P(cmd_buffer, PSTR("T%d"), filament);
|
||||
enquecommand(cmd_buffer);
|
||||
}
|
||||
|
||||
uint8_t currentTool = MMU2::mmu2.get_current_tool();
|
||||
if(currentTool == filament ){
|
||||
// already have the correct tool loaded - do nothing
|
||||
return false;
|
||||
} else if( currentTool != (uint8_t)MMU2::FILAMENT_UNKNOWN){
|
||||
// some other slot is loaded, perform an unload first
|
||||
enquecommand_P(PSTR("M702"));
|
||||
}
|
||||
// perform a toolchange
|
||||
// sprintf_P(cmd_buffer, PSTR("T%d"), filament);
|
||||
// rewriting the trivial T<filament> g-code command saves 30B:
|
||||
cmd_buffer[0] = 'T';
|
||||
cmd_buffer[1] = filament + '0';
|
||||
cmd_buffer[2] = 0;
|
||||
|
||||
enquecommand(cmd_buffer);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//! @brief Print intro line
|
||||
void lay1cal_intro_line()
|
||||
//! @param extraPurgeNeeded false if the first MMU-related "G1 E29" have to be skipped because the nozzle is already full of filament
|
||||
void lay1cal_intro_line(bool extraPurgeNeeded)
|
||||
{
|
||||
static const char cmd_intro_mmu_3[] PROGMEM = "G1 X55.0 E29.0 F1073.0";
|
||||
static const char cmd_intro_mmu_4[] PROGMEM = "G1 X5.0 E29.0 F1800.0";
|
||||
|
|
@ -61,8 +79,10 @@ void lay1cal_intro_line()
|
|||
|
||||
static const char * const intro_mmu_cmd[] PROGMEM =
|
||||
{
|
||||
// first 2 items are only relevant if filament was not loaded - i.e. extraPurgeNeeded == true
|
||||
cmd_intro_mmu_3,
|
||||
cmd_intro_mmu_4,
|
||||
|
||||
cmd_intro_mmu_5,
|
||||
cmd_intro_mmu_6,
|
||||
cmd_intro_mmu_7,
|
||||
|
|
@ -75,7 +95,7 @@ void lay1cal_intro_line()
|
|||
|
||||
if (MMU2::mmu2.Enabled())
|
||||
{
|
||||
for (uint8_t i = 0; i < (sizeof(intro_mmu_cmd)/sizeof(intro_mmu_cmd[0])); ++i)
|
||||
for (uint8_t i = (extraPurgeNeeded ? 0 : 2); i < (sizeof(intro_mmu_cmd)/sizeof(intro_mmu_cmd[0])); ++i)
|
||||
{
|
||||
enquecommand_P(static_cast<char*>(pgm_read_ptr(&intro_mmu_cmd[i])));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
#include <stdint.h>
|
||||
|
||||
void lay1cal_wait_preheat();
|
||||
void lay1cal_load_filament(char *cmd_buffer, uint8_t filament);
|
||||
void lay1cal_intro_line();
|
||||
[[nodiscard]] bool lay1cal_load_filament(char *cmd_buffer, uint8_t filament);
|
||||
void lay1cal_intro_line(bool skipExtraPurge);
|
||||
void lay1cal_before_meander();
|
||||
void lay1cal_meander(char *cmd_buffer);
|
||||
void lay1cal_square(char *cmd_buffer, uint8_t i);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "mmu2_progress_converter.h"
|
||||
#include "mmu2_reporting.h"
|
||||
|
||||
#include "cardreader.h" // for IS_SD_PRINTING
|
||||
#include "Marlin.h"
|
||||
#include "language.h"
|
||||
#include "messages.h"
|
||||
|
|
@ -334,7 +335,10 @@ bool MMU2::tool_change(uint8_t slot) {
|
|||
return false;
|
||||
|
||||
if (slot != extruder) {
|
||||
if (FindaDetectsFilament()) {
|
||||
if (/*FindaDetectsFilament()*/
|
||||
/*!IS_SD_PRINTING && !usb_timer.running()*/
|
||||
! printer_active()
|
||||
) {
|
||||
// If Tcodes are used manually through the serial
|
||||
// we need to unload manually as well -- but only if FINDA detects filament
|
||||
unload();
|
||||
|
|
@ -385,7 +389,7 @@ void MMU2::get_statistics() {
|
|||
logic.Statistics();
|
||||
}
|
||||
|
||||
uint8_t MMU2::get_current_tool() const {
|
||||
uint8_t __attribute__((noinline)) MMU2::get_current_tool() const {
|
||||
return extruder == MMU2_NO_TOOL ? (uint8_t)FILAMENT_UNKNOWN : extruder;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ int8_t FSensorStateMenu = 1;
|
|||
|
||||
LcdCommands lcd_commands_type = LcdCommands::Idle;
|
||||
static uint8_t lcd_commands_step = 0;
|
||||
static bool extraPurgeNeeded = false; ///< lcd_commands - detect if extra purge after MMU-toolchange is necessary or not
|
||||
|
||||
CustomMsg custom_message_type = CustomMsg::Status;
|
||||
uint8_t custom_message_state = 0;
|
||||
|
|
@ -874,14 +875,14 @@ void lcd_commands()
|
|||
lcd_commands_step = 10;
|
||||
break;
|
||||
case 10:
|
||||
lay1cal_load_filament(cmd1, lay1cal_filament);
|
||||
extraPurgeNeeded = lay1cal_load_filament(cmd1, lay1cal_filament);
|
||||
lcd_commands_step = 9;
|
||||
break;
|
||||
case 9:
|
||||
lcd_clear();
|
||||
menu_depth = 0;
|
||||
menu_submenu(lcd_babystep_z);
|
||||
lay1cal_intro_line();
|
||||
lay1cal_intro_line(extraPurgeNeeded);
|
||||
lcd_commands_step = 8;
|
||||
break;
|
||||
case 8:
|
||||
|
|
|
|||
Loading…
Reference in New Issue