From 7e48d633cbce9985daa8bc5d299c6d8bf3e7c5ea Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Mon, 4 Mar 2019 21:30:36 +0100 Subject: [PATCH 1/6] mode switching info-message viewing during mode switching --- Firmware/ultralcd.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 2f0cb785..8f93d321 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4515,6 +4515,7 @@ static void lcd_silent_mode_set() { } eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu); #ifdef TMC2130 + lcd_display_message_fullscreen_P(_i("Mode change in progress ...")); // Wait until the planner queue is drained and the stepper routine achieves // an idle state. st_synchronize(); @@ -4535,6 +4536,7 @@ static void lcd_silent_mode_set() { #ifdef TMC2130 if (CrashDetectMenu && (SilentModeMenu != SILENT_MODE_NORMAL)) menu_submenu(lcd_crash_mode_info2); + lcd_encoder_diff=0; // reset 'encoder buffer' #endif //TMC2130 } From b2255c8be9e2274a5ba0cd9e03e7ca8e1c6d83d7 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 4 Mar 2019 22:00:24 +0100 Subject: [PATCH 2/6] Preheat nozzle before loading filament in M600 (change filament) gcode. This fixes problem of not heating the nozzle when retrying load after MMU load failed. --- Firmware/Marlin.h | 2 +- Firmware/Marlin_main.cpp | 9 +++++---- Firmware/mmu.cpp | 8 ++++++-- Firmware/mmu.h | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 2d469a76..0664a7f4 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -493,5 +493,5 @@ void proc_commands(); void M600_load_filament(); void M600_load_filament_movements(); void M600_wait_for_user(float HotendTempBckp); -void M600_check_state(); +void M600_check_state(float nozzle_temp); void load_filament_final_feed(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d14226f3..899ec833 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3040,12 +3040,12 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float manage_response(false, false); } } - mmu_M600_load_filament(automatic); + mmu_M600_load_filament(automatic, HotendTempBckp); } else M600_load_filament(); - if (!automatic) M600_check_state(); + if (!automatic) M600_check_state(HotendTempBckp); lcd_update_enable(true); @@ -9090,7 +9090,8 @@ void load_filament_final_feed() plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_EFEED_FINAL, active_extruder); } -void M600_check_state() +//! @par nozzle_temp nozzle temperature to load filament +void M600_check_state(float nozzle_temp) { //Wait for user to check the state lcd_change_fil_state = 0; @@ -9103,7 +9104,7 @@ void M600_check_state() // Filament failed to load so load it again case 2: if (mmu_enabled) - mmu_M600_load_filament(false); //nonautomatic load; change to "wrong filament loaded" option? + mmu_M600_load_filament(false, nozzle_temp); //nonautomatic load; change to "wrong filament loaded" option? else M600_load_filament_movements(); break; diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 449efabd..0f92128b 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -830,9 +830,10 @@ void mmu_M600_wait_and_beep() { WRITE(BEEPER, LOW); } -void mmu_M600_load_filament(bool automatic) +//! @brief load filament for mmu v2 +//! @par nozzle_temp nozzle temperature to load filament +void mmu_M600_load_filament(bool automatic, float nozzle_temp) { - //load filament for mmu v2 tmp_extruder = mmu_extruder; if (!automatic) { #ifdef MMU_M600_SWITCH_EXTRUDER @@ -852,6 +853,9 @@ void mmu_M600_load_filament(bool automatic) // printf_P(PSTR("T code: %d \n"), tmp_extruder); // mmu_printf_P(PSTR("T%d\n"), tmp_extruder); + setTargetHotend(nozzle_temp,active_extruder); + mmu_wait_for_heater_blocking(); + mmu_command(MmuCmd::T0 + tmp_extruder); manage_response(false, true, MMU_LOAD_MOVE); diff --git a/Firmware/mmu.h b/Firmware/mmu.h index b498a374..c2e8b713 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -97,7 +97,7 @@ extern void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move = extern void mmu_load_to_nozzle(); -extern void mmu_M600_load_filament(bool automatic); +extern void mmu_M600_load_filament(bool automatic, float nozzle_temp); extern void mmu_M600_wait_and_beep(); extern void extr_mov(float shift, float feed_rate); From f161d3ade484cb29ea475c59627c9dd228905c28 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 4 Mar 2019 22:17:43 +0100 Subject: [PATCH 3/6] Change formatting. --- Firmware/Marlin_main.cpp | 60 +++++++++++++++++++++------------------- Firmware/mmu.cpp | 58 +++++++++++++++++++------------------- 2 files changed, 61 insertions(+), 57 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 899ec833..4442c47a 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9090,39 +9090,41 @@ void load_filament_final_feed() plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_EFEED_FINAL, active_extruder); } +//! @brief Wait for user to check the state //! @par nozzle_temp nozzle temperature to load filament void M600_check_state(float nozzle_temp) { - //Wait for user to check the state - lcd_change_fil_state = 0; - while (lcd_change_fil_state != 1){ - lcd_change_fil_state = 0; - KEEPALIVE_STATE(PAUSED_FOR_USER); - lcd_alright(); - KEEPALIVE_STATE(IN_HANDLER); - switch(lcd_change_fil_state){ - // Filament failed to load so load it again - case 2: - if (mmu_enabled) - mmu_M600_load_filament(false, nozzle_temp); //nonautomatic load; change to "wrong filament loaded" option? - else - M600_load_filament_movements(); - break; + lcd_change_fil_state = 0; + while (lcd_change_fil_state != 1) + { + lcd_change_fil_state = 0; + KEEPALIVE_STATE(PAUSED_FOR_USER); + lcd_alright(); + KEEPALIVE_STATE(IN_HANDLER); + switch(lcd_change_fil_state) + { + // Filament failed to load so load it again + case 2: + if (mmu_enabled) + mmu_M600_load_filament(false, nozzle_temp); //nonautomatic load; change to "wrong filament loaded" option? + else + M600_load_filament_movements(); + break; - // Filament loaded properly but color is not clear - case 3: - st_synchronize(); - load_filament_final_feed(); - lcd_loading_color(); - st_synchronize(); - break; - - // Everything good - default: - lcd_change_success(); - break; - } - } + // Filament loaded properly but color is not clear + case 3: + st_synchronize(); + load_filament_final_feed(); + lcd_loading_color(); + st_synchronize(); + break; + + // Everything good + default: + lcd_change_success(); + break; + } + } } //! @brief Wait for user action diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 0f92128b..45a3c421 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -834,37 +834,39 @@ void mmu_M600_wait_and_beep() { //! @par nozzle_temp nozzle temperature to load filament void mmu_M600_load_filament(bool automatic, float nozzle_temp) { - tmp_extruder = mmu_extruder; - if (!automatic) { -#ifdef MMU_M600_SWITCH_EXTRUDER - bool yes = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Do you want to switch extruder?"), false); - if(yes) tmp_extruder = choose_extruder_menu(); -#endif //MMU_M600_SWITCH_EXTRUDER - } - else { - tmp_extruder = ad_getAlternative(tmp_extruder); - } - lcd_update_enable(false); - lcd_clear(); - lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_LOADING_FILAMENT)); - lcd_print(" "); - lcd_print(tmp_extruder + 1); - snmm_filaments_used |= (1 << tmp_extruder); //for stop print + tmp_extruder = mmu_extruder; + if (!automatic) + { + #ifdef MMU_M600_SWITCH_EXTRUDER + bool yes = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Do you want to switch extruder?"), false); + if(yes) tmp_extruder = choose_extruder_menu(); + #endif //MMU_M600_SWITCH_EXTRUDER + } + else + { + tmp_extruder = ad_getAlternative(tmp_extruder); + } + lcd_update_enable(false); + lcd_clear(); + lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_LOADING_FILAMENT)); + lcd_print(" "); + lcd_print(tmp_extruder + 1); + snmm_filaments_used |= (1 << tmp_extruder); //for stop print -// printf_P(PSTR("T code: %d \n"), tmp_extruder); -// mmu_printf_P(PSTR("T%d\n"), tmp_extruder); - setTargetHotend(nozzle_temp,active_extruder); - mmu_wait_for_heater_blocking(); + //printf_P(PSTR("T code: %d \n"), tmp_extruder); + //mmu_printf_P(PSTR("T%d\n"), tmp_extruder); + setTargetHotend(nozzle_temp,active_extruder); + mmu_wait_for_heater_blocking(); - mmu_command(MmuCmd::T0 + tmp_extruder); + mmu_command(MmuCmd::T0 + tmp_extruder); - manage_response(false, true, MMU_LOAD_MOVE); - mmu_continue_loading(); - mmu_extruder = tmp_extruder; //filament change is finished - - mmu_load_to_nozzle(); - load_filament_final_feed(); - st_synchronize(); + manage_response(false, true, MMU_LOAD_MOVE); + mmu_continue_loading(); + mmu_extruder = tmp_extruder; //filament change is finished + + mmu_load_to_nozzle(); + load_filament_final_feed(); + st_synchronize(); } From 20a03d703d2cd802a02b49cd733bf80f7f05074c Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Tue, 5 Mar 2019 13:36:13 +0100 Subject: [PATCH 4/6] G-code unification "FSENSOR_RECOVER" ->-> "PRUSA fsensor_recover" --- Firmware/Marlin_main.cpp | 11 ++++++----- Firmware/fsensor.cpp | 4 ++-- Firmware/mmu.cpp | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 68292d90..8c021ab7 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3463,11 +3463,6 @@ void process_commands() } #endif //BACKLASH_Y #endif //TMC2130 -#ifdef FILAMENT_SENSOR - else if (code_seen("FSENSOR_RECOVER")) { //! FSENSOR_RECOVER - fsensor_restore_print_and_continue(); - } -#endif //FILAMENT_SENSOR else if(code_seen("PRUSA")){ if (code_seen("Ping")) { //! PRUSA Ping if (farm_mode) { @@ -3498,6 +3493,12 @@ void process_commands() eeprom_update_byte((uint8_t*)EEPROM_UVLO,0); enquecommand_P(PSTR("M24")); } +#ifdef FILAMENT_SENSOR + else if (code_seen("fsensor_recover")) //! PRUSA fsensor_recover + { + fsensor_restore_print_and_continue(); + } +#endif //FILAMENT_SENSOR else if (code_seen("MMURES")) //! PRUSA MMURES { mmu_reset(); diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp index ead77076..d520ba53 100644 --- a/Firmware/fsensor.cpp +++ b/Firmware/fsensor.cpp @@ -567,7 +567,7 @@ void fsensor_update(void) printf_P(PSTR("fsensor_update - M600\n")); eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1); eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1); - enquecommand_front_P(PSTR("FSENSOR_RECOVER")); + enquecommand_front_P(PSTR("PRUSA fsensor_recover")); enquecommand_front_P((PSTR("M600"))); fsensor_watch_runout = false; } @@ -581,7 +581,7 @@ void fsensor_update(void) printf_P(PSTR("fsensor_update - M600\n")); eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1); eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1); - enquecommand_front_P(PSTR("FSENSOR_RECOVER")); + enquecommand_front_P(PSTR("PRUSA fsensor_recover")); enquecommand_front_P((PSTR("M600"))); } #endif //PAT9125 diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 2e3fca91..e299b3aa 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -358,7 +358,7 @@ void mmu_loop(void) //printf_P(PSTR("Eact: %d\n"), int(e_active())); if (!mmu_finda && CHECK_FSENSOR && fsensor_enabled) { fsensor_stop_and_save_print(); - enquecommand_front_P(PSTR("FSENSOR_RECOVER")); //then recover + enquecommand_front_P(PSTR("PRUSA fsensor_recover")); //then recover ad_markDepleted(mmu_extruder); if (lcd_autoDepleteEnabled() && !ad_allDepleted()) { From 6217329d509c57a7f3b3ea526e903f4efdf385fc Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Wed, 6 Mar 2019 19:51:26 +0100 Subject: [PATCH 5/6] SD card menu enhancement --- Firmware/messages.c | 1 + Firmware/messages.h | 1 + Firmware/ultralcd.cpp | 14 ++++++-------- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Firmware/messages.c b/Firmware/messages.c index 7943d220..029cf0c6 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -52,6 +52,7 @@ const char MSG_LOAD_FILAMENT[] PROGMEM_I1 = ISTR("Load filament"); ////c=17 r=0 const char MSG_LOADING_FILAMENT[] PROGMEM_I1 = ISTR("Loading filament"); ////c=20 r=0 const char MSG_M117_V2_CALIBRATION[] PROGMEM_I1 = ISTR("M117 First layer cal."); ////c=25 r=1 const char MSG_MAIN[] PROGMEM_I1 = ISTR("Main"); ////c=0 r=0 +const char MSG_BACK[] PROGMEM_I1 = ISTR("Back"); ////c=0 r=0 const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1[] PROGMEM_I1 = ISTR("Measuring reference height of calibration point"); ////c=60 r=0 const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2[] PROGMEM_I1 = ISTR(" of 9"); ////c=14 r=0 const char MSG_MENU_CALIBRATION[] PROGMEM_I1 = ISTR("Calibration"); ////c=0 r=0 diff --git a/Firmware/messages.h b/Firmware/messages.h index ce6ecdd7..5083b26d 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -53,6 +53,7 @@ extern const char MSG_LOAD_FILAMENT[]; extern const char MSG_LOADING_FILAMENT[]; extern const char MSG_M117_V2_CALIBRATION[]; extern const char MSG_MAIN[]; +extern const char MSG_BACK[]; extern const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1[]; extern const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2[]; extern const char MSG_MENU_CALIBRATION[]; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 2f0cb785..5dae2090 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5292,9 +5292,9 @@ do\ EEPROM_read(EEPROM_SD_SORT, (uint8_t*)&sdSort, sizeof(sdSort));\ switch (sdSort)\ {\ - case SD_SORT_TIME: MENU_ITEM_FUNCTION_P(_i("Sort: [time]"), lcd_sort_type_set); break;/*////MSG_SORT_TIME c=17 r=1*/\ - case SD_SORT_ALPHA: MENU_ITEM_FUNCTION_P(_i("Sort: [alphabet]"), lcd_sort_type_set); break;/*////MSG_SORT_ALPHA c=17 r=1*/\ - default: MENU_ITEM_FUNCTION_P(_i("Sort: [none]"), lcd_sort_type_set);/*////MSG_SORT_NONE c=17 r=1*/\ + case SD_SORT_TIME: MENU_ITEM_FUNCTION_P(_i("Sort [time]"), lcd_sort_type_set); break;/*////MSG_SORT_TIME c=17 r=1*/\ + case SD_SORT_ALPHA: MENU_ITEM_FUNCTION_P(_i("Sort [alphabet]"), lcd_sort_type_set); break;/*////MSG_SORT_ALPHA c=17 r=1*/\ + default: MENU_ITEM_FUNCTION_P(_i("Sort [none]"), lcd_sort_type_set);/*////MSG_SORT_NONE c=17 r=1*/\ }\ }\ }\ @@ -6725,10 +6725,7 @@ void lcd_sdcard_menu() MENU_BEGIN(); - if(bMain) // i.e. default menu-item - MENU_ITEM_BACK_P(_T(MSG_MAIN)); - else // i.e. menu-item after card insertion - MENU_ITEM_FUNCTION_P(_T(MSG_WATCH),lcd_return_to_status); + MENU_ITEM_BACK_P(_T(bMain?MSG_MAIN:MSG_BACK)); // i.e. default menu-item / menu-item after card insertion card.getWorkDirName(); if (card.filename[0] == '/') { @@ -8148,6 +8145,8 @@ void menu_lcd_lcdupdate_func(void) } else { + if(menu_menu==lcd_sdcard_menu) + menu_back(); card.release(); LCD_MESSAGERPGM(_i("Card removed"));////MSG_SD_REMOVED c=0 r=0 } @@ -8192,4 +8191,3 @@ void menu_lcd_lcdupdate_func(void) lcd_send_status(); if (lcd_commands_type == LCD_COMMAND_V2_CAL) lcd_commands(); } - From 3388444b6c5e92e85cf1a9feb48dd8adc3af91f8 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Mon, 11 Mar 2019 20:43:07 +0100 Subject: [PATCH 6/6] better autoLoad II autoLoad inhibit if Support::ExtruderInfo(@MKx)/SensorInfo(@MKxS)-menu is selected --- Firmware/Marlin_main.cpp | 9 ++++++++- Firmware/ultralcd.cpp | 6 +++--- Firmware/ultralcd.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 612b1795..cfa0efa6 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7479,11 +7479,18 @@ static void handleSafetyTimer() void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument set in Marlin.h { +bool bInhibitFlag; #ifdef FILAMENT_SENSOR if (mmu_enabled == false) { //-// if (mcode_in_progress != 600) //M600 not in progress - if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad) && (menu_menu!=lcd_menu_extruder_info)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo menu not active +#ifdef PAT9125 + bInhibitFlag=(menu_menu==lcd_menu_extruder_info); // Support::ExtruderInfo menu active +#endif // PAT9125 +#ifdef IR_SENSOR + bInhibitFlag=(menu_menu==lcd_menu_show_sensors_state); // Support::SensorInfo menu active +#endif // IR_SENSOR + if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad) && (!bInhibitFlag)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active { if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active) { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index c6e1d8e2..f08cb89c 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -133,14 +133,14 @@ static void prusa_stat_farm_number(); static void prusa_stat_temperatures(); static void prusa_stat_printinfo(); static void lcd_farm_no(); -void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") +//static void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") static void lcd_menu_xyz_y_min(); static void lcd_menu_xyz_skew(); static void lcd_menu_xyz_offset(); static void lcd_menu_fails_stats_mmu(); static void lcd_menu_fails_stats_mmu_print(); static void lcd_menu_fails_stats_mmu_total(); -static void lcd_menu_show_sensors_state(); +//static void lcd_menu_show_sensors_state(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") static void mmu_fil_eject_menu(); static void mmu_load_to_nozzle_menu(); @@ -4038,7 +4038,7 @@ static void lcd_show_sensors_state() lcd_print_state(idler_state); } -static void lcd_menu_show_sensors_state() +void lcd_menu_show_sensors_state() // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") { lcd_timeoutToStatus.stop(); lcd_show_sensors_state(); diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index affd7b0b..1641e4ce 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -46,6 +46,7 @@ extern bool lcd_selftest(); void lcd_menu_statistics(); void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") +void lcd_menu_show_sensors_state(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") extern const char* lcd_display_message_fullscreen_P(const char *msg, uint8_t &nlines); extern const char* lcd_display_message_fullscreen_P(const char *msg);