Selaa lähdekoodia

Use stop_and_save_print_to_ram() and restore_print_from_ram_and_continue() pair to pause print from menu. Move declaration of those functions to marlin.h. Move declaration of FSensorStateMenu to ultralcd.h.

Known limitations: Filament is not retracted, extruder is not lifted in Z and moved to rear left corner in XY. Nozzle heating is not turned off nor restored. Unused code is not removed.
Marek Bel 6 vuotta sitten
vanhempi
commit
af08e16426
5 muutettua tiedostoa jossa 16 lisäystä ja 9 poistoa
  1. 3 0
      Firmware/Marlin.h
  2. 0 3
      Firmware/Marlin_main.cpp
  3. 1 4
      Firmware/fsensor.cpp
  4. 11 2
      Firmware/ultralcd.cpp
  5. 1 0
      Firmware/ultralcd.h

+ 3 - 0
Firmware/Marlin.h

@@ -419,6 +419,9 @@ extern void print_world_coordinates();
 extern void print_physical_coordinates();
 extern void print_mesh_bed_leveling_table();
 
+extern void stop_and_save_print_to_ram(float z_move, float e_move);
+extern void restore_print_from_ram_and_continue(float e_move);
+
 
 //estimated time to end of the print
 extern uint16_t print_time_remaining();

+ 0 - 3
Firmware/Marlin_main.cpp

@@ -649,9 +649,6 @@ void servo_init()
 }
 
 
-void stop_and_save_print_to_ram(float z_move, float e_move);
-void restore_print_from_ram_and_continue(float e_move);
-
 bool fans_check_enabled = true;
 
 

+ 1 - 4
Firmware/fsensor.cpp

@@ -7,6 +7,7 @@
 #include "planner.h"
 #include "fastio.h"
 #include "cmdqueue.h"
+#include "ultralcd.h"
 
 //Basic params
 #define FSENSOR_CHUNK_LEN    0.64F  //filament sensor chunk length 0.64mm
@@ -27,10 +28,6 @@ const char ERRMSG_PAT9125_NOT_RESP[] PROGMEM = "PAT9125 not responding (%d)!\n";
 #define FSENSOR_INT_PIN         63  //filament sensor interrupt pin PK1
 #define FSENSOR_INT_PIN_MSK   0x02  //filament sensor interrupt pin mask (bit1)
 
-extern void stop_and_save_print_to_ram(float z_move, float e_move);
-extern void restore_print_from_ram_and_continue(float e_move);
-extern int8_t FSensorStateMenu;
-
 void fsensor_stop_and_save_print(void)
 {
 	printf_P(PSTR("fsensor_stop_and_save_print\n"));

+ 11 - 2
Firmware/ultralcd.cpp

@@ -5520,6 +5520,15 @@ static void lcd_test_menu()
 }
 #endif //LCD_TEST
 
+static void pause_print()
+{
+    stop_and_save_print_to_ram(0.0,0.0);
+}
+static void resume_print()
+{
+    restore_print_from_ram_and_continue(0.0);
+}
+
 static void lcd_main_menu()
 {
 
@@ -5613,11 +5622,11 @@ static void lcd_main_menu()
 		if (mesh_bed_leveling_flag == false && homing_flag == false) {
 			if (card.sdprinting)
 			{
-				MENU_ITEM_FUNCTION_P(_i("Pause print"), lcd_sdcard_pause);////MSG_PAUSE_PRINT c=0 r=0
+				MENU_ITEM_FUNCTION_P(_i("Pause print"), pause_print);////MSG_PAUSE_PRINT c=0 r=0
 			}
 			else
 			{
-				MENU_ITEM_FUNCTION_P(_i("Resume print"), lcd_sdcard_resume);////MSG_RESUME_PRINT c=0 r=0
+				MENU_ITEM_FUNCTION_P(_i("Resume print"), resume_print);////MSG_RESUME_PRINT c=0 r=0
 			}
 			MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop);
 		}

+ 1 - 0
Firmware/ultralcd.h

@@ -82,6 +82,7 @@ extern void lcd_diag_show_end_stops();
 #define LCD_COMMAND_V2_CAL 8
 
 extern int lcd_commands_type;
+extern int8_t FSensorStateMenu;
 
 #define CUSTOM_MSG_TYPE_STATUS 0 // status message from lcd_status_message variable
 #define CUSTOM_MSG_TYPE_MESHBL 1 // Mesh bed leveling in progress