From b9be718deb062a8bdf77e6490d13958c2f52af27 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 18 Jul 2018 16:25:31 +0200 Subject: [PATCH] timeout used everywhere where we are waiting for mmu reponse --- Firmware/Marlin.h | 3 ++- Firmware/Marlin_main.cpp | 6 +++++- Firmware/ultralcd.cpp | 17 +++++------------ 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index c720531c5..d6afe3a2b 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -466,4 +466,5 @@ void gcode_M701(); void proc_commands(); -bool mmu_get_reponse(); \ No newline at end of file +bool mmu_get_reponse(); +void mmu_not_responding(); \ No newline at end of file diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 8675c77d4..e895f8ad0 100644 --- a/Firmware/Marlin_main.cpp +++ b/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 diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 42b506439..c2fbab78f 100644 --- a/Firmware/ultralcd.cpp +++ b/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