From 22cf2c6b6ba1cd3c08602fdfeee11cc4f58d7c12 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 9 Nov 2018 15:31:44 +0100 Subject: [PATCH] M600 load messages synchronization fixed --- Firmware/Marlin_main.cpp | 8 ++++---- Firmware/mmu.cpp | 2 ++ Firmware/ultralcd.cpp | 40 ++++++++++++++++++++-------------------- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 14a92184..7e9da1c1 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3081,6 +3081,7 @@ void gcode_M701() plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence load_filament_final_feed(); //slow sequence + st_synchronize(); if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) tone(BEEPER, 500); delay_keep_alive(50); @@ -8968,7 +8969,6 @@ 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); - st_synchronize(); } void M600_check_state() @@ -8991,10 +8991,9 @@ void M600_check_state() // Filament loaded properly but color is not clear case 3: - 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); + load_filament_final_feed(); lcd_loading_color(); + st_synchronize(); break; // Everything good @@ -9114,6 +9113,7 @@ void M600_load_filament_movements() #endif load_filament_final_feed(); lcd_loading_filament(); + st_synchronize(); } void M600_load_filament() { diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 2db7d42f..5c1570d4 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -574,6 +574,7 @@ void mmu_M600_load_filament(bool automatic) mmu_extruder = tmp_extruder; //filament change is finished mmu_load_to_nozzle(); load_filament_final_feed(); + st_synchronize(); } @@ -1077,6 +1078,7 @@ void lcd_mmu_load_to_nozzle(uint8_t filament_nr) mmu_extruder = tmp_extruder; //filament change is finished mmu_load_to_nozzle(); load_filament_final_feed(); + st_synchronize(); custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT)); lcd_return_to_status(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d619d12b..311d72ca 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2254,19 +2254,7 @@ void lcd_change_success() { } - -void lcd_loading_color() { - //we are extruding 25mm with feedrate 200mm/min -> 7.5 seconds for whole action, 0.375 s for one character - - lcd_clear(); - - lcd_set_cursor(0, 0); - - 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)); - - +static void lcd_loading_progress_bar() { for (int i = 0; i < 20; i++) { lcd_set_cursor(i, 3); @@ -2281,7 +2269,20 @@ void lcd_loading_color() { } +} + +void lcd_loading_color() { + //we are extruding 25mm with feedrate 200mm/min -> 7.5 seconds for whole action, 0.375 s for one character + + lcd_clear(); + + lcd_set_cursor(0, 0); + + 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(); } @@ -2295,7 +2296,7 @@ void lcd_loading_filament() { lcd_puts_P(_T(MSG_LOADING_FILAMENT)); lcd_set_cursor(0, 2); lcd_puts_P(_T(MSG_PLEASE_WAIT)); - +#ifdef SNMM for (int i = 0; i < 20; i++) { lcd_set_cursor(i, 3); @@ -2303,17 +2304,15 @@ void lcd_loading_filament() { for (int j = 0; j < 10 ; j++) { manage_heater(); manage_inactivity(true); -#ifdef SNMM - delay(153); -#else - delay(137); -#endif + delay(153); } } - +#else //SNMM + lcd_loading_progress_bar(); +#endif //SNMM } @@ -2425,6 +2424,7 @@ void lcd_load_filament_color_check() lcd_update_enable(true); lcd_update(2); load_filament_final_feed(); + st_synchronize(); clean = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_FILAMENT_CLEAN), false, true); } }