improved load filament, creating M701
This commit is contained in:
parent
047f2a8389
commit
040a738202
3 changed files with 45 additions and 61 deletions
|
@ -284,6 +284,7 @@ extern unsigned long starttime;
|
|||
extern unsigned long stoptime;
|
||||
extern bool is_usb_printing;
|
||||
extern bool homing_flag;
|
||||
extern bool loading_flag;
|
||||
extern unsigned int usb_printing_counter;
|
||||
|
||||
extern unsigned long kicktime;
|
||||
|
|
|
@ -272,6 +272,7 @@ unsigned long total_filament_used;
|
|||
unsigned int heating_status;
|
||||
unsigned int heating_status_counter;
|
||||
bool custom_message;
|
||||
bool loading_flag = false;
|
||||
unsigned int custom_message_type;
|
||||
unsigned int custom_message_state;
|
||||
|
||||
|
@ -2067,7 +2068,7 @@ void process_commands()
|
|||
// lcd_calibration();
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
else if (code_seen('^')) {
|
||||
// nothing, this is a version line
|
||||
} else if(code_seen('G'))
|
||||
|
@ -5062,6 +5063,43 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|||
#endif
|
||||
}
|
||||
break;
|
||||
case 701: //M701: load filament
|
||||
{
|
||||
enable_z();
|
||||
custom_message = true;
|
||||
custom_message_type = 2;
|
||||
axis_relative_modes[3] = true;
|
||||
|
||||
lcd_setstatuspgm(MSG_LOADING_FILAMENT);
|
||||
current_position[E_AXIS] += 70;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence
|
||||
|
||||
current_position[E_AXIS] += 40;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 100 / 60, active_extruder); //slow sequence
|
||||
st_synchronize();
|
||||
|
||||
if (!farm_mode && loading_flag) {
|
||||
bool clean = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILAMENT_CLEAN);
|
||||
|
||||
while (!clean) {
|
||||
lcd_update_enable(true);
|
||||
lcd_update(2);
|
||||
current_position[E_AXIS] += 40;
|
||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 100 / 60, active_extruder); //slow sequence
|
||||
st_synchronize();
|
||||
clean = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILAMENT_CLEAN);
|
||||
}
|
||||
}
|
||||
lcd_update_enable(true);
|
||||
lcd_update(2);
|
||||
lcd_setstatuspgm(WELCOME_MSG);
|
||||
disable_z();
|
||||
loading_flag = false;
|
||||
custom_message = false;
|
||||
custom_message_type = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 999: // M999: Restart after being stopped
|
||||
Stopped = false;
|
||||
lcd_reset_alert_level();
|
||||
|
|
|
@ -497,62 +497,6 @@ static void lcd_status_screen()
|
|||
|
||||
void lcd_commands()
|
||||
{
|
||||
if (lcd_commands_type == LCD_COMMAND_LOAD_FILAMENT) //// load filament sequence
|
||||
{
|
||||
if (lcd_commands_step == 0) { lcd_commands_step = 7; custom_message = true;}
|
||||
if (lcd_commands_step == 1 && !blocks_queued())
|
||||
{
|
||||
lcd_commands_step = 0;
|
||||
lcd_commands_type = 0;
|
||||
lcd_setstatuspgm(WELCOME_MSG);
|
||||
disable_z();
|
||||
custom_message = false;
|
||||
custom_message_type = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (lcd_commands_step == 2 && !blocks_queued())
|
||||
{
|
||||
lcd_commands_step = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILAMENT_CLEAN) ? 1 : 4;
|
||||
lcd_update_enable(true);
|
||||
lcdDrawUpdate = 2;
|
||||
|
||||
}
|
||||
if (lcd_commands_step == 3 && !blocks_queued()) {
|
||||
lcd_commands_step = farm_mode ? 1:2; //don't show question about clear color if we are in farm mode
|
||||
}
|
||||
|
||||
if (lcd_commands_step == 4 && !blocks_queued())
|
||||
{
|
||||
//lcd_setstatuspgm(MSG_LOADING_FILAMENT);
|
||||
enquecommand_P(PSTR(LOAD_FILAMENT_2)); //slow_sequence
|
||||
lcd_commands_step = 3;
|
||||
}
|
||||
if (lcd_commands_step == 5 && !blocks_queued())
|
||||
{
|
||||
enquecommand_P(PSTR(LOAD_FILAMENT_1)); //fast sequence
|
||||
lcd_setstatuspgm(MSG_LOADING_FILAMENT);
|
||||
//enquecommand_P(PSTR("G4")); //dwell
|
||||
lcd_commands_step = 4;
|
||||
}
|
||||
if (lcd_commands_step == 6 && !blocks_queued())
|
||||
{
|
||||
lcd_setstatuspgm(MSG_INSERT_FILAMENT);
|
||||
enquecommand_P(PSTR(LOAD_FILAMENT_0)); //set E relative
|
||||
enquecommand_P(PSTR("G1 E0.1 F400"));
|
||||
lcd_commands_step = 5;
|
||||
}
|
||||
if (lcd_commands_step == 7 && !blocks_queued())
|
||||
{
|
||||
lcd_setstatuspgm(MSG_PLEASE_WAIT);
|
||||
enable_z();
|
||||
custom_message = true;
|
||||
custom_message_type = 2;
|
||||
lcd_commands_step = 6;
|
||||
}
|
||||
}
|
||||
|
||||
if (lcd_commands_type == LCD_COMMAND_STOP_PRINT) /// stop print
|
||||
{
|
||||
|
||||
|
@ -1125,10 +1069,9 @@ void lcd_LoadFilament()
|
|||
if (degHotend0() > EXTRUDE_MINTEMP)
|
||||
{
|
||||
custom_message = true;
|
||||
lcd_commands_type = LCD_COMMAND_LOAD_FILAMENT;
|
||||
SERIAL_ECHOLN("Loading filament");
|
||||
// commands() will handle the rest
|
||||
|
||||
loading_flag = true;
|
||||
enquecommand_P(PSTR("M701"));
|
||||
SERIAL_ECHOLN("Loading filament");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4206,6 +4149,8 @@ static void menu_action_function(menuFunc_t data) {
|
|||
}
|
||||
static void menu_action_sdfile(const char* filename, char* longFilename)
|
||||
{
|
||||
loading_flag = false;
|
||||
|
||||
char cmd[30];
|
||||
char* c;
|
||||
sprintf_P(cmd, PSTR("M23 %s"), filename);
|
||||
|
|
Loading…
Reference in a new issue