From f4c1e7924fc6cb8ef762f4121a98f8aaa49e91df Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 12 Nov 2018 18:35:06 +0100 Subject: [PATCH] M600: show progress bar during first filament load --- Firmware/Marlin_main.cpp | 2 +- Firmware/ultralcd.cpp | 29 ++++++++++++----------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index ffa12d38..51de11f6 100644 --- a/Firmware/Marlin_main.cpp +++ b/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(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 7ff77937..2d8ba024 100644 --- a/Firmware/ultralcd.cpp +++ b/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 }