From acb0341a1faa35a5ef731ad51c92a662ed06ddfd Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 11 Sep 2019 22:42:40 +0200 Subject: [PATCH 01/29] Do not set temperature in lay1cal_preheat(). --- Firmware/first_lay_cal.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/Firmware/first_lay_cal.cpp b/Firmware/first_lay_cal.cpp index 3ab34c41f..aa338d2c0 100644 --- a/Firmware/first_lay_cal.cpp +++ b/Firmware/first_lay_cal.cpp @@ -14,28 +14,24 @@ void lay1cal_preheat() { static const char cmd_preheat_0[] PROGMEM = "M107"; - static const char cmd_preheat_1[] PROGMEM = "M104 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP); - static const char cmd_preheat_2[] PROGMEM = "M140 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP); - static const char cmd_preheat_3[] PROGMEM = "M190 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP); - static const char cmd_preheat_4[] PROGMEM = "M109 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP); - static const char cmd_preheat_5[] PROGMEM = "G28"; - static const char cmd_preheat_6[] PROGMEM = "G92 E0.0"; + static const char cmd_preheat_1[] PROGMEM = "M190"; + static const char cmd_preheat_2[] PROGMEM = "M109"; + static const char cmd_preheat_4[] PROGMEM = "G28"; + static const char cmd_preheat_5[] PROGMEM = "G92 E0.0"; - static const char * const preheat_cmd[] PROGMEM = + const char * const preheat_cmd[] = { cmd_preheat_0, cmd_preheat_1, cmd_preheat_2, - cmd_preheat_3, + _T(MSG_M117_V2_CALIBRATION), cmd_preheat_4, - cmd_preheat_5, //call MSG_M117_V2_CALIBRATION before - cmd_preheat_6, + cmd_preheat_5, }; for (uint8_t i = 0; i < (sizeof(preheat_cmd)/sizeof(preheat_cmd[0])); ++i) { - if (5 == i) enquecommand_P(_T(MSG_M117_V2_CALIBRATION)); - enquecommand_P(static_cast(pgm_read_ptr(&preheat_cmd[i]))); + enquecommand_P(preheat_cmd[i]); } } From 14dc6b86e05f537b6ffe9ce4bf190d6923000643 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 11 Sep 2019 23:37:09 +0200 Subject: [PATCH 02/29] Change undocumented behaviour of M190 (Wait for bed temperature). Document M190 and M109 (Wait for extruder temperature). Do not remember CooldownNoWait property set by M190 and M109. If M190 was invoked without parameters, CooldownNoWait property was set if it was previously set by "M109 S" or "M109 S" or printer was after power up. Otherwise CooldownNoWait was not set. Now CooldownNoWait is never set if M190 is invoked without parameters. Saves 44 B of FLASH memory. --- Firmware/Marlin_main.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 607d028b5..15014cf45 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -365,7 +365,6 @@ bool Stopped=false; Servo servos[NUM_SERVOS]; #endif -bool CooldownNoWait = true; bool target_direction; //Insert variables if CHDK is defined @@ -6006,6 +6005,14 @@ Sigma_Exit: } //! ### M109 - Wait for extruder temperature + //! Parameters (not mandatory): + //! * S \ set extruder temperature + //! * R \ set extruder temperature + //! + //! Parameters S and R are treated identically. + //! Command always waits for both cool down and heat up. + //! If no parameters are supplied waits for previously + //! set extruder temperature. // ------------------------------------------------- case 109: { @@ -6022,10 +6029,8 @@ Sigma_Exit: #endif if (code_seen('S')) { setTargetHotendSafe(code_value(), extruder); - CooldownNoWait = true; } else if (code_seen('R')) { setTargetHotendSafe(code_value(), extruder); - CooldownNoWait = false; } #ifdef AUTOTEMP if (code_seen('S')) autotemp_min=code_value(); @@ -6060,9 +6065,15 @@ Sigma_Exit: break; //! ### M190 - Wait for bed temperature - // --------------------------------------- + //! Parameters (not mandatory): + //! * S \ set extruder temperature and wait for heating + //! * R \ set extruder temperature and wait for heating or cooling + //! + //! If no parameter is supplied, waits for heating or cooling to previously set temperature. case 190: #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 + { + bool CooldownNoWait = false; LCD_MESSAGERPGM(_T(MSG_BED_HEATING)); heating_status = 3; if (farm_mode) { prusa_statistics(1); }; @@ -6074,7 +6085,6 @@ Sigma_Exit: else if (code_seen('R')) { setTargetBed(code_value()); - CooldownNoWait = false; } codenum = _millis(); @@ -6108,6 +6118,7 @@ Sigma_Exit: heating_status = 4; previous_millis_cmd = _millis(); + } #endif break; From ae3e6530e6f687a29db9431ee29637f0404e17ee Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 12 Sep 2019 00:14:24 +0200 Subject: [PATCH 03/29] Do not ask for PLA filament in the beginning of first layer calibration. Do not ask if filament is present if it can be detected by IR sensor. --- Firmware/ultralcd.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index ee8475d12..776540069 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4692,7 +4692,7 @@ void lcd_v2_calibration() { if (mmu_enabled) { - const uint8_t filament = choose_menu_P(_i("Select PLA filament:"),_T(MSG_FILAMENT),_i("Cancel")); ////c=20 r=1 ////c=19 r=1 + const uint8_t filament = choose_menu_P(_i("Select filament:"),_T(MSG_FILAMENT),_i("Cancel")); ////c=20 r=1 ////c=19 r=1 if (filament < 5) { lcd_commands_step = 20 + filament; @@ -4701,12 +4701,22 @@ void lcd_v2_calibration() } 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 + bool loaded = false; + if (fsensor_enabled && ir_sensor_detected) + { + loaded = (digitalRead(IR_SENSOR_PIN) == 0); + } + else + { + loaded = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is filament loaded?"), false, true);////MSG_PLA_FILAMENT_LOADED c=20 r=2 + } + + if (loaded) { lcd_commands_type = LcdCommands::Layer1Cal; } else { - lcd_display_message_fullscreen_P(_i("Please load PLA filament first."));////MSG_PLEASE_LOAD_PLA c=20 r=4 + lcd_display_message_fullscreen_P(_i("Please load filament first."));////MSG_PLEASE_LOAD_PLA c=20 r=4 lcd_consume_click(); for (uint_least8_t i = 0; i < 20; i++) { //wait max. 2s delay_keep_alive(100); From 43705aae2e43c1a196b3100d272a08c88c3c544f Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 12 Sep 2019 00:19:20 +0200 Subject: [PATCH 04/29] Rename lay1cal_preheat() to lay1cal_wait_preheat(). --- Firmware/first_lay_cal.cpp | 4 ++-- Firmware/first_lay_cal.h | 2 +- Firmware/ultralcd.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Firmware/first_lay_cal.cpp b/Firmware/first_lay_cal.cpp index aa338d2c0..a6b5f109f 100644 --- a/Firmware/first_lay_cal.cpp +++ b/Firmware/first_lay_cal.cpp @@ -10,8 +10,8 @@ #include "mmu.h" #include -//! @brief Preheat -void lay1cal_preheat() +//! @brief Wait for preheat +void lay1cal_wait_preheat() { static const char cmd_preheat_0[] PROGMEM = "M107"; static const char cmd_preheat_1[] PROGMEM = "M190"; diff --git a/Firmware/first_lay_cal.h b/Firmware/first_lay_cal.h index a52bef76c..d3d72004e 100644 --- a/Firmware/first_lay_cal.h +++ b/Firmware/first_lay_cal.h @@ -6,7 +6,7 @@ #define FIRMWARE_FIRST_LAY_CAL_H_ #include -void lay1cal_preheat(); +void lay1cal_wait_preheat(); void lay1cal_load_filament(char *cmd_buffer, uint8_t filament); void lay1cal_intro_line(); void lay1cal_before_meander(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 776540069..5ad55b5d5 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1370,7 +1370,7 @@ void lcd_commands() lcd_commands_step = 11; break; case 11: - lay1cal_preheat(); + lay1cal_wait_preheat(); lcd_commands_step = 10; break; case 10: From 6674cbf0d76b7b09ef1de77e6d79c38b4060b017 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 12 Sep 2019 17:54:05 +0200 Subject: [PATCH 05/29] Select material / temperature before first layer calibration. --- Firmware/ultralcd.cpp | 82 +++++++++++++++++++++++++------------------ Firmware/ultralcd.h | 1 + 2 files changed, 48 insertions(+), 35 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 883a48ece..7b3f832ef 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -95,6 +95,8 @@ uint8_t lcd_status_message_level; char lcd_status_message[LCD_WIDTH + 1] = ""; //////WELCOME! unsigned char firstrun = 1; +static uint8_t lay1cal_filament = 0; + static const char separator[] PROGMEM = "--------------------"; @@ -1338,7 +1340,6 @@ void lcd_commands() if (lcd_commands_type == LcdCommands::Layer1Cal) { char cmd1[30]; - static uint8_t filament = 0; 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 @@ -1349,32 +1350,12 @@ void lcd_commands() case 0: lcd_commands_step = 11; break; - case 20: - filament = 0; - lcd_commands_step = 11; - break; - case 21: - filament = 1; - lcd_commands_step = 11; - break; - case 22: - filament = 2; - lcd_commands_step = 11; - break; - case 23: - filament = 3; - lcd_commands_step = 11; - break; - case 24: - filament = 4; - lcd_commands_step = 11; - break; case 11: lay1cal_wait_preheat(); lcd_commands_step = 10; break; case 10: - lay1cal_load_filament(cmd1, filament); + lay1cal_load_filament(cmd1, lay1cal_filament); lcd_commands_step = 9; break; case 9: @@ -2113,6 +2094,7 @@ switch(eFilamentAction) case FilamentAction::MmuCut: case FilamentAction::None: case FilamentAction::Preheat: + case FilamentAction::Lay1Cal: break; } if(lcd_clicked()) @@ -2142,6 +2124,7 @@ if(lcd_clicked()) case FilamentAction::MmuCut: case FilamentAction::None: case FilamentAction::Preheat: + case FilamentAction::Lay1Cal: break; } } @@ -2158,9 +2141,9 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed) setTargetHotend0((float )nTemp); if (!wizard_active) setTargetBed((float) nTempBed); - if (eFilamentAction == FilamentAction::Preheat) + if (eFilamentAction == FilamentAction::Preheat || eFilamentAction == FilamentAction::Lay1Cal) { - eFilamentAction = FilamentAction::None; + if (eFilamentAction == FilamentAction::Lay1Cal) lcd_commands_type = LcdCommands::Layer1Cal; lcd_return_to_status(); if (wizard_active) lcd_wizard(WizState::Unload); return; @@ -2218,6 +2201,8 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed) break; case FilamentAction::None: case FilamentAction::Preheat: + case FilamentAction::Lay1Cal: + break; } if (bFilamentWaitingFlag) Sound_MakeSound(e_SOUND_TYPE_StandardPrompt); @@ -2248,6 +2233,7 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed) break; case FilamentAction::None: case FilamentAction::Preheat: + case FilamentAction::Lay1Cal: break; } lcd_set_cursor(0, 3); @@ -2329,7 +2315,8 @@ void mFilamentBack() { menu_back(); if (eFilamentAction == FilamentAction::AutoLoad || - eFilamentAction == FilamentAction::Preheat) + eFilamentAction == FilamentAction::Preheat || + eFilamentAction == FilamentAction::Lay1Cal) { eFilamentAction = FilamentAction::None; // i.e. non-autoLoad } @@ -2338,7 +2325,17 @@ void mFilamentBack() void mFilamentMenu() { MENU_BEGIN(); - if (!wizard_active) MENU_ITEM_FUNCTION_P(_T(MSG_MAIN),mFilamentBack); + if (!wizard_active) + { + if (eFilamentAction == FilamentAction::Lay1Cal) + { + MENU_ITEM_FUNCTION_P(_T(MSG_BACK), mFilamentBack); + } + else + { + MENU_ITEM_FUNCTION_P(_T(MSG_MAIN), mFilamentBack); + } + } if (farm_mode) { MENU_ITEM_FUNCTION_P(PSTR("farm - " STRINGIFY(FARM_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(FARM_PREHEAT_HPB_TEMP)), mFilamentItem_farm); @@ -4519,8 +4516,13 @@ void lcd_v2_calibration() const uint8_t filament = choose_menu_P(_i("Select filament:"),_T(MSG_FILAMENT),_i("Cancel")); ////c=20 r=1 ////c=19 r=1 if (filament < 5) { - lcd_commands_step = 20 + filament; - lcd_commands_type = LcdCommands::Layer1Cal; + lay1cal_filament = filament; + } + else + { + menu_back(); + lcd_update_enable(true); + return; } } else @@ -4536,10 +4538,8 @@ void lcd_v2_calibration() } - if (loaded) { - lcd_commands_type = LcdCommands::Layer1Cal; - } - else { + if (!loaded) + { lcd_display_message_fullscreen_P(_i("Please load filament first."));////MSG_PLEASE_LOAD_PLA c=20 r=4 lcd_consume_click(); for (uint_least8_t i = 0; i < 20; i++) { //wait max. 2s @@ -4548,9 +4548,14 @@ void lcd_v2_calibration() break; } } + menu_back(); + lcd_update_enable(true); + return; } } - lcd_return_to_status(); + + eFilamentAction = FilamentAction::Lay1Cal; + menu_goto(mFilamentMenu, 0, true, true); lcd_update_enable(true); } @@ -4811,6 +4816,7 @@ void lcd_wizard(WizState state) lcd_show_fullscreen_message_and_wait_P(_i("Now I will calibrate distance between tip of the nozzle and heatbed surface."));////MSG_WIZARD_V2_CAL c=20 r=8 lcd_show_fullscreen_message_and_wait_P(_i("I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration."));////MSG_WIZARD_V2_CAL_2 c=20 r=12 lcd_commands_type = LcdCommands::Layer1Cal; + lay1cal_filament = 0; lcd_return_to_status(); end = true; break; @@ -5493,7 +5499,10 @@ static void lcd_calibration_menu() if (!isPrintPaused) { MENU_ITEM_FUNCTION_P(_i("Wizard"), lcd_wizard);////MSG_WIZARD c=17 r=1 - MENU_ITEM_SUBMENU_P(_T(MSG_V2_CALIBRATION), lcd_v2_calibration); + if (lcd_commands_type == LcdCommands::Idle) + { + MENU_ITEM_SUBMENU_P(_T(MSG_V2_CALIBRATION), lcd_v2_calibration); + } MENU_ITEM_GCODE_P(_T(MSG_AUTO_HOME), PSTR("G28 W")); MENU_ITEM_FUNCTION_P(_i("Selftest "), lcd_selftest_v);////MSG_SELFTEST #ifdef MK1BP @@ -6427,7 +6436,10 @@ static void lcd_sheet_menu() MENU_ITEM_SUBMENU_P(_i("Select"), change_sheet); //// c=18 } - MENU_ITEM_SUBMENU_P(_T(MSG_V2_CALIBRATION), activate_calibrate_sheet); + if (lcd_commands_type == LcdCommands::Idle) + { + MENU_ITEM_SUBMENU_P(_T(MSG_V2_CALIBRATION), activate_calibrate_sheet); + } MENU_ITEM_SUBMENU_P(_i("Rename"), lcd_rename_sheet_menu); //// c=18 MENU_ITEM_FUNCTION_P(_i("Reset"), lcd_reset_sheet); //// c=18 diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 516a31356..d5c6849fa 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -168,6 +168,7 @@ enum class FilamentAction : uint_least8_t MmuEject, MmuCut, Preheat, + Lay1Cal, }; extern FilamentAction eFilamentAction; From c26d7e50f77618f0af82e7f4834a2a4bda6adb95 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 12 Sep 2019 18:07:46 +0200 Subject: [PATCH 06/29] Remove redundant lcd_update_enable(true) call. --- Firmware/ultralcd.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 7b3f832ef..6c730b4be 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4521,7 +4521,6 @@ void lcd_v2_calibration() else { menu_back(); - lcd_update_enable(true); return; } } From e83b2ebe1f938dad4278ef7f5e403d7398df914b Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 12 Sep 2019 18:15:15 +0200 Subject: [PATCH 07/29] Rename mFilamentMenu to lcd_generic_preheat_menu to match naming convention for global function and be more descriptive. --- Firmware/Marlin_main.cpp | 2 +- Firmware/mmu.cpp | 2 +- Firmware/ultralcd.cpp | 16 ++++++++-------- Firmware/ultralcd.h | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 9413df868..c9eadd4ea 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8526,7 +8526,7 @@ if(0) } else { - menu_submenu(mFilamentMenu); + menu_submenu(lcd_generic_preheat_menu); lcd_timeoutToStatus.start(); } } diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index e7a59e75c..89c76dd26 100755 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1092,7 +1092,7 @@ else { mFilamentItem(target_temperature[0],target_temperature_bed); } // else menu_submenu(mFilamentMenu); - else mFilamentMenu(); + else lcd_generic_preheat_menu(); } } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 6c730b4be..6c80d2136 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1915,7 +1915,7 @@ static void lcd_menu_test_restore() static void lcd_preheat_menu() { eFilamentAction = FilamentAction::Preheat; - mFilamentMenu(); + lcd_generic_preheat_menu(); } static void lcd_support_menu() @@ -2322,7 +2322,7 @@ void mFilamentBack() } } -void mFilamentMenu() +void lcd_generic_preheat_menu() { MENU_BEGIN(); if (!wizard_active) @@ -2377,7 +2377,7 @@ else { bFilamentPreheatState=true; mFilamentItem(target_temperature[0],target_temperature_bed); } - else mFilamentMenu(); + else lcd_generic_preheat_menu(); } } @@ -2615,7 +2615,7 @@ if(0) bFilamentPreheatState=true; mFilamentItem(target_temperature[0],target_temperature_bed); } - else mFilamentMenu(); + else lcd_generic_preheat_menu(); } } @@ -4554,7 +4554,7 @@ void lcd_v2_calibration() } eFilamentAction = FilamentAction::Lay1Cal; - menu_goto(mFilamentMenu, 0, true, true); + menu_goto(lcd_generic_preheat_menu, 0, true, true); lcd_update_enable(true); } @@ -5954,7 +5954,7 @@ static void mmu_load_to_nozzle_menu() bFilamentPreheatState = true; mFilamentItem(target_temperature[0], target_temperature_bed); } - else mFilamentMenu(); + else lcd_generic_preheat_menu(); } } @@ -5986,7 +5986,7 @@ static void mmu_fil_eject_menu() bFilamentPreheatState = true; mFilamentItem(target_temperature[0], target_temperature_bed); } - else mFilamentMenu(); + else lcd_generic_preheat_menu(); } } @@ -6014,7 +6014,7 @@ static void mmu_cut_filament_menu() bFilamentPreheatState=true; mFilamentItem(target_temperature[0],target_temperature_bed); } - else mFilamentMenu(); + else lcd_generic_preheat_menu(); } } #endif //MMU_HAS_CUTTER diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index d5c6849fa..5882bd2a7 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -177,7 +177,7 @@ extern bool bFilamentPreheatState; extern bool bFilamentAction; void mFilamentItem(uint16_t nTemp,uint16_t nTempBed); void mFilamentItemForce(); -void mFilamentMenu(); +void lcd_generic_preheat_menu(); void unload_filament(); void stack_error(); From 0cdfa7a5e8e75d210f8fcfab1bab6de5a5862bb8 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 12 Sep 2019 18:33:02 +0200 Subject: [PATCH 08/29] Remove dead code. --- Firmware/mmu.cpp | 25 ++++++++----------------- Firmware/ultralcd.cpp | 37 ++++++++----------------------------- 2 files changed, 16 insertions(+), 46 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 89c76dd26..e08ddd324 100755 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1077,23 +1077,14 @@ void mmu_filament_ramming() //-// void extr_unload_() { -//if(bFilamentAction) -if(0) - { - bFilamentAction=false; - extr_unload(); - } -else { - eFilamentAction=FilamentAction::MmuUnLoad; - bFilamentFirstRun=false; - if(target_temperature[0]>=EXTRUDE_MINTEMP) - { - bFilamentPreheatState=true; - mFilamentItem(target_temperature[0],target_temperature_bed); - } -// else menu_submenu(mFilamentMenu); - else lcd_generic_preheat_menu(); - } + eFilamentAction = FilamentAction::MmuUnLoad; + bFilamentFirstRun = false; + if (target_temperature[0] >= EXTRUDE_MINTEMP) + { + bFilamentPreheatState = true; + mFilamentItem(target_temperature[0], target_temperature_bed); + } + else lcd_generic_preheat_menu(); } //! @brief show which filament is currently unloaded diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 6c80d2136..c01991cb9 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2363,13 +2363,6 @@ mFilamentItem(target_temperature[0],target_temperature_bed); void lcd_unLoadFilament() { -//./if((degHotend0()>EXTRUDE_MINTEMP)&&bFilamentFirstRun) -if(0) - { - menu_back(); - enquecommand_P(PSTR("M702")); // unload filament - } -else { eFilamentAction=FilamentAction::UnLoad; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) @@ -2378,7 +2371,6 @@ else { mFilamentItem(target_temperature[0],target_temperature_bed); } else lcd_generic_preheat_menu(); - } } @@ -2596,27 +2588,14 @@ static void lcd_menu_AutoLoadFilament() static void lcd_LoadFilament() { -//-// if (degHotend0() > EXTRUDE_MINTEMP) -if(0) - { -// menu_back(); // not necessary (see "lcd_return_to_status()" below) - custom_message_type = CustomMsg::FilamentLoading; - loading_flag = true; - enquecommand_P(PSTR("M701")); //load filament - SERIAL_ECHOLN("Loading filament"); - lcd_return_to_status(); - } - else - { - eFilamentAction=FilamentAction::Load; - bFilamentFirstRun=false; - if(target_temperature[0]>=EXTRUDE_MINTEMP) - { - bFilamentPreheatState=true; - mFilamentItem(target_temperature[0],target_temperature_bed); - } - else lcd_generic_preheat_menu(); - } + eFilamentAction = FilamentAction::Load; + bFilamentFirstRun = false; + if (target_temperature[0] >= EXTRUDE_MINTEMP) + { + bFilamentPreheatState = true; + mFilamentItem(target_temperature[0], target_temperature_bed); + } + else lcd_generic_preheat_menu(); } From 3a541488b2bb179d1eb7286781c83e1695d7254c Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 12 Sep 2019 18:40:02 +0200 Subject: [PATCH 09/29] Rename extr_unload_() to mmu_unload_filament() and move it to ultralcd.cpp as it is menu. --- Firmware/mmu.cpp | 12 ------------ Firmware/mmu.h | 3 +-- Firmware/ultralcd.cpp | 16 +++++++++++++++- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index e08ddd324..d8ae497ba 100755 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -1074,18 +1074,6 @@ void mmu_filament_ramming() } } -//-// -void extr_unload_() -{ - eFilamentAction = FilamentAction::MmuUnLoad; - bFilamentFirstRun = false; - if (target_temperature[0] >= EXTRUDE_MINTEMP) - { - bFilamentPreheatState = true; - mFilamentItem(target_temperature[0], target_temperature_bed); - } - else lcd_generic_preheat_menu(); -} //! @brief show which filament is currently unloaded void extr_unload_view() diff --git a/Firmware/mmu.h b/Firmware/mmu.h index 0f8784ba7..ad508c2ad 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -105,8 +105,7 @@ extern int get_ext_nr(); extern void display_loading(); extern void extr_adj(uint8_t extruder); extern void extr_unload(); -//-// -extern void extr_unload_(); + extern void extr_adj_0(); extern void extr_adj_1(); extern void extr_adj_2(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index c01991cb9..b5769a146 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -131,6 +131,8 @@ static void lcd_menu_fails_stats_mmu_print(); static void lcd_menu_fails_stats_mmu_total(); //static void lcd_menu_show_sensors_state(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") +static void mmu_unload_filament(); + static void mmu_fil_eject_menu(); static void mmu_load_to_nozzle_menu(); #ifdef MMU_HAS_CUTTER @@ -2373,6 +2375,18 @@ void lcd_unLoadFilament() else lcd_generic_preheat_menu(); } +static void mmu_unload_filament() +{ + eFilamentAction = FilamentAction::MmuUnLoad; + bFilamentFirstRun = false; + if (target_temperature[0] >= EXTRUDE_MINTEMP) + { + bFilamentPreheatState = true; + mFilamentItem(target_temperature[0], target_temperature_bed); + } + else lcd_generic_preheat_menu(); +} + void lcd_wait_interact() { @@ -6543,7 +6557,7 @@ static void lcd_main_menu() MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), mmu_load_to_nozzle_menu); //-// MENU_ITEM_FUNCTION_P(_T(MSG_UNLOAD_FILAMENT), extr_unload); //bFilamentFirstRun=true; - MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), extr_unload_); + MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), mmu_unload_filament); MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu); #ifdef MMU_HAS_CUTTER MENU_ITEM_SUBMENU_P(_i("Cut filament"), mmu_cut_filament_menu); From d80b8280a06b079a3bbc57ed214b524d94fed2a7 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 12 Sep 2019 18:41:17 +0200 Subject: [PATCH 10/29] Remove commented out and unused functions prototypes. --- Firmware/ultralcd.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index b5769a146..c53f3d17b 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -122,17 +122,13 @@ static void prusa_stat_diameter(); static void prusa_stat_temperatures(); static void prusa_stat_printinfo(); static void lcd_farm_no(); -//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(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") - static void mmu_unload_filament(); - static void mmu_fil_eject_menu(); static void mmu_load_to_nozzle_menu(); #ifdef MMU_HAS_CUTTER From 770e470fd5e04026a50f8adef4139a6c7f32289c Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 12 Sep 2019 18:53:24 +0200 Subject: [PATCH 11/29] Extract common code to function preheat_or_continue(). Saves 138B of FLASH memory. --- Firmware/ultralcd.cpp | 43 +++++++++++++------------------------------ 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index c53f3d17b..e7e821207 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -131,6 +131,8 @@ static void lcd_menu_fails_stats_mmu_total(); static void mmu_unload_filament(); static void mmu_fil_eject_menu(); static void mmu_load_to_nozzle_menu(); +static void preheat_or_continue(); + #ifdef MMU_HAS_CUTTER static void mmu_cut_filament_menu(); #endif //MMU_HAS_CUTTER @@ -2362,25 +2364,13 @@ mFilamentItem(target_temperature[0],target_temperature_bed); void lcd_unLoadFilament() { eFilamentAction=FilamentAction::UnLoad; - bFilamentFirstRun=false; - if(target_temperature[0]>=EXTRUDE_MINTEMP) - { - bFilamentPreheatState=true; - mFilamentItem(target_temperature[0],target_temperature_bed); - } - else lcd_generic_preheat_menu(); + preheat_or_continue(); } static void mmu_unload_filament() { eFilamentAction = FilamentAction::MmuUnLoad; - bFilamentFirstRun = false; - if (target_temperature[0] >= EXTRUDE_MINTEMP) - { - bFilamentPreheatState = true; - mFilamentItem(target_temperature[0], target_temperature_bed); - } - else lcd_generic_preheat_menu(); + preheat_or_continue(); } @@ -2596,9 +2586,8 @@ static void lcd_menu_AutoLoadFilament() } #endif //FILAMENT_SENSOR -static void lcd_LoadFilament() +static void preheat_or_continue() { - eFilamentAction = FilamentAction::Load; bFilamentFirstRun = false; if (target_temperature[0] >= EXTRUDE_MINTEMP) { @@ -2608,6 +2597,12 @@ static void lcd_LoadFilament() else lcd_generic_preheat_menu(); } +static void lcd_LoadFilament() +{ + eFilamentAction = FilamentAction::Load; + preheat_or_continue(); +} + //! @brief Show filament used a print time //! @@ -5937,13 +5932,7 @@ static void mmu_load_to_nozzle_menu() else { eFilamentAction = FilamentAction::MmuLoad; - bFilamentFirstRun = false; - if (target_temperature[0] >= EXTRUDE_MINTEMP) - { - bFilamentPreheatState = true; - mFilamentItem(target_temperature[0], target_temperature_bed); - } - else lcd_generic_preheat_menu(); + preheat_or_continue(); } } @@ -5969,13 +5958,7 @@ static void mmu_fil_eject_menu() else { eFilamentAction = FilamentAction::MmuEject; - bFilamentFirstRun = false; - if (target_temperature[0] >= EXTRUDE_MINTEMP) - { - bFilamentPreheatState = true; - mFilamentItem(target_temperature[0], target_temperature_bed); - } - else lcd_generic_preheat_menu(); + preheat_or_continue(); } } From d48197656cd83c9def94e5c8e9cde5f5f46b43b0 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 12 Sep 2019 20:05:16 +0200 Subject: [PATCH 12/29] Fix lcd_v2_calibration menu not redrawn after full screen message or question. --- Firmware/ultralcd.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e7e821207..b8af0360a 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4518,6 +4518,8 @@ void lcd_v2_calibration() else { loaded = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is filament loaded?"), false, true);////MSG_PLA_FILAMENT_LOADED c=20 r=2 + lcd_update_enabled = true; + } @@ -4531,15 +4533,14 @@ void lcd_v2_calibration() break; } } + lcd_update_enabled = true; menu_back(); - lcd_update_enable(true); return; } } eFilamentAction = FilamentAction::Lay1Cal; menu_goto(lcd_generic_preheat_menu, 0, true, true); - lcd_update_enable(true); } void lcd_wizard() { From 6630591f9e61bb47fc374756c6ade41cba8976dc Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 12 Sep 2019 20:20:33 +0200 Subject: [PATCH 13/29] Consume lcd_encoder_diff in lcd_show_fullscreen_message_yes_no_and_wait_P(). This fixes problem encountered in lcd_v2_calibration(). Selected menu item skips to another if returning to menu after this message is used. --- Firmware/ultralcd.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index b8af0360a..8cd7eb0e0 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3591,6 +3591,7 @@ int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow if (lcd_clicked()) { Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); KEEPALIVE_STATE(IN_HANDLER); + lcd_encoder_diff = 0; return yes; } } From 07a0f527d82fb85b7799fe85a28a0fcb8ea66f4e Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 12 Sep 2019 20:30:27 +0200 Subject: [PATCH 14/29] Reset lcd_encoder_diff in lcd_show_fullscreen_message_yes_no_and_wait_P() also when it times out. --- Firmware/ultralcd.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 8cd7eb0e0..1918df276 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3557,7 +3557,7 @@ int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow lcd_puts_P(PSTR(">")); lcd_puts_P(_T(MSG_NO)); } - bool yes = default_yes ? true : false; + int8_t retval = default_yes ? true : false; // Wait for user confirmation or a timeout. unsigned long previous_millis_cmd = _millis(); @@ -3566,24 +3566,27 @@ int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow KEEPALIVE_STATE(PAUSED_FOR_USER); for (;;) { if (allow_timeouting && _millis() - previous_millis_cmd > LCD_TIMEOUT_TO_STATUS) - return -1; + { + retval = -1; + break; + } manage_heater(); manage_inactivity(true); if (abs(enc_dif - lcd_encoder_diff) > 4) { lcd_set_cursor(0, 2); - if (enc_dif < lcd_encoder_diff && yes) { + if (enc_dif < lcd_encoder_diff && retval) { lcd_puts_P((PSTR(" "))); lcd_set_cursor(0, 3); lcd_puts_P((PSTR(">"))); - yes = false; + retval = 0; Sound_MakeSound(e_SOUND_TYPE_EncoderMove); } - else if (enc_dif > lcd_encoder_diff && !yes) { + else if (enc_dif > lcd_encoder_diff && !retval) { lcd_puts_P((PSTR(">"))); lcd_set_cursor(0, 3); lcd_puts_P((PSTR(" "))); - yes = true; + retval = 1; Sound_MakeSound(e_SOUND_TYPE_EncoderMove); } enc_dif = lcd_encoder_diff; @@ -3591,10 +3594,11 @@ int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow if (lcd_clicked()) { Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); KEEPALIVE_STATE(IN_HANDLER); - lcd_encoder_diff = 0; - return yes; + break; } } + lcd_encoder_diff = 0; + return retval; } void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, uint8_t point_too_far_mask) From 73642632f54444490e2a3cd52520f3b4c18c6a97 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 12 Sep 2019 22:37:28 +0200 Subject: [PATCH 15/29] Do not force PLA filament in first layer calibration from wizard. Remove duplicate variable wizard_active. Saves 410 B of FLASH and 1 B of RAM. --- Firmware/Marlin.h | 2 - Firmware/Marlin_main.cpp | 4 +- Firmware/ultralcd.cpp | 86 ++++++++++------------------------------ Firmware/ultralcd.h | 1 - lang/lang_en.txt | 24 ----------- lang/lang_en_cz.txt | 32 --------------- lang/lang_en_de.txt | 32 --------------- lang/lang_en_es.txt | 32 --------------- lang/lang_en_fr.txt | 32 --------------- lang/lang_en_it.txt | 32 --------------- lang/lang_en_pl.txt | 32 --------------- 11 files changed, 22 insertions(+), 287 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 625e079ea..6098731fa 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -391,8 +391,6 @@ extern uint16_t print_time_remaining_silent; extern uint16_t mcode_in_progress; extern uint16_t gcode_in_progress; -extern bool wizard_active; //autoload temporarily disabled during wizard - extern LongTimer safetyTimer; #define PRINT_PERCENT_DONE_INIT 0xff diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c9eadd4ea..ad81a061e 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -323,8 +323,6 @@ uint16_t print_time_remaining_normal = PRINT_TIME_REMAINING_INIT; //estimated re uint8_t print_percent_done_silent = PRINT_PERCENT_DONE_INIT; uint16_t print_time_remaining_silent = PRINT_TIME_REMAINING_INIT; //estimated remaining print time in minutes -bool wizard_active = false; //autoload temporarily disabled during wizard - //=========================================================================== //=============================Private Variables============================= //=========================================================================== @@ -8495,7 +8493,7 @@ bool bInhibitFlag; #endif // IR_SENSOR if ((mcode_in_progress != 600) && (eFilamentAction != FilamentAction::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 != LcdCommands::Layer1Cal) && !wizard_active) + if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal) && ! eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) { if (fsensor_check_autoload()) { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 1918df276..d944ae1fe 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2139,13 +2139,13 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed) nTargetOld = target_temperature[0]; nTargetBedOld = target_temperature_bed; setTargetHotend0((float )nTemp); - if (!wizard_active) setTargetBed((float) nTempBed); + if (!eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) setTargetBed((float) nTempBed); if (eFilamentAction == FilamentAction::Preheat || eFilamentAction == FilamentAction::Lay1Cal) { if (eFilamentAction == FilamentAction::Lay1Cal) lcd_commands_type = LcdCommands::Layer1Cal; lcd_return_to_status(); - if (wizard_active) lcd_wizard(WizState::Unload); + if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) lcd_wizard(WizState::LoadFil); return; } @@ -2325,7 +2325,7 @@ void mFilamentBack() void lcd_generic_preheat_menu() { MENU_BEGIN(); - if (!wizard_active) + if (!eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) { if (eFilamentAction == FilamentAction::Lay1Cal) { @@ -2351,7 +2351,7 @@ void lcd_generic_preheat_menu() MENU_ITEM_SUBMENU_P(PSTR("PP - " STRINGIFY(PP_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PP_PREHEAT_HPB_TEMP)),mFilamentItem_PP); MENU_ITEM_SUBMENU_P(PSTR("FLEX - " STRINGIFY(FLEX_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(FLEX_PREHEAT_HPB_TEMP)),mFilamentItem_FLEX); } - if (!wizard_active && eFilamentAction == FilamentAction::Preheat) MENU_ITEM_FUNCTION_P(_T(MSG_COOLDOWN), lcd_cooldown); + if (!eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) && eFilamentAction == FilamentAction::Preheat) MENU_ITEM_FUNCTION_P(_T(MSG_COOLDOWN), lcd_cooldown); MENU_END(); } @@ -4602,38 +4602,16 @@ static void wait_preheat() } -static void lcd_wizard_unload() -{ - if(mmu_enabled) - { - int8_t unload = lcd_show_multiscreen_message_two_choices_and_wait_P( - _i("Use unload to remove filament 1 if it protrudes outside of the rear MMU tube. Use eject if it is hidden in tube.") - ,false, true, _i("Unload"), _i("Eject")); - if (unload) - { - extr_unload_0(); - } - else - { - mmu_eject_filament(0, true); - } - } - else - { - unload_filament(); - } -} - static void lcd_wizard_load() { 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 + lcd_show_fullscreen_message_and_wait_P(_i("Please insert filament to the first tube of MMU, then press the knob to load it."));////c=20 r=8 tmp_extruder = 0; } 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_show_fullscreen_message_and_wait_P(_i("Please insert filament to the extruder, then press knob to load it."));////MSG_WIZARD_LOAD_FILAMENT c=20 r=8 } lcd_update_enable(false); lcd_clear(); @@ -4657,18 +4635,12 @@ bool lcd_autoDepleteEnabled() //! //! @startuml //! [*] --> IsFil -//! IsFil : Is filament 1 loaded? -//! isPLA : Is filament 1 PLA? -//! unload : Eject or Unload? -//! load : Push the button to start loading PLA Filament 1 +//! IsFil : Is any filament loaded? +//! load : Push the button to start loading Filament 1 //! -//! IsFil --> isPLA : yes +//! IsFil --> calibration : yes //! IsFil --> load : no -//! isPLA --> unload : no -//! unload --> load : eject -//! unload --> load : unload //! load --> calibration : click -//! isPLA --> calibration : yes //! @enduml //! //! @param state Entry point of the wizard @@ -4699,7 +4671,6 @@ void lcd_wizard(WizState state) // Btw. the flag may even trigger the viper situation on normal start this way and the user won't be able to find out why. saved_printing = false; - wizard_active = true; wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(_i("Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?"), false, true);////MSG_WIZARD_WELCOME c=20 r=7 if (wizard_event) { state = S::Restore; @@ -4749,7 +4720,7 @@ void lcd_wizard(WizState state) lcd_display_message_fullscreen_P(_i("Now I will preheat nozzle for PLA.")); wait_preheat(); //unload current filament - lcd_wizard_unload(); + unload_filament(); //load filament lcd_wizard_load(); setTargetHotend(0, 0); //we are finished, cooldown nozzle @@ -4763,51 +4734,37 @@ void lcd_wizard(WizState state) setTargetBed(PLA_PREHEAT_HPB_TEMP); if (mmu_enabled) { - wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is filament 1 loaded?"), false);////c=20 r=2 + wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is any filament 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 = S::IsPla; + if (wizard_event) state = S::Lay1Cal; else { if(mmu_enabled) state = S::LoadFil; - else state = S::PreheatPla; + else state = S::Preheat; } break; - case S::PreheatPla: -#ifndef SNMM - lcd_display_message_fullscreen_P(_i("Now I will preheat nozzle for PLA."));////MSG_WIZARD_WILL_PREHEAT c=20 r=4 - wait_preheat(); -#endif //not SNMM - state = S::LoadFil; - break; case S::Preheat: menu_goto(lcd_preheat_menu,0,false,true); lcd_show_fullscreen_message_and_wait_P(_i("Select nozzle preheat temperature which matches your material.")); end = true; // Leave wizard temporarily for lcd_preheat_menu break; - case S::Unload: - wait_preheat(); - lcd_wizard_unload(); - state = S::LoadFil; - break; case S::LoadFil: //load filament + wait_preheat(); lcd_wizard_load(); state = S::Lay1Cal; break; - case S::IsPla: - wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is it PLA filament?"), false, true);////MSG_WIZARD_PLA_FILAMENT c=20 r=2 - if (wizard_event) state = S::Lay1Cal; - else state = S::Preheat; - break; case S::Lay1Cal: lcd_show_fullscreen_message_and_wait_P(_i("Now I will calibrate distance between tip of the nozzle and heatbed surface."));////MSG_WIZARD_V2_CAL c=20 r=8 - lcd_show_fullscreen_message_and_wait_P(_i("I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration."));////MSG_WIZARD_V2_CAL_2 c=20 r=12 - lcd_commands_type = LcdCommands::Layer1Cal; - lay1cal_filament = 0; - lcd_return_to_status(); - end = true; + if(mmu_enabled) + { + lcd_show_fullscreen_message_and_wait_P(_i("First you will select filament you wish to use for calibration.")); + } + lcd_show_fullscreen_message_and_wait_P(_i("Select temperature which matches your material. Then I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration."));////MSG_WIZARD_V2_CAL_2 c=20 r=12 + menu_goto(lcd_v2_calibration,0,false,true); + end = true; // Leave wizard temporarily for lcd_v2_calibration break; case S::RepeatLay1Cal: //repeat first layer cal.? wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(_i("Do you want to repeat last step to readjust distance between nozzle and heatbed?"), false);////MSG_WIZARD_REPEAT_V2_CAL c=20 r=7 @@ -4853,7 +4810,6 @@ void lcd_wizard(WizState state) } if (!((S::Lay1Cal == state) || (S::Preheat == state))) { lcd_show_fullscreen_message_and_wait_P(msg); - wizard_active = false; } lcd_update_enable(true); lcd_update(2); diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 5882bd2a7..15e0d3da4 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -231,7 +231,6 @@ enum class WizState : uint8_t IsFil, //!< Is filament loaded? Entry point for 1st layer calibration PreheatPla, //!< waiting for preheat nozzle for PLA Preheat, //!< Preheat for any material - Unload, //!< Unload filament LoadFil, //!< Load filament IsPla, //!< Is PLA filament? Lay1Cal, //!< First layer calibration diff --git a/lang/lang_en.txt b/lang/lang_en.txt index 272c800c8..286b82e82 100755 --- a/lang/lang_en.txt +++ b/lang/lang_en.txt @@ -166,9 +166,6 @@ #MSG_EJECT_FILAMENT c=17 r=1 "Eject filament" -# -"Eject" - #MSG_EJECTING_FILAMENT c=20 r=1 "Ejecting filament" @@ -346,27 +343,15 @@ #MSG_WIZARD_Z_CAL c=20 r=8 "I will run z calibration now." -#MSG_WIZARD_V2_CAL_2 c=20 r=12 -"I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." - #MSG_WATCH "Info screen" -# -"Is filament 1 loaded?" - #MSG_INSERT_FILAMENT c=20 "Insert filament" #MSG_WIZARD_FILAMENT_LOADED c=20 r=2 "Is filament loaded?" -#MSG_WIZARD_PLA_FILAMENT c=20 r=2 -"Is it PLA filament?" - -#MSG_PLA_FILAMENT_LOADED c=20 r=2 -"Is PLA filament loaded?" - #MSG_STEEL_SHEET_CHECK c=20 r=2 "Is steel sheet on heatbed?" @@ -547,12 +532,6 @@ #MSG_WIZARD_CALIBRATION_FAILED c=20 r=8 "Please check our handbook and fix the problem. Then resume the Wizard by rebooting the printer." -#MSG_WIZARD_LOAD_FILAMENT c=20 r=8 -"Please insert PLA filament to the extruder, then press knob to load it." - -#MSG_PLEASE_LOAD_PLA c=20 r=4 -"Please load PLA filament first." - #MSG_CHECK_IDLER c=20 r=4 "Please open idler and remove filament manually." @@ -562,9 +541,6 @@ #MSG_PRESS_TO_UNLOAD c=20 r=4 "Please press the knob to unload filament" -# -"Please insert PLA filament to the first tube of MMU, then press the knob to load it." - #MSG_PULL_OUT_FILAMENT c=20 r=4 "Please pull out filament immediately" diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index 659a93723..2edd1172d 100755 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -222,10 +222,6 @@ "Eject filament" "Vysunout filament" -# -"Eject" -"Vysunout" - #MSG_EJECTING_FILAMENT c=20 r=1 "Ejecting filament" "Vysouvam filament" @@ -462,18 +458,10 @@ "I will run z calibration now." "Nyni provedu z kalibraci." -#MSG_WIZARD_V2_CAL_2 c=20 r=12 -"I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." -"Zacnu tisknout linku a Vy budete postupne snizovat trysku otacenim tlacitka dokud nedosahnete optimalni vysky. Prohlednete si obrazky v nasi prirucce v kapitole Kalibrace." - #MSG_WATCH "Info screen" "Informace" -# -"Is filament 1 loaded?" -"Je filament 1 zaveden?" - #MSG_INSERT_FILAMENT c=20 "Insert filament" "Vlozte filament" @@ -482,14 +470,6 @@ "Is filament loaded?" "Je filament zaveden?" -#MSG_WIZARD_PLA_FILAMENT c=20 r=2 -"Is it PLA filament?" -"Je to PLA filament?" - -#MSG_PLA_FILAMENT_LOADED c=20 r=2 -"Is PLA filament loaded?" -"Je PLA filament zaveden?" - #MSG_STEEL_SHEET_CHECK c=20 r=2 "Is steel sheet on heatbed?" "Je tiskovy plat na podlozce?" @@ -730,14 +710,6 @@ "Please check our handbook and fix the problem. Then resume the Wizard by rebooting the printer." "Prosim nahlednete do prirucky 3D tiskare a opravte problem. Pote obnovte Pruvodce restartovanim tiskarny." -#MSG_WIZARD_LOAD_FILAMENT c=20 r=8 -"Please insert PLA filament to the extruder, then press knob to load it." -"Prosim vlozte PLA filament do extruderu, pote stisknete tlacitko pro zavedeni filamentu." - -#MSG_PLEASE_LOAD_PLA c=20 r=4 -"Please load PLA filament first." -"Nejdrive prosim zavedte PLA filament." - #MSG_CHECK_IDLER c=20 r=4 "Please open idler and remove filament manually." "Prosim otevrete idler a manualne odstrante filament." @@ -750,10 +722,6 @@ "Please press the knob to unload filament" "Pro vysunuti filamentu stisknete prosim tlacitko" -# -"Please insert PLA filament to the first tube of MMU, then press the knob to load it." -"Prosim vlozte PLA filament do trubicky MMU, pote stisknete tlacitko pro zavedeni filamentu." - #MSG_PULL_OUT_FILAMENT c=20 r=4 "Please pull out filament immediately" "Prosim vyjmete urychlene filament" diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt index a426c13a9..6ead0ffff 100755 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -222,10 +222,6 @@ "Eject filament" "Filamentauswurf" -# -"Eject" -"Auswurf" - #MSG_EJECTING_FILAMENT c=20 r=1 "Ejecting filament" "werfe Filament aus" @@ -462,18 +458,10 @@ "I will run z calibration now." "Ich werde jetzt die Z Kalibrierung durchfuehren." -#MSG_WIZARD_V2_CAL_2 c=20 r=12 -"I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." -"Ich werde jetzt eine Linie drucken. Waehrend des Druckes koennen Sie die Duese allmaehlich senken, indem Sie den Knopf drehen, bis Sie die optimale Hoehe erreichen. Sehen Sie sich die Bilder in unserem Handbuch im Kapitel Kalibrierung an." - #MSG_WATCH "Info screen" "Infoanzeige" -# -"Is filament 1 loaded?" -"Wurde Filament 1 geladen?" - #MSG_INSERT_FILAMENT c=20 "Insert filament" "Filament einlegen" @@ -482,14 +470,6 @@ "Is filament loaded?" "Ist das Filament geladen?" -#MSG_WIZARD_PLA_FILAMENT c=20 r=2 -"Is it PLA filament?" -"Ist es wirklich PLA Filament?" - -#MSG_PLA_FILAMENT_LOADED c=20 r=2 -"Is PLA filament loaded?" -"Ist PLA Filament geladen?" - #MSG_STEEL_SHEET_CHECK c=20 r=2 "Is steel sheet on heatbed?" "Liegt das Stahlblech auf dem Heizbett?" @@ -730,14 +710,6 @@ "Please check our handbook and fix the problem. Then resume the Wizard by rebooting the printer." "Bitte lesen Sie unser Handbuch und beheben Sie das Problem. Fahren Sie dann mit dem Assistenten fort, indem Sie den Drucker neu starten." -#MSG_WIZARD_LOAD_FILAMENT c=20 r=8 -"Please insert PLA filament to the extruder, then press knob to load it." -"Legen Sie bitte PLA Filament in den Extruder und druecken Sie den Knopf, um es zu laden." - -#MSG_PLEASE_LOAD_PLA c=20 r=4 -"Please load PLA filament first." -"Bitte laden Sie zuerst PLA Filament." - #MSG_CHECK_IDLER c=20 r=4 "Please open idler and remove filament manually." "Bitte Spannrolle oeffnen und Fila- ment von Hand entfernen" @@ -750,10 +722,6 @@ "Please press the knob to unload filament" "Bitte druecken Sie den Knopf um das Filament zu entladen." -# -"Please insert PLA filament to the first tube of MMU, then press the knob to load it." -"Legen Sie bitte PLA Filament in den ersten Schlauch der MMU und druecken Sie den Knopf, um es zu laden." - #MSG_PULL_OUT_FILAMENT c=20 r=4 "Please pull out filament immediately" "Bitte ziehen Sie das Filament sofort heraus" diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt index dd4db925f..178716fae 100755 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -222,10 +222,6 @@ "Eject filament" "Expulsar filamento" -# -"Eject" -"Expulsar" - #MSG_EJECTING_FILAMENT c=20 r=1 "Ejecting filament" "Expulsando filamento" @@ -462,18 +458,10 @@ "I will run z calibration now." "Voy a hacer Calibracion Z ahora." -#MSG_WIZARD_V2_CAL_2 c=20 r=12 -"I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." -"Voy a comenzar a imprimir la linea y tu bajaras el nozzle gradualmente al rotar el dial, hasta que llegues a la altura optima. Mira las imagenes del capitulo Calibracion en el manual." - #MSG_WATCH "Info screen" "Monitorizar" -# -"Is filament 1 loaded?" -"?Esta cargado el filamento 1?" - #MSG_INSERT_FILAMENT c=20 "Insert filament" "Introducir filamento" @@ -482,14 +470,6 @@ "Is filament loaded?" "Esta el filamento cargado?" -#MSG_WIZARD_PLA_FILAMENT c=20 r=2 -"Is it PLA filament?" -"Es el filamento PLA?" - -#MSG_PLA_FILAMENT_LOADED c=20 r=2 -"Is PLA filament loaded?" -"Esta el filamento PLA cargado?" - #MSG_STEEL_SHEET_CHECK c=20 r=2 "Is steel sheet on heatbed?" "?Esta colocada la lamina de acero sobre la base?" @@ -730,14 +710,6 @@ "Please check our handbook and fix the problem. Then resume the Wizard by rebooting the printer." "Lee el manual y resuelve el problema. Despues, reinicia la impresora y continua con el Wizard" -#MSG_WIZARD_LOAD_FILAMENT c=20 r=8 -"Please insert PLA filament to the extruder, then press knob to load it." -"Inserta, por favor, filamento PLA en el extrusor. Despues haz clic para cargarlo." - -#MSG_PLEASE_LOAD_PLA c=20 r=4 -"Please load PLA filament first." -"Carga el filamento PLA primero por favor." - #MSG_CHECK_IDLER c=20 r=4 "Please open idler and remove filament manually." "Por favor abate el rodillo de empuje (idler) y retira el filamento manualmente." @@ -750,10 +722,6 @@ "Please press the knob to unload filament" "Por favor, pulsa el dial para descargar el filamento" -# -"Please insert PLA filament to the first tube of MMU, then press the knob to load it." -"Por favor introduce el filamento al primer tubo MMU, despues presiona el dial para imprimirlo." - #MSG_PULL_OUT_FILAMENT c=20 r=4 "Please pull out filament immediately" "Por favor retire el filamento de inmediato" diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt index 5c4f7e9d8..9064b09b2 100755 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -222,10 +222,6 @@ "Eject filament" "Ejecter le fil." -# -"Eject" -"Ejecter" - #MSG_EJECTING_FILAMENT c=20 r=1 "Ejecting filament" "Ejection filament" @@ -462,18 +458,10 @@ "I will run z calibration now." "Je vais maintenant lancer la calibration z." -#MSG_WIZARD_V2_CAL_2 c=20 r=12 -"I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." -"Je vais commencer a imprimer une ligne et vous baisserez au fur et a mesure la buse en tournant le bouton jusqu'a atteindre la hauteur optimale. Regardez les photos dans notre manuel au chapitre Calibration" - #MSG_WATCH "Info screen" "Ecran d'info" -# -"Is filament 1 loaded?" -"Le filament 1 est-il charge ?" - #MSG_INSERT_FILAMENT c=20 "Insert filament" "Inserez le filament" @@ -482,14 +470,6 @@ "Is filament loaded?" "Le filament est-il charge ?" -#MSG_WIZARD_PLA_FILAMENT c=20 r=2 -"Is it PLA filament?" -"Est-ce du filament PLA ?" - -#MSG_PLA_FILAMENT_LOADED c=20 r=2 -"Is PLA filament loaded?" -"Le filament PLA est-il charge ?" - #MSG_STEEL_SHEET_CHECK c=20 r=2 "Is steel sheet on heatbed?" "Feuille d'acier sur plateau chauffant ?" @@ -730,14 +710,6 @@ "Please check our handbook and fix the problem. Then resume the Wizard by rebooting the printer." "Merci de verifier notre manuel et de corriger le probleme. Poursuivez alors l'assistant en redemarrant l'imprimante." -#MSG_WIZARD_LOAD_FILAMENT c=20 r=8 -"Please insert PLA filament to the extruder, then press knob to load it." -"Inserez du filament PLA dans l'extrudeur puis appuyez sur le bouton pour le charger." - -#MSG_PLEASE_LOAD_PLA c=20 r=4 -"Please load PLA filament first." -"Chargez d'abord le filament PLA." - #MSG_CHECK_IDLER c=20 r=4 "Please open idler and remove filament manually." "Ouvrez l'idler et retirez le filament manuellement." @@ -750,10 +722,6 @@ "Please press the knob to unload filament" "Appuyez sur le bouton pour decharger le filament" -# -"Please insert PLA filament to the first tube of MMU, then press the knob to load it." -"Veuillez inserer du filament PLA dans le premier tube du MMU, et pressez sur le bouton pour le charger." - #MSG_PULL_OUT_FILAMENT c=20 r=4 "Please pull out filament immediately" "Retirez immediatement le filament" diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt index 0ee9dbec9..9733183ff 100755 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -222,10 +222,6 @@ "Eject filament" "Espelli filamento " -# -"Eject" -"Espellere" - #MSG_EJECTING_FILAMENT c=20 r=1 "Ejecting filament" "Espellendo filamento " @@ -462,18 +458,10 @@ "I will run z calibration now." "Adesso avviero la Calibrazione Z." -#MSG_WIZARD_V2_CAL_2 c=20 r=12 -"I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." -"Adesso iniziero a stampare una linea e tu dovrai abbassare l'ugello poco per volta ruotando la manopola sino a raggiungere una altezza ottimale. Per favore dai uno sguardo all'immagine del nostro manuale, cap.Calibrazione." - #MSG_WATCH "Info screen" "Schermata info" -# -"Is filament 1 loaded?" -"Il filamento 1 e caricato?" - #MSG_INSERT_FILAMENT c=20 "Insert filament" "Inserire filamento" @@ -482,14 +470,6 @@ "Is filament loaded?" "Il filamento e stato caricato?" -#MSG_WIZARD_PLA_FILAMENT c=20 r=2 -"Is it PLA filament?" -"E' un filamento di PLA?" - -#MSG_PLA_FILAMENT_LOADED c=20 r=2 -"Is PLA filament loaded?" -"E' stato caricato il filamento di PLA?" - #MSG_STEEL_SHEET_CHECK c=20 r=2 "Is steel sheet on heatbed?" "La piastra d'acciaio e sul piano riscaldato?" @@ -730,14 +710,6 @@ "Please check our handbook and fix the problem. Then resume the Wizard by rebooting the printer." "Per favore consulta il nostro manuale per risolvere il problema. Poi riprendi il Wizard dopo aver riavviato la stampante." -#MSG_WIZARD_LOAD_FILAMENT c=20 r=8 -"Please insert PLA filament to the extruder, then press knob to load it." -"Per favore inserisci il filamento di PLA nell'estrusore, poi premi la manopola per caricare." - -#MSG_PLEASE_LOAD_PLA c=20 r=4 -"Please load PLA filament first." -"Per favore prima carica il filamento di PLA." - #MSG_CHECK_IDLER c=20 r=4 "Please open idler and remove filament manually." "Aprire la guida filam. e rimuovere il filam. a mano" @@ -750,10 +722,6 @@ "Please press the knob to unload filament" "Premete la manopola per scaricare il filamento " -# -"Please insert PLA filament to the first tube of MMU, then press the knob to load it." -"Per favore inserite del filamento PLA nel primo tubo del MMU, poi premete la manopola per caricarlo." - #MSG_PULL_OUT_FILAMENT c=20 r=4 "Please pull out filament immediately" "Estrarre il filamento immediatamente" diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt index 602775ff9..93a91e8b3 100755 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -222,10 +222,6 @@ "Eject filament" "Wysun filament" -# -"Eject" -"Wysun" - #MSG_EJECTING_FILAMENT c=20 r=1 "Ejecting filament" "Wysuwanie filamentu" @@ -462,18 +458,10 @@ "I will run z calibration now." "Przeprowadze kalibracje Z." -#MSG_WIZARD_V2_CAL_2 c=20 r=12 -"I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration." -"Zaczne drukowac linie. Stopniowo opuszczaj dysze przekrecajac pokretlo, poki nie uzyskasz optymalnej wysokosci. Sprawdz obrazki w naszym Podreczniku w rozdz. Kalibracja" - #MSG_WATCH "Info screen" "Ekran informacyjny" -# -"Is filament 1 loaded?" -"Filament 1 zaladowany?" - #MSG_INSERT_FILAMENT c=20 "Insert filament" "Wprowadz filament" @@ -482,14 +470,6 @@ "Is filament loaded?" "Filament jest zaladowany?" -#MSG_WIZARD_PLA_FILAMENT c=20 r=2 -"Is it PLA filament?" -"Czy to filament PLA?" - -#MSG_PLA_FILAMENT_LOADED c=20 r=2 -"Is PLA filament loaded?" -"Fialment PLA jest zaladowany?" - #MSG_STEEL_SHEET_CHECK c=20 r=2 "Is steel sheet on heatbed?" "Czy plyta stal. jest na podgrzew. stole?" @@ -730,14 +710,6 @@ "Please check our handbook and fix the problem. Then resume the Wizard by rebooting the printer." "Przeczytaj nasz Podrecznik druku 3D aby naprawic problem. Potem wznow Asystenta przez restart drukarki." -#MSG_WIZARD_LOAD_FILAMENT c=20 r=8 -"Please insert PLA filament to the extruder, then press knob to load it." -"Umiesc filament PLA w ekstruderze i nacisnij pokretlo, aby zaladowac." - -#MSG_PLEASE_LOAD_PLA c=20 r=4 -"Please load PLA filament first." -"Najpierw zaladuj filament PLA." - #MSG_CHECK_IDLER c=20 r=4 "Please open idler and remove filament manually." "Prosze odciagnac dzwignie dociskowa ekstrudera i recznie usunac filament." @@ -750,10 +722,6 @@ "Please press the knob to unload filament" "Nacisnij pokretlo aby rozladowac filament" -# -"Please insert PLA filament to the first tube of MMU, then press the knob to load it." -"Wsun filament PLA do pierwszej rurki MMU i nacisnij pokretlo aby go zaladowac." - #MSG_PULL_OUT_FILAMENT c=20 r=4 "Please pull out filament immediately" "Wyciagnij filament teraz" From d256c186355cbe4ed3faf4694f31357e849c98fb Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 12 Sep 2019 23:17:19 +0200 Subject: [PATCH 16/29] Fix first layer calibration wizard. Do not jump to WizState::LoadFil if calibration is supposed to be performed. --- Firmware/ultralcd.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d944ae1fe..0e0822290 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2139,13 +2139,19 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed) nTargetOld = target_temperature[0]; nTargetBedOld = target_temperature_bed; setTargetHotend0((float )nTemp); - if (!eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) setTargetBed((float) nTempBed); + + if (!eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) || + eFilamentAction == FilamentAction::Lay1Cal) + { + setTargetBed((float) nTempBed); + } if (eFilamentAction == FilamentAction::Preheat || eFilamentAction == FilamentAction::Lay1Cal) { if (eFilamentAction == FilamentAction::Lay1Cal) lcd_commands_type = LcdCommands::Layer1Cal; lcd_return_to_status(); - if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) lcd_wizard(WizState::LoadFil); + if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) && + eFilamentAction == FilamentAction::Preheat) lcd_wizard(WizState::LoadFil); return; } From ebf405d58979d1e69451c295afdb8982595a2be9 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 12 Sep 2019 23:20:03 +0200 Subject: [PATCH 17/29] Preselect "yes" for filament question in first layer calibration wizard. --- Firmware/ultralcd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 0e0822290..562b61f86 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4740,10 +4740,10 @@ void lcd_wizard(WizState state) setTargetBed(PLA_PREHEAT_HPB_TEMP); if (mmu_enabled) { - wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is any filament loaded?"), false);////c=20 r=2 + wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is any filament loaded?"), true);////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 + wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is filament loaded?"), true);////MSG_WIZARD_FILAMENT_LOADED c=20 r=2 } if (wizard_event) state = S::Lay1Cal; else From f1d190d2d5fa20871d13afb6004b31f016182e56 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 12 Sep 2019 23:41:42 +0200 Subject: [PATCH 18/29] Do not ask same filament related question twice if starting first layer calibration from wizard. --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 562b61f86..da22eca22 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4519,7 +4519,7 @@ void lcd_v2_calibration() return; } } - else + else if (!eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) { bool loaded = false; if (fsensor_enabled && ir_sensor_detected) From e754780717a7ab2d3b6b5653ee7d1943e520b247 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 13 Sep 2019 00:19:37 +0200 Subject: [PATCH 19/29] Fix condition for returning to wizard. eFilamentAction == FilamentAction::Preheat was never true as eFilamentAction is set to eFilamentAction::None in lcd_return_to_status(). --- Firmware/ultralcd.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index da22eca22..4d9d4c41b 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1617,7 +1617,7 @@ void lcd_return_to_status() lcd_refresh(); // to maybe revive the LCD if static electricity killed it. menu_goto(lcd_status_screen, 0, false, true); menu_depth = 0; - eFilamentAction=FilamentAction::None; // i.e. non-autoLoad + eFilamentAction = FilamentAction::None; // i.e. non-autoLoad } //! @brief Pause print, disable nozzle heater, move to park position @@ -2146,13 +2146,21 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed) setTargetBed((float) nTempBed); } - if (eFilamentAction == FilamentAction::Preheat || eFilamentAction == FilamentAction::Lay1Cal) { - if (eFilamentAction == FilamentAction::Lay1Cal) lcd_commands_type = LcdCommands::Layer1Cal; - lcd_return_to_status(); - if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) && - eFilamentAction == FilamentAction::Preheat) lcd_wizard(WizState::LoadFil); - return; + const FilamentAction action = eFilamentAction; + if (action == FilamentAction::Preheat || action == FilamentAction::Lay1Cal) + { + lcd_return_to_status(); + if (action == FilamentAction::Lay1Cal) + { + lcd_commands_type = LcdCommands::Layer1Cal; + } + else if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) + { + lcd_wizard(WizState::LoadFil); + } + return; + } } lcd_timeoutToStatus.stop(); From 015b34de05fd2d5c7d8e7e9e11137c64bb64e337 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 13 Sep 2019 17:09:11 +0200 Subject: [PATCH 20/29] Alert user in wizard about more sheets presets. --- Firmware/ultralcd.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 4d9d4c41b..7bdd15b48 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4782,11 +4782,14 @@ void lcd_wizard(WizState state) break; case S::RepeatLay1Cal: //repeat first layer cal.? wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(_i("Do you want to repeat last step to readjust distance between nozzle and heatbed?"), false);////MSG_WIZARD_REPEAT_V2_CAL c=20 r=7 - if (wizard_event) { + if (wizard_event) + { lcd_show_fullscreen_message_and_wait_P(_i("Please clean heatbed and then press the knob."));////MSG_WIZARD_CLEAN_HEATBED c=20 r=8 state = S::Lay1Cal; } - else { + else + { + lcd_show_fullscreen_message_and_wait_P(_i("If you have more steel sheets you can calibrate additional presets in Settings / HW Setup / Steel sheets.")); state = S::Finish; } break; From b99038736c9eeeffb994e21619c9bf0e9b552011 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 16 Sep 2019 18:22:34 +0200 Subject: [PATCH 21/29] Use eeprom_update_byte instead of eeprom_write_byte --- Firmware/ultralcd.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 7bdd15b48..537541cf8 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4688,10 +4688,10 @@ void lcd_wizard(WizState state) wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(_i("Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?"), false, true);////MSG_WIZARD_WELCOME c=20 r=7 if (wizard_event) { state = S::Restore; - eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); + eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); } else { - eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); + eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); end = true; } break; @@ -4701,7 +4701,7 @@ void lcd_wizard(WizState state) case CALIBRATION_STATUS_XYZ_CALIBRATION: state = S::Xyz; break; //run xyz cal. case CALIBRATION_STATUS_Z_CALIBRATION: state = S::Z; break; //run z cal. case CALIBRATION_STATUS_LIVE_ADJUST: state = S::IsFil; break; //run live adjust - case CALIBRATION_STATUS_CALIBRATED: end = true; eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); break; + case CALIBRATION_STATUS_CALIBRATED: end = true; eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); break; default: state = S::Selftest; break; //if calibration status is unknown, run wizard from the beginning } break; @@ -4794,7 +4794,7 @@ void lcd_wizard(WizState state) } break; case S::Finish: //we are finished - eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); + eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); end = true; break; From 002a7d31a4abbdf292fa8c87fcfa993c91936904 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 16 Sep 2019 18:31:12 +0200 Subject: [PATCH 22/29] Make lcd_wizard() more debug friendly. --- Firmware/ultralcd.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 537541cf8..38d7bf48e 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4669,6 +4669,10 @@ void lcd_wizard(WizState state) bool end = false; int wizard_event; const char *msg = NULL; + // Make sure EEPROM_WIZARD_ACTIVE is true if entering using different entry point + // other than WizState::Run - it is useful for debugging wizard. + if (state != S::Run) eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); + while (!end) { printf_P(PSTR("Wizard state: %d\n"), state); switch (state) { From ff4450489be7f370b72506c417ae5adb57280db3 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 16 Sep 2019 18:38:44 +0200 Subject: [PATCH 23/29] Document. --- Firmware/ultralcd.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 38d7bf48e..eecab8b8a 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4663,6 +4663,7 @@ bool lcd_autoDepleteEnabled() //! ---------------------- | ---------------- //! WizState::Run | Main entry point //! WizState::RepeatLay1Cal | Entry point after passing 1st layer calibration +//! WizState::LoadFil | Entry point after temporarily left for preheat before load filament void lcd_wizard(WizState state) { using S = WizState; From e1cfd6dc4f58aac59896832c07c9bbf8f08fe209 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 16 Sep 2019 18:48:52 +0200 Subject: [PATCH 24/29] Remove option to heat nozzle only from mFilamentItem() when activated from wizard, as it has no use after filament unload was removed from wizard. --- Firmware/ultralcd.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index eecab8b8a..57c63096d 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2139,12 +2139,7 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed) nTargetOld = target_temperature[0]; nTargetBedOld = target_temperature_bed; setTargetHotend0((float )nTemp); - - if (!eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) || - eFilamentAction == FilamentAction::Lay1Cal) - { - setTargetBed((float) nTempBed); - } + setTargetBed((float) nTempBed); { const FilamentAction action = eFilamentAction; From c66b4bd8760bbf44df04db9b28faf5bd4634790c Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 16 Sep 2019 21:14:17 +0200 Subject: [PATCH 25/29] Do not ask for preheat temperature twice if calibrating first layer from wizard without filament. --- Firmware/ultralcd.cpp | 51 +++++++++++++++++++++++++++++++------------ Firmware/ultralcd.h | 6 +++-- 2 files changed, 41 insertions(+), 16 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 57c63096d..6768258bb 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2152,7 +2152,7 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed) } else if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) { - lcd_wizard(WizState::LoadFil); + lcd_wizard(WizState::LoadFilHot); } return; } @@ -4637,6 +4637,24 @@ bool lcd_autoDepleteEnabled() return (lcd_autoDeplete && fsensor_enabled); } +static void wizard_lay1cal_message(bool cold) +{ + lcd_show_fullscreen_message_and_wait_P( + _i("Now I will calibrate distance between tip of the nozzle and heatbed surface.")); ////MSG_WIZARD_V2_CAL c=20 r=8 + if (mmu_enabled) + { + lcd_show_fullscreen_message_and_wait_P( + _i("First you will select filament you wish to use for calibration. Then select temperature which matches your material.")); + } + else if (cold) + { + lcd_show_fullscreen_message_and_wait_P( + _i("Select temperature which matches your material.")); + } + lcd_show_fullscreen_message_and_wait_P( + _i("I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration.")); ////MSG_WIZARD_V2_CAL_2 c=20 r=12 +} + //! @brief Printer first run wizard (Selftest and calibration) //! //! @@ -4753,10 +4771,10 @@ void lcd_wizard(WizState state) { wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is filament loaded?"), true);////MSG_WIZARD_FILAMENT_LOADED c=20 r=2 } - if (wizard_event) state = S::Lay1Cal; + if (wizard_event) state = S::Lay1CalCold; else { - if(mmu_enabled) state = S::LoadFil; + if(mmu_enabled) state = S::LoadFilCold; else state = S::Preheat; } break; @@ -4765,27 +4783,31 @@ void lcd_wizard(WizState state) lcd_show_fullscreen_message_and_wait_P(_i("Select nozzle preheat temperature which matches your material.")); end = true; // Leave wizard temporarily for lcd_preheat_menu break; - case S::LoadFil: //load filament + case S::LoadFilHot: //load filament wait_preheat(); lcd_wizard_load(); - state = S::Lay1Cal; + state = S::Lay1CalHot; break; - case S::Lay1Cal: - lcd_show_fullscreen_message_and_wait_P(_i("Now I will calibrate distance between tip of the nozzle and heatbed surface."));////MSG_WIZARD_V2_CAL c=20 r=8 - if(mmu_enabled) - { - lcd_show_fullscreen_message_and_wait_P(_i("First you will select filament you wish to use for calibration.")); - } - lcd_show_fullscreen_message_and_wait_P(_i("Select temperature which matches your material. Then I will start to print line and you will gradually lower the nozzle by rotating the knob, until you reach optimal height. Check the pictures in our handbook in chapter Calibration."));////MSG_WIZARD_V2_CAL_2 c=20 r=12 + case S::LoadFilCold: //load filament + lcd_wizard_load(); + state = S::Lay1CalCold; + break; + case S::Lay1CalCold: + wizard_lay1cal_message(true); menu_goto(lcd_v2_calibration,0,false,true); end = true; // Leave wizard temporarily for lcd_v2_calibration break; + case S::Lay1CalHot: + wizard_lay1cal_message(false); + lcd_commands_type = LcdCommands::Layer1Cal; + end = true; // Leave wizard temporarily for lcd_v2_calibration + break; case S::RepeatLay1Cal: //repeat first layer cal.? wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(_i("Do you want to repeat last step to readjust distance between nozzle and heatbed?"), false);////MSG_WIZARD_REPEAT_V2_CAL c=20 r=7 if (wizard_event) { lcd_show_fullscreen_message_and_wait_P(_i("Please clean heatbed and then press the knob."));////MSG_WIZARD_CLEAN_HEATBED c=20 r=8 - state = S::Lay1Cal; + state = S::Lay1CalCold; } else { @@ -4825,7 +4847,8 @@ void lcd_wizard(WizState state) break; } - if (!((S::Lay1Cal == state) || (S::Preheat == state))) { + if (!((S::Lay1CalCold == state) || (S::Lay1CalHot == state) || (S::Preheat == state))) + { lcd_show_fullscreen_message_and_wait_P(msg); } lcd_update_enable(true); diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 15e0d3da4..03b048312 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -231,9 +231,11 @@ enum class WizState : uint8_t IsFil, //!< Is filament loaded? Entry point for 1st layer calibration PreheatPla, //!< waiting for preheat nozzle for PLA Preheat, //!< Preheat for any material - LoadFil, //!< Load filament + LoadFilCold, //!< Load filament for MMU + LoadFilHot, //!< Load filament without MMU IsPla, //!< Is PLA filament? - Lay1Cal, //!< First layer calibration + Lay1CalCold, //!< First layer calibration, temperature not selected yet + Lay1CalHot, //!< First layer calibration, temperature already selected RepeatLay1Cal, //!< Repeat first layer calibration? Finish, //!< Deactivate wizard }; From 966d9baf2b58a00edc99bbd1e1554fb0e9a738a6 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 17 Sep 2019 18:58:59 +0200 Subject: [PATCH 26/29] Document. --- Firmware/ultralcd.cpp | 42 ++++++++++++++++++++++++++++-------------- Firmware/ultralcd.h | 6 +++--- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 6768258bb..3e76fbec9 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4663,11 +4663,25 @@ static void wizard_lay1cal_message(bool cold) //! @startuml //! [*] --> IsFil //! IsFil : Is any filament loaded? -//! load : Push the button to start loading Filament 1 +//! LoadFilCold : Push the button to start loading Filament 1 //! -//! IsFil --> calibration : yes -//! IsFil --> load : no -//! load --> calibration : click +//! IsFil --> Lay1CalCold : yes +//! IsFil --> LoadFilCold : no +//! LoadFilCold --> Lay1CalCold : click +//! @enduml +//! +//! First layer calibration without MMU state diagram +//! +//! @startuml +//! [*] --> IsFil +//! IsFil : Is filament loaded? +//! Preheat : Select nozle temperature which matches your material. +//! LoadFilHot : Insert filament to extruder and press the knob. +//! +//! IsFil --> Lay1CalCold : yes +//! IsFil --> Preheat : no +//! Preheat --> LoadFilHot : select +//! LoadFilHot --> Lay1CalHot : click //! @enduml //! //! @param state Entry point of the wizard @@ -4676,7 +4690,7 @@ static void wizard_lay1cal_message(bool cold) //! ---------------------- | ---------------- //! WizState::Run | Main entry point //! WizState::RepeatLay1Cal | Entry point after passing 1st layer calibration -//! WizState::LoadFil | Entry point after temporarily left for preheat before load filament +//! WizState::LoadFilHot | Entry point after temporarily left for preheat before load filament void lcd_wizard(WizState state) { using S = WizState; @@ -4713,7 +4727,7 @@ void lcd_wizard(WizState state) end = true; } break; - case S::Restore: // restore calibration status + case S::Restore: switch (calibration_status()) { case CALIBRATION_STATUS_ASSEMBLED: state = S::Selftest; break; //run selftest case CALIBRATION_STATUS_XYZ_CALIBRATION: state = S::Xyz; break; //run xyz cal. @@ -4732,13 +4746,13 @@ void lcd_wizard(WizState state) } else end = true; break; - case S::Xyz: //xyz calibration + case S::Xyz: lcd_show_fullscreen_message_and_wait_P(_i("I will run xyz calibration now. It will take approx. 12 mins."));////MSG_WIZARD_XYZ_CAL c=20 r=8 wizard_event = gcode_M45(false, 0); if (wizard_event) state = S::IsFil; else end = true; break; - case S::Z: //z calibration + case S::Z: lcd_show_fullscreen_message_and_wait_P(_i("Please remove shipping helpers first.")); lcd_show_fullscreen_message_and_wait_P(_i("Now remove the test print from steel sheet.")); lcd_show_fullscreen_message_and_wait_P(_i("I will run z calibration now."));////MSG_WIZARD_Z_CAL c=20 r=8 @@ -4760,8 +4774,8 @@ void lcd_wizard(WizState state) } else end = true; break; - case S::IsFil: //is filament loaded? - //start to preheat nozzle and bed to save some time later + case S::IsFil: + //start to preheat nozzle and bed to save some time later setTargetHotend(PLA_PREHEAT_HOTEND_TEMP, 0); setTargetBed(PLA_PREHEAT_HPB_TEMP); if (mmu_enabled) @@ -4783,12 +4797,12 @@ void lcd_wizard(WizState state) lcd_show_fullscreen_message_and_wait_P(_i("Select nozzle preheat temperature which matches your material.")); end = true; // Leave wizard temporarily for lcd_preheat_menu break; - case S::LoadFilHot: //load filament + case S::LoadFilHot: wait_preheat(); lcd_wizard_load(); state = S::Lay1CalHot; break; - case S::LoadFilCold: //load filament + case S::LoadFilCold: lcd_wizard_load(); state = S::Lay1CalCold; break; @@ -4802,7 +4816,7 @@ void lcd_wizard(WizState state) lcd_commands_type = LcdCommands::Layer1Cal; end = true; // Leave wizard temporarily for lcd_v2_calibration break; - case S::RepeatLay1Cal: //repeat first layer cal.? + case S::RepeatLay1Cal: wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(_i("Do you want to repeat last step to readjust distance between nozzle and heatbed?"), false);////MSG_WIZARD_REPEAT_V2_CAL c=20 r=7 if (wizard_event) { @@ -4815,7 +4829,7 @@ void lcd_wizard(WizState state) state = S::Finish; } break; - case S::Finish: //we are finished + case S::Finish: eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); end = true; break; diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 03b048312..aef8067b2 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -223,12 +223,12 @@ bool lcd_autoDepleteEnabled(); //! @brief Wizard state enum class WizState : uint8_t { - Run, //!< run wizard? Entry point. + Run, //!< run wizard? Main entry point. Restore, //!< restore calibration status - Selftest, + Selftest, //!< self test Xyz, //!< xyz calibration Z, //!< z calibration - IsFil, //!< Is filament loaded? Entry point for 1st layer calibration + IsFil, //!< Is filament loaded? First step of 1st layer calibration PreheatPla, //!< waiting for preheat nozzle for PLA Preheat, //!< Preheat for any material LoadFilCold, //!< Load filament for MMU From 027b6238fd8406ea6d65a02d03cda166fcbb4feb Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 17 Sep 2019 20:26:03 +0200 Subject: [PATCH 27/29] Mark code unused when PINDA_THERMISTOR is defined by macro. Saves 1B of RAM and 4B of FLASH memory. --- Firmware/Marlin.h | 2 -- Firmware/Marlin_main.cpp | 31 ++++++++++++++++--------------- Firmware/temperature.cpp | 2 ++ Firmware/ultralcd.cpp | 10 +++++++--- Firmware/ultralcd.h | 2 ++ 5 files changed, 27 insertions(+), 20 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 6098731fa..7b44fef87 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -423,8 +423,6 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_points_num, float shift_x, float shift_y); #endif //HEATBED_ANALYSIS float temp_comp_interpolation(float temperature); -void temp_compensation_apply(); -void temp_compensation_start(); void show_fw_version_warnings(); uint8_t check_printer_version(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index ad81a061e..f80143fda 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -397,6 +397,9 @@ static bool setTargetedHotend(int code, uint8_t &extruder); static void print_time_remaining_init(); static void wait_for_heater(long codenum, uint8_t extruder); static void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis); +static void temp_compensation_start(); +static void temp_compensation_apply(); + uint16_t gcode_in_progress = 0; uint16_t mcode_in_progress = 0; @@ -4617,7 +4620,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) case_G80: { mesh_bed_leveling_flag = true; +#ifndef PINDA_THERMISTOR static bool run = false; +#endif // ndef PINDA_THERMISTOR #ifdef SUPPORT_VERBOSITY int8_t verbosity_level = 0; @@ -4665,13 +4670,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } bool magnet_elimination = (eeprom_read_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION) > 0); - bool temp_comp_start = true; -#ifdef PINDA_THERMISTOR - temp_comp_start = false; -#endif //PINDA_THERMISTOR - - if (temp_comp_start) - if (run == false && temp_cal_active == true && calibration_status_pinda() == true && target_temperature_bed >= 50) { +#ifndef PINDA_THERMISTOR + if (run == false && temp_cal_active == true && calibration_status_pinda() == true && target_temperature_bed >= 50) + { if (lcd_commands_type != LcdCommands::StopPrint) { temp_compensation_start(); run = true; @@ -4683,7 +4684,8 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; } - run = false; + run = false; +#endif //PINDA_THERMISTOR if (lcd_commands_type == LcdCommands::StopPrint) { mesh_bed_leveling_flag = false; break; @@ -4900,12 +4902,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) clean_up_after_endstop_move(l_feedmultiply); // SERIAL_ECHOLNPGM("clean up finished "); - bool apply_temp_comp = true; -#ifdef PINDA_THERMISTOR - apply_temp_comp = false; -#endif - if (apply_temp_comp) +#ifndef PINDA_THERMISTOR if(temp_cal_active == true && calibration_status_pinda() == true) temp_compensation_apply(); //apply PINDA temperature compensation +#endif babystep_apply(); // Apply Z height correction aka baby stepping before mesh bed leveing gets activated. // SERIAL_ECHOLNPGM("babystep applied"); bool eeprom_bed_correction_valid = eeprom_read_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID) == 1; @@ -9354,7 +9353,8 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ } #endif //HEATBED_ANALYSIS -void temp_compensation_start() { +#ifndef PINDA_THERMISTOR +static void temp_compensation_start() { custom_message_type = CustomMsg::TempCompPreheat; custom_message_state = PINDA_HEAT_T + 1; @@ -9381,7 +9381,7 @@ void temp_compensation_start() { custom_message_state = 0; } -void temp_compensation_apply() { +static void temp_compensation_apply() { int i_add; int z_shift = 0; float z_shift_mm; @@ -9404,6 +9404,7 @@ void temp_compensation_apply() { //we have no temp compensation data } } +#endif //ndef PINDA_THERMISTOR float temp_comp_interpolation(float inp_temperature) { diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 3c7f5fbc4..39fd95fca 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -1565,7 +1565,9 @@ extern "C" { void adc_ready(void) //callback from adc when sampling finished { current_temperature_raw[0] = adc_values[ADC_PIN_IDX(TEMP_0_PIN)]; //heater +#ifdef PINDA_THERMISTOR current_temperature_raw_pinda_fast = adc_values[ADC_PIN_IDX(TEMP_PINDA_PIN)]; +#endif //PINDA_THERMISTOR current_temperature_bed_raw = adc_values[ADC_PIN_IDX(TEMP_BED_PIN)]; #ifdef VOLT_PWR_PIN current_voltage_raw_pwr = adc_values[ADC_PIN_IDX(VOLT_PWR_PIN)]; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 3e76fbec9..ed662887b 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1863,11 +1863,11 @@ static void lcd_menu_temperatures() lcd_timeoutToStatus.stop(); //infinite timeout lcd_home(); lcd_printf_P(PSTR(" %S: %d%c \n" " %S: %d%c \n"), _i("Nozzle"), (int)current_temperature[0], '\x01', _i("Bed"), (int)current_temperature_bed, '\x01'); -#ifdef AMBIENT_THERMISTOR +#if defined (AMBIENT_THERMISTOR) && defined (PINDA_THERMISTOR) lcd_printf_P(PSTR(" %S: %d%c\n" " PINDA: %d%c"), _i("Ambient"), (int)current_temperature_ambient, '\x01', (int)current_temperature_pinda, '\x01'); -#else //AMBIENT_THERMISTOR +#elif defined (PINDA_THERMISTOR) lcd_printf_P(PSTR(" PINDA: %d%c"), (int)current_temperature_pinda, '\x01'); -#endif //AMBIENT_THERMISTOR +#endif menu_back_if_clicked(); } @@ -2969,9 +2969,11 @@ static void lcd_babystep_z() eeprom_update_byte(&(EEPROM_Sheets_base->s[(eeprom_read_byte( &(EEPROM_Sheets_base->active_sheet)))].bed_temp), target_temperature_bed); +#ifdef PINDA_THERMISTOR eeprom_update_byte(&(EEPROM_Sheets_base->s[(eeprom_read_byte( &(EEPROM_Sheets_base->active_sheet)))].pinda_temp), current_temperature_pinda); +#endif //PINDA_THERMISTOR calibration_status_store(CALIBRATION_STATUS_CALIBRATED); } if (LCD_CLICKED) menu_back(); @@ -3140,6 +3142,7 @@ void lcd_adjust_z() { }*/ +#ifdef PINDA_THERMISTOR bool lcd_wait_for_pinda(float temp) { lcd_set_custom_characters_degree(); setAllTargetHotends(0); @@ -3168,6 +3171,7 @@ bool lcd_wait_for_pinda(float temp) { lcd_update_enable(true); return target_temp_reached; } +#endif //PINDA_THERMISTOR void lcd_wait_for_heater() { lcd_display_message_fullscreen_P(_T(MSG_WIZARD_HEATING)); diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index aef8067b2..4ce967958 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -197,7 +197,9 @@ void lcd_wait_for_cool_down(); void lcd_extr_cal_reset(); void lcd_temp_cal_show_result(bool result); +#ifdef PINDA_THERMISTOR bool lcd_wait_for_pinda(float temp); +#endif //PINDA_THERMISTOR void bowden_menu(); From 19a85379013a63eb46fcfb00d11efe73930d57b4 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 17 Sep 2019 20:35:18 +0200 Subject: [PATCH 28/29] Document. --- 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 f80143fda..ec5e8c0ca 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4621,7 +4621,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) { mesh_bed_leveling_flag = true; #ifndef PINDA_THERMISTOR - static bool run = false; + static bool run = false; // thermistor-less PINDA temperature compensation is running #endif // ndef PINDA_THERMISTOR #ifdef SUPPORT_VERBOSITY From 6bd35bfa2f37a4d79185a647d3b39bb76f01bc0e Mon Sep 17 00:00:00 2001 From: leptun Date: Tue, 1 Oct 2019 19:43:30 +0300 Subject: [PATCH 29/29] Increase MENU_DEPTH_MAX to 7 to allow sheet calibration with MMU --- Firmware/menu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 352191024..d8232c321 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -15,7 +15,7 @@ extern int32_t lcd_encoder; -#define MENU_DEPTH_MAX 6 +#define MENU_DEPTH_MAX 7 static menu_record_t menu_stack[MENU_DEPTH_MAX];