Browse Source

M600: show progress bar during first filament load

PavelSindler 6 years ago
parent
commit
f4c1e7924f
2 changed files with 13 additions and 18 deletions
  1. 1 1
      Firmware/Marlin_main.cpp
  2. 12 17
      Firmware/ultralcd.cpp

+ 1 - 1
Firmware/Marlin_main.cpp

@@ -8965,7 +8965,6 @@ static void print_time_remaining_init()
 
 void load_filament_final_feed()
 {
-	st_synchronize();
 	current_position[E_AXIS]+= FILAMENTCHANGE_FINALFEED;
 	plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 200/60, active_extruder);
 }
@@ -8990,6 +8989,7 @@ void M600_check_state()
 
 				// Filament loaded properly but color is not clear
 				case 3:
+					st_synchronize();
 					load_filament_final_feed();
 					lcd_loading_color();
 					st_synchronize();

+ 12 - 17
Firmware/ultralcd.cpp

@@ -2254,21 +2254,16 @@ void lcd_change_success() {
 
 }
 
-static void lcd_loading_progress_bar() {
-  for (int i = 0; i < 20; i++) {
-
-    lcd_set_cursor(i, 3);
-    lcd_print(".");
-	//0.375 s delay:
-    for (int j = 0; j < 5 ; j++) {
-      manage_heater();
-      manage_inactivity(true);
-      delay(75);
-
-    }
-
-
-  }
+static void lcd_loading_progress_bar(uint16_t loading_time_ms) {
+	
+	for (int i = 0; i < 20; i++) {
+		lcd_set_cursor(i, 3);
+		lcd_print(".");
+		//loading_time_ms/20 delay
+		for (int j = 0; j < 5; j++) {
+			delay_keep_alive(loading_time_ms / 100);
+		}
+	}
 }
 
 
@@ -2282,7 +2277,7 @@ void lcd_loading_color() {
   lcd_puts_P(_i("Loading color"));////MSG_LOADING_COLOR c=0 r=0
   lcd_set_cursor(0, 2);
   lcd_puts_P(_T(MSG_PLEASE_WAIT));
-  lcd_loading_progress_bar();
+  lcd_loading_progress_bar(7500); //slow sequence: 7.5 seconds
 }
 
 
@@ -2311,7 +2306,7 @@ void lcd_loading_filament() {
 
   }
 #else //SNMM
-  lcd_loading_progress_bar();
+  lcd_loading_progress_bar(11000); //fast + slow sequence: 7.5 seconds
 #endif //SNMM
 }