From c38458eb67460ca53637c8ed3b03855dbdae4bd0 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Tue, 23 Jan 2018 16:21:43 +0100 Subject: [PATCH 1/3] init --- Firmware/Marlin_main.cpp | 11 +++++++++-- Firmware/temperature.cpp | 1 + Firmware/ultralcd.cpp | 18 ++++++++++++------ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index eee08b18..d1e9bdac 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2621,7 +2621,7 @@ void process_commands() { st_synchronize(); -#if 0 +#if 1 SERIAL_ECHOPGM("G28, initial "); print_world_coordinates(); SERIAL_ECHOPGM("G28, initial "); print_physical_coordinates(); #endif @@ -2866,7 +2866,7 @@ void process_commands() if (farm_mode) { prusa_statistics(20); }; homing_flag = false; -#if 0 +#if 1 SERIAL_ECHOPGM("G28, final "); print_world_coordinates(); SERIAL_ECHOPGM("G28, final "); print_physical_coordinates(); SERIAL_ECHOPGM("G28, final "); print_mesh_bed_leveling_table(); @@ -7353,6 +7353,13 @@ void long_pause() //long pause print pause_lastpos[Z_AXIS] = current_position[Z_AXIS]; pause_lastpos[E_AXIS] = current_position[E_AXIS]; + SERIAL_ECHOPGM("X: "); + MYSERIAL.println(pause_lastpos[X_AXIS]); + SERIAL_ECHOPGM("Y: "); + MYSERIAL.println(pause_lastpos[Y_AXIS]); + SERIAL_ECHOPGM("Z: "); + MYSERIAL.println(pause_lastpos[Z_AXIS]); + //retract current_position[E_AXIS] -= DEFAULT_RETRACTION; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400, active_extruder); diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index ab60e34e..f2135bb1 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -501,6 +501,7 @@ void fanSpeedError(unsigned char _fan) { } else { setTargetHotend0(0); + Stop(); } SERIAL_ERROR_START; switch (_fan) { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index ff0cc337..d7ed82c4 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -576,12 +576,17 @@ void lcd_commands() if (lcd_commands_type == LCD_COMMAND_LONG_PAUSE) { if(lcd_commands_step == 0) { - card.pauseSDPrint(); - lcd_setstatuspgm(MSG_FINISHING_MOVEMENTS); - lcdDrawUpdate = 3; - lcd_commands_step = 1; + if (card.sdprinting) { + card.pauseSDPrint(); + lcd_setstatuspgm(MSG_FINISHING_MOVEMENTS); + lcdDrawUpdate = 3; + lcd_commands_step = 1; + } + else { + lcd_commands_type = 0; + } } - if (lcd_commands_step == 1 && !blocks_queued()) { + if (lcd_commands_step == 1 && !blocks_queued() && !homing_flag) { lcd_setstatuspgm(MSG_PRINT_PAUSED); isPrintPaused = true; long_pause(); @@ -598,7 +603,7 @@ void lcd_commands() lcdDrawUpdate = 3; lcd_commands_step = 4; } - if (lcd_commands_step == 1 && !blocks_queued()) { //recover feedmultiply + if (lcd_commands_step == 1 && !blocks_queued() && (current_position[Z_AXIS] == pause_lastpos[Z_AXIS])) { //recover feedmultiply sprintf_P(cmd1, PSTR("M220 S%d"), saved_feedmultiply); enquecommand(cmd1); @@ -607,6 +612,7 @@ void lcd_commands() card.startFileprint(); lcd_commands_step = 0; lcd_commands_type = 0; + SERIAL_ECHOPGM("isPrintPaused set to false!!!"); } if (lcd_commands_step == 2 && !blocks_queued()) { //turn on fan, move Z and unretract From 05e0abbd9d9377c746ab86ac483379969935bccc Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Tue, 23 Jan 2018 19:11:04 +0100 Subject: [PATCH 2/3] startFileprint delayed --- Firmware/Marlin_main.cpp | 3 +-- Firmware/ultralcd.cpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d1e9bdac..2339799c 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -660,8 +660,7 @@ void crashdet_detected() lcd_setstatuspgm(MSG_CRASH_DETECTED); if (yesno) { - enquecommand_P(PSTR("G28 X")); - enquecommand_P(PSTR("G28 Y")); + enquecommand_P(PSTR("G28 X Y")); enquecommand_P(PSTR("CRASH_RECOVER")); } else diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d7ed82c4..66eeca8e 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -603,7 +603,7 @@ void lcd_commands() lcdDrawUpdate = 3; lcd_commands_step = 4; } - if (lcd_commands_step == 1 && !blocks_queued() && (current_position[Z_AXIS] == pause_lastpos[Z_AXIS])) { //recover feedmultiply + if (lcd_commands_step == 1 && !blocks_queued() && cmd_buffer_empty()) { //recover feedmultiply; cmd_buffer_empty() ensures that card.sdprinting is synchronized with buffered commands and thus print cant be paused until resume is finished sprintf_P(cmd1, PSTR("M220 S%d"), saved_feedmultiply); enquecommand(cmd1); From 64a709c097cbd643aed793675ce3b3d71dfc7a2e Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Tue, 23 Jan 2018 19:14:52 +0100 Subject: [PATCH 3/3] removed temporary debuging code --- Firmware/Marlin_main.cpp | 11 ++--------- Firmware/temperature.cpp | 1 - Firmware/ultralcd.cpp | 1 - 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 2339799c..9cd5ddbc 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2620,7 +2620,7 @@ void process_commands() { st_synchronize(); -#if 1 +#if 0 SERIAL_ECHOPGM("G28, initial "); print_world_coordinates(); SERIAL_ECHOPGM("G28, initial "); print_physical_coordinates(); #endif @@ -2865,7 +2865,7 @@ void process_commands() if (farm_mode) { prusa_statistics(20); }; homing_flag = false; -#if 1 +#if 0 SERIAL_ECHOPGM("G28, final "); print_world_coordinates(); SERIAL_ECHOPGM("G28, final "); print_physical_coordinates(); SERIAL_ECHOPGM("G28, final "); print_mesh_bed_leveling_table(); @@ -7352,13 +7352,6 @@ void long_pause() //long pause print pause_lastpos[Z_AXIS] = current_position[Z_AXIS]; pause_lastpos[E_AXIS] = current_position[E_AXIS]; - SERIAL_ECHOPGM("X: "); - MYSERIAL.println(pause_lastpos[X_AXIS]); - SERIAL_ECHOPGM("Y: "); - MYSERIAL.println(pause_lastpos[Y_AXIS]); - SERIAL_ECHOPGM("Z: "); - MYSERIAL.println(pause_lastpos[Z_AXIS]); - //retract current_position[E_AXIS] -= DEFAULT_RETRACTION; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400, active_extruder); diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index f2135bb1..ab60e34e 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -501,7 +501,6 @@ void fanSpeedError(unsigned char _fan) { } else { setTargetHotend0(0); - Stop(); } SERIAL_ERROR_START; switch (_fan) { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 66eeca8e..3a23bd7c 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -612,7 +612,6 @@ void lcd_commands() card.startFileprint(); lcd_commands_step = 0; lcd_commands_type = 0; - SERIAL_ECHOPGM("isPrintPaused set to false!!!"); } if (lcd_commands_step == 2 && !blocks_queued()) { //turn on fan, move Z and unretract