From cc08d660f7c88fa133a7d6470595aaf2bcc2c90e Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 10 Sep 2018 20:55:50 +0200 Subject: [PATCH 1/7] Always use filament 1 for first layer calibration when MMU is present. Lift Z when moving from intro line to meander. For MMU, print longer intro line to allow load to nozzle. --- Firmware/ultralcd.cpp | 59 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 3fb0f7c4..41b7f28e 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1257,9 +1257,9 @@ void lcd_commands() if(lcd_commands_step>1) lcd_timeoutToStatus.start(); //if user dont confirm live adjust Z value by pressing the knob, we are saving last value by timeout to status screen if (lcd_commands_step == 0) { - lcd_commands_step = 9; + lcd_commands_step = 10; } - if (lcd_commands_step == 9 && !blocks_queued() && cmd_buffer_empty()) + if (lcd_commands_step == 10 && !blocks_queued() && cmd_buffer_empty()) { enquecommand_P(PSTR("M107")); enquecommand_P(PSTR("M104 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP))); @@ -1267,26 +1267,54 @@ void lcd_commands() enquecommand_P(PSTR("M190 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP))); enquecommand_P(PSTR("M109 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP))); enquecommand_P(_T(MSG_M117_V2_CALIBRATION)); - if (mmu_enabled) - enquecommand_P(PSTR("T?")); enquecommand_P(PSTR("G28")); enquecommand_P(PSTR("G92 E0.0")); - lcd_commands_step = 8; + + lcd_commands_step = 9; } + if (lcd_commands_step == 9 && !blocks_queued() && cmd_buffer_empty()) + { + lcd_clear(); + menu_depth = 0; + menu_submenu(lcd_babystep_z); + + if (mmu_enabled) + { + const uint8_t filament = 0; + strcpy(cmd1, "T"); + strcat(cmd1, itostr3left(filament)); + enquecommand(cmd1); + enquecommand_P(PSTR("M83")); //intro line + enquecommand_P(PSTR("G1 Y-3.0 F1000.0")); //intro line + enquecommand_P(PSTR("G1 Z0.4 F1000.0")); //intro line + enquecommand_P(PSTR("G1 X55.0 E32.0 F1073.0")); //intro line + enquecommand_P(PSTR("G1 X5.0 E32.0 F1800.0")); //intro line + enquecommand_P(PSTR("G1 X55.0 E8.0 F2000.0")); //intro line + enquecommand_P(PSTR("G1 Z0.3 F1000.0")); //intro line + enquecommand_P(PSTR("G92 E0.0")); //intro line + enquecommand_P(PSTR("G1 X240.0 E25.0 F2200.0")); //intro line + enquecommand_P(PSTR("G1 Y-2.0 F1000.0")); //intro line + enquecommand_P(PSTR("G1 X55.0 E25 F1400.0")); //intro line + enquecommand_P(PSTR("G1 Z0.20 F1000.0")); //intro line + enquecommand_P(PSTR("G1 X5.0 E4.0 F1000.0")); //intro line + + } else + { + enquecommand_P(PSTR("G1 X60.0 E9.0 F1000.0")); //intro line + enquecommand_P(PSTR("G1 X100.0 E12.5 F1000.0")); //intro line + } + + lcd_commands_step = 8; + } if (lcd_commands_step == 8 && !blocks_queued() && cmd_buffer_empty()) { - lcd_clear(); - menu_depth = 0; - menu_submenu(lcd_babystep_z); - enquecommand_P(PSTR("G1 X60.0 E9.0 F1000.0")); //intro line - enquecommand_P(PSTR("G1 X100.0 E12.5 F1000.0")); //intro line enquecommand_P(PSTR("G92 E0.0")); enquecommand_P(PSTR("G21")); //set units to millimeters enquecommand_P(PSTR("G90")); //use absolute coordinates enquecommand_P(PSTR("M83")); //use relative distances for extrusion enquecommand_P(PSTR("G1 E-1.50000 F2100.00000")); - enquecommand_P(PSTR("G1 Z0.150 F7200.000")); + enquecommand_P(PSTR("G1 Z5 F7200.000")); enquecommand_P(PSTR("M204 S1000")); //set acceleration enquecommand_P(PSTR("G1 F4000")); lcd_commands_step = 7; @@ -1316,6 +1344,7 @@ void lcd_commands() enquecommand_P(PSTR("G1 X50 Y155")); + enquecommand_P(PSTR("G1 Z0.150 F7200.000")); enquecommand_P(PSTR("G1 F1080")); enquecommand_P(PSTR("G1 X75 Y155 E2.5")); enquecommand_P(PSTR("G1 X100 Y155 E2")); @@ -4335,7 +4364,13 @@ void lcd_wizard(int state) { lcd_commands_type = LCD_COMMAND_V2_CAL; setTargetHotend(PLA_PREHEAT_HOTEND_TEMP, 0); setTargetBed(PLA_PREHEAT_HPB_TEMP); - wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is filament loaded?"), false);////MSG_WIZARD_FILAMENT_LOADED c=20 r=2 + if (mmu_enabled) + { + wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is filament 1 loaded?"), false);////c=20 r=2 + } else + { + wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is filament loaded?"), false);////MSG_WIZARD_FILAMENT_LOADED c=20 r=2 + } if (wizard_event) state = 8; else state = 6; From 6c6354b2cb0298a54dbb505804ca812af93e9fc4 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 11 Sep 2018 16:03:46 +0200 Subject: [PATCH 2/7] Do not preheat nozzle before loading filament to MMU in first layer calibration wizard. Show insert PLA filament to the first tube of MMU instead of "to the extruder". First layer calibration wizard with MMU is now functional. But there is no option to unload filament from wizard. --- Firmware/ultralcd.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index adfd0014..60dfbca3 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4373,8 +4373,11 @@ void lcd_wizard(int state) { wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is filament loaded?"), false);////MSG_WIZARD_FILAMENT_LOADED c=20 r=2 } if (wizard_event) state = 8; - else state = 6; - + else + { + if(mmu_enabled) state = 7; + else state = 6; + } break; case 6: //waiting for preheat nozzle for PLA; #ifndef SNMM @@ -4399,7 +4402,13 @@ void lcd_wizard(int state) { state = 7; break; case 7: //load filament - lcd_show_fullscreen_message_and_wait_P(_i("Please insert PLA filament to the extruder, then press knob to load it."));////MSG_WIZARD_LOAD_FILAMENT c=20 r=8 + if (mmu_enabled) + { + lcd_show_fullscreen_message_and_wait_P(_i("Please insert PLA filament to the first tube of MMU, then press the knob to load it."));////c=20 r=8 + } else + { + lcd_show_fullscreen_message_and_wait_P(_i("Please insert PLA filament to the extruder, then press knob to load it."));////MSG_WIZARD_LOAD_FILAMENT c=20 r=8 + } lcd_update_enable(false); lcd_clear(); lcd_puts_at_P(0, 2, _T(MSG_LOADING_FILAMENT)); From 19a1ccdc768fb295901597b6c27bb62fa66e3059 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 11 Sep 2018 16:51:00 +0200 Subject: [PATCH 3/7] Rename choose_extruder_menu() to choose_menu_P(), add parameters to make it reusable. --- Firmware/Marlin_main.cpp | 2 +- Firmware/ultralcd.cpp | 16 ++++++++-------- Firmware/ultralcd.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 9d641c67..33074b71 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -6816,7 +6816,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } else { if (*(strchr_pointer + index) == '?') { - tmp_extruder = choose_extruder_menu(); + tmp_extruder = choose_menu_P(_T(MSG_CHOOSE_EXTRUDER), _T(MSG_EXTRUDER)); } else { tmp_extruder = code_value(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 60dfbca3..3f05a628 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4969,7 +4969,7 @@ static char snmm_stop_print_menu() { //menu for choosing which filaments will be } -char choose_extruder_menu() +char choose_menu_P(const char *header, const char *item) { int items_no = mmu_enabled?5:4; int first = 0; @@ -4979,17 +4979,17 @@ char choose_extruder_menu() enc_dif = lcd_encoder_diff; lcd_clear(); - lcd_puts_P(_T(MSG_CHOOSE_EXTRUDER)); + lcd_puts_P(header); lcd_set_cursor(0, 1); lcd_print(">"); for (int i = 0; i < 3; i++) { - lcd_puts_at_P(1, i + 1, _T(MSG_EXTRUDER)); + lcd_puts_at_P(1, i + 1, item); } KEEPALIVE_STATE(PAUSED_FOR_USER); while (1) { for (int i = 0; i < 3; i++) { - lcd_set_cursor(2 + strlen_P(_T(MSG_EXTRUDER)), i+1); + lcd_set_cursor(2 + strlen_P(item), i+1); lcd_print(first + i + 1); } @@ -5012,9 +5012,9 @@ char choose_extruder_menu() if (first < items_no - 3) { first++; lcd_clear(); - lcd_puts_P(_T(MSG_CHOOSE_EXTRUDER)); + lcd_puts_P(header); for (int i = 0; i < 3; i++) { - lcd_puts_at_P(1, i + 1, _T(MSG_EXTRUDER)); + lcd_puts_at_P(1, i + 1, item); } } } @@ -5024,9 +5024,9 @@ char choose_extruder_menu() if (first > 0) { first--; lcd_clear(); - lcd_puts_P(_T(MSG_CHOOSE_EXTRUDER)); + lcd_puts_P(header); for (int i = 0; i < 3; i++) { - lcd_puts_at_P(1, i + 1, _T(MSG_EXTRUDER)); + lcd_puts_at_P(1, i + 1, item); } } } diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 113f6f70..20c1707a 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -152,7 +152,7 @@ bool lcd_wait_for_pinda(float temp); void bowden_menu(); char reset_menu(); -char choose_extruder_menu(); +char choose_menu_P(const char *header, const char *item); void lcd_pinda_calibration_menu(); void lcd_calibrate_pinda(); From 46df46f48268ac0bd5dfff9808f72869e52c7df2 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 11 Sep 2018 17:03:20 +0200 Subject: [PATCH 4/7] Add possibility to use other filaments in LCD_COMMAND_V2_CAL. --- Firmware/ultralcd.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 3f05a628..9bd966a5 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1250,6 +1250,7 @@ void lcd_commands() if (lcd_commands_type == LCD_COMMAND_V2_CAL) { char cmd1[30]; + uint8_t filament = 0; float width = 0.4; float length = 20 - width; float extr = count_e(0.2, width, length); @@ -1259,6 +1260,32 @@ void lcd_commands() { lcd_commands_step = 10; } + if (lcd_commands_step == 20 && !blocks_queued() && cmd_buffer_empty()) + { + filament = 0; + lcd_commands_step = 10; + } + if (lcd_commands_step == 21 && !blocks_queued() && cmd_buffer_empty()) + { + filament = 1; + lcd_commands_step = 10; + } + if (lcd_commands_step == 22 && !blocks_queued() && cmd_buffer_empty()) + { + filament = 2; + lcd_commands_step = 10; + } + if (lcd_commands_step == 23 && !blocks_queued() && cmd_buffer_empty()) + { + filament = 3; + lcd_commands_step = 10; + } + if (lcd_commands_step == 24 && !blocks_queued() && cmd_buffer_empty()) + { + filament = 4; + lcd_commands_step = 10; + } + if (lcd_commands_step == 10 && !blocks_queued() && cmd_buffer_empty()) { enquecommand_P(PSTR("M107")); @@ -1280,7 +1307,6 @@ void lcd_commands() if (mmu_enabled) { - const uint8_t filament = 0; strcpy(cmd1, "T"); strcat(cmd1, itostr3left(filament)); enquecommand(cmd1); From 98264808dcfed971fd137c5ce29d0617ba9fed6c Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 11 Sep 2018 17:16:13 +0200 Subject: [PATCH 5/7] Change gcode "T?" question from "Choose extruder:" to "Choose filament" and answers from "Extruder 1" .. "Extruder 5" to "Filament 1" .. "Filament 5". --- Firmware/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 33074b71..589ab814 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -6816,7 +6816,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } else { if (*(strchr_pointer + index) == '?') { - tmp_extruder = choose_menu_P(_T(MSG_CHOOSE_EXTRUDER), _T(MSG_EXTRUDER)); + tmp_extruder = choose_menu_P(_i("Choose filament:"), _i("Filament")); ////c=20 r=1 ////c=17 r=1 } else { tmp_extruder = code_value(); From 5649d6c3c0007b3797e0cd0d5be8945c784ee68f Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 11 Sep 2018 17:27:10 +0200 Subject: [PATCH 6/7] Precede active filament on status screen with letter F. --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 9bd966a5..0b26cec2 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -533,7 +533,7 @@ void lcdui_print_extruder(void) { int chars = 0; if (mmu_extruder == tmp_extruder) - chars = lcd_printf_P(_N(" T%u"), mmu_extruder+1); + chars = lcd_printf_P(_N(" F%u"), mmu_extruder+1); else chars = lcd_printf_P(_N(" %u>%u"), mmu_extruder+1, tmp_extruder+1); lcd_space(5 - chars); From ada7cffd32e28ae51bf8cbb572bdbab172245e90 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 11 Sep 2018 19:53:29 +0200 Subject: [PATCH 7/7] Open menu to select filament before first layer calibration if MMU unit is present. --- Firmware/ultralcd.cpp | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 0b26cec2..830a35d6 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1256,7 +1256,8 @@ void lcd_commands() float extr = count_e(0.2, width, length); float extr_short_segment = count_e(0.2, width, width); if(lcd_commands_step>1) lcd_timeoutToStatus.start(); //if user dont confirm live adjust Z value by pressing the knob, we are saving last value by timeout to status screen - if (lcd_commands_step == 0) + + if (lcd_commands_step == 0 && !blocks_queued() && cmd_buffer_empty()) { lcd_commands_step = 10; } @@ -1286,11 +1287,17 @@ void lcd_commands() lcd_commands_step = 10; } - if (lcd_commands_step == 10 && !blocks_queued() && cmd_buffer_empty()) + if (lcd_commands_step == 10) { enquecommand_P(PSTR("M107")); enquecommand_P(PSTR("M104 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP))); enquecommand_P(PSTR("M140 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP))); + if (mmu_enabled) + { + strcpy(cmd1, "T"); + strcat(cmd1, itostr3left(filament)); + enquecommand(cmd1); + } enquecommand_P(PSTR("M190 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP))); enquecommand_P(PSTR("M109 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP))); enquecommand_P(_T(MSG_M117_V2_CALIBRATION)); @@ -1307,9 +1314,6 @@ void lcd_commands() if (mmu_enabled) { - strcpy(cmd1, "T"); - strcat(cmd1, itostr3left(filament)); - enquecommand(cmd1); enquecommand_P(PSTR("M83")); //intro line enquecommand_P(PSTR("G1 Y-3.0 F1000.0")); //intro line enquecommand_P(PSTR("G1 Z0.4 F1000.0")); //intro line @@ -4274,7 +4278,10 @@ void lcd_toshiba_flash_air_compatibility_toggle() void lcd_v2_calibration() { if (mmu_enabled) + { + lcd_commands_step = 20 + choose_menu_P(_i("Select PLA filament:"),_i("Filament")); ////c=20 r=1 ////c=17 r=1 lcd_commands_type = LCD_COMMAND_V2_CAL; + } else { bool loaded = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is PLA filament loaded?"), false, true);////MSG_PLA_FILAMENT_LOADED c=20 r=2 @@ -4995,6 +5002,16 @@ static char snmm_stop_print_menu() { //menu for choosing which filaments will be } +//! @brief Select one of numbered items +//! +//! Create list of items with header. Header can not be selected. +//! Each item has text description passed by function parameter and +//! number. There are 5 items, if mmu_enabled, 4 otherwise. +//! Items are numbered from 1 to 4 or 5. But index returned starts at 0. +//! +//! @param header Header text +//! @param item Item text +//! @return selected item index, first item index is 0 char choose_menu_P(const char *header, const char *item) { int items_no = mmu_enabled?5:4; @@ -5067,21 +5084,14 @@ char choose_menu_P(const char *header, const char *item) enc_dif = lcd_encoder_diff; delay(100); } - } - if (lcd_clicked()) { - lcd_update(2); - while (lcd_clicked()); - delay(10); - while (lcd_clicked()); - KEEPALIVE_STATE(IN_HANDLER); + if (lcd_clicked()) + { + KEEPALIVE_STATE(IN_HANDLER); return(cursor_pos + first - 1); - } - } - } //#endif