Browse Source

timeout used everywhere where we are waiting for mmu reponse

PavelSindler 5 năm trước cách đây
mục cha
commit
b9be718deb
3 tập tin đã thay đổi với 12 bổ sung14 xóa
  1. 2 1
      Firmware/Marlin.h
  2. 5 1
      Firmware/Marlin_main.cpp
  3. 5 12
      Firmware/ultralcd.cpp

+ 2 - 1
Firmware/Marlin.h

@@ -466,4 +466,5 @@ void gcode_M701();
 
 void proc_commands();
 
-bool mmu_get_reponse();
+bool mmu_get_reponse();
+void mmu_not_responding();

+ 5 - 1
Firmware/Marlin_main.cpp

@@ -3368,7 +3368,7 @@ void process_commands()
 		else if (code_seen("MMURES")) {
 			fprintf_P(uart2io, PSTR("x0"));
 			bool response = mmu_get_reponse();
-			if (!response) printf_P(PSTR("MMU not responding"));
+			if (!response) mmu_not_responding();
 		}
 		else if (code_seen("RESET")) {
             // careful!
@@ -9148,4 +9148,8 @@ bool mmu_get_reponse() {
 	return response;
 }
 
+void mmu_not_responding() {
+	printf_P(PSTR("MMU not responding"));
+}
+
 #define FIL_LOAD_LENGTH 60

+ 5 - 12
Firmware/ultralcd.cpp

@@ -5219,12 +5219,8 @@ void extr_adj(int extruder) //loading filament for SNMM
 	lcd_print(snmm_extruder + 1);
 
 	// get response
-    uart2_rx_clr();
-	while (!uart2_rx_ok())
-    {
-      //printf_P(PSTR("waiting..\n"));
-      delay_keep_alive(100);
-    }
+	bool reponse = mmu_get_reponse();
+	if (!response) mmu_not_responding();
 	lcd_update_enable(true);
 	
 	
@@ -5296,12 +5292,9 @@ void extr_unload() { //unloads filament
 		fprintf_P(uart2io, PSTR("U0\n"));
 
 		// get response
-		uart2_rx_clr();
-		while (!uart2_rx_ok())
-		{
-			//printf_P(PSTR("waiting..\n"));
-			delay_keep_alive(100);
-		}
+		bool reponse = mmu_get_reponse();
+		if (!response) mmu_not_responding();
+
 		lcd_update_enable(true);
 		#else //SNMM_V2