From acb0341a1faa35a5ef731ad51c92a662ed06ddfd Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 11 Sep 2019 22:42:40 +0200 Subject: [PATCH 01/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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/54] 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 fd01942db8c7472ae309c13fe85f1d24db93a3c0 Mon Sep 17 00:00:00 2001 From: leptun Date: Thu, 19 Sep 2019 20:48:59 +0300 Subject: [PATCH 29/54] FAN Error fix - Initial --- Firmware/Marlin.h | 5 ++++ Firmware/Marlin_main.cpp | 50 +++++++++++++++++++++------------------- Firmware/messages.c | 3 ++- Firmware/messages.h | 3 ++- Firmware/temperature.cpp | 18 +++++++-------- Firmware/temperature.h | 1 + Firmware/ultralcd.cpp | 15 ++++++++---- 7 files changed, 55 insertions(+), 40 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 625e079ea..3c96cfc0d 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -240,6 +240,11 @@ void prepare_move(); void kill(const char *full_screen_message = NULL, unsigned char id = 0); void Stop(); +#define PRINTING_TYPE_SD 0 +#define PRINTING_TYPE_USB 1 +#define PRINTING_TYPE_NONE 2 +extern uint8_t saved_printing_type; + bool IsStopped(); //put an ASCII command at the end of the current buffer. diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 2423beafb..b73ef5941 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -142,10 +142,6 @@ //Macro for print fan speed #define FAN_PULSE_WIDTH_LIMIT ((fanSpeed > 100) ? 3 : 4) //time in ms -#define PRINTING_TYPE_SD 0 -#define PRINTING_TYPE_USB 1 -#define PRINTING_TYPE_NONE 2 - //filament types #define FILAMENT_DEFAULT 0 #define FILAMENT_FLEX 1 @@ -378,7 +374,7 @@ boolean chdkActive = false; //! @{ bool saved_printing = false; //!< Print is paused and saved in RAM static uint32_t saved_sdpos = 0; //!< SD card position, or line number in case of USB printing -static uint8_t saved_printing_type = PRINTING_TYPE_SD; +uint8_t saved_printing_type = PRINTING_TYPE_SD; static float saved_pos[4] = { 0, 0, 0, 0 }; //! Feedrate hopefully derived from an active block of the planner at the time the print has been canceled, in mm/min. static float saved_feedrate2 = 0; @@ -1751,12 +1747,22 @@ void loop() { is_usb_printing = false; } - + +#ifdef FANCHECK + if ((saved_printing_type == PRINTING_TYPE_USB) && fan_check_error) + { + process_commands(); //used to process pausing + KEEPALIVE_STATE(PAUSED_FOR_USER); + host_keepalive(); //prevent timeouts since usb processing is disabled until print is resumed. This is for a crude way of pausing a print on all hosts. + } + else +#endif if (prusa_sd_card_upload) { //we read byte-by byte serial_read_stream(); - } else + } + else { get_command(); @@ -3450,22 +3456,16 @@ extern uint8_t st_backlash_y; void process_commands() { - #ifdef FANCHECK - if (fan_check_error){ - if( fan_check_error == EFCE_DETECTED ){ - fan_check_error = EFCE_REPORTED; - - if(is_usb_printing){ - SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); - } - else{ - lcd_pause_print(); - } - - } // otherwise it has already been reported, so just ignore further processing - return; - } - #endif +#ifdef FANCHECK + if(fan_check_error){ + if(fan_check_error == EFCE_DETECTED){ + fan_check_error = EFCE_REPORTED; + // SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); + lcd_pause_print(); + } // otherwise it has already been reported, so just ignore further processing + if(saved_printing_type == PRINTING_TYPE_USB) return; //ignore usb stream. + } +#endif if (!buflen) return; //empty command #ifdef FILAMENT_RUNOUT_SUPPORT @@ -10154,7 +10154,8 @@ void restore_print_from_ram_and_continue(float e_move) #ifdef FANCHECK // Do not allow resume printing if fans are still not ok - if( fan_check_error != EFCE_OK )return; + if ((fan_check_error != EFCE_OK) && (fan_check_error != EFCE_FIXED)) return; + if (fan_check_error == EFCE_FIXED) fan_check_error = EFCE_OK; //reenable serial stream processing if printing from usb #endif // for (int axis = X_AXIS; axis <= E_AXIS; axis++) @@ -10208,6 +10209,7 @@ void restore_print_from_ram_and_continue(float e_move) } SERIAL_PROTOCOLLNRPGM(MSG_OK); //dummy response because of octoprint is waiting for this lcd_setstatuspgm(_T(WELCOME_MSG)); + saved_printing_type = PRINTING_TYPE_NONE; saved_printing = false; } diff --git a/Firmware/messages.c b/Firmware/messages.c index 1c36e43c5..7803bb358 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -129,4 +129,5 @@ const char MSG_ENDSTOP_OPEN[] PROGMEM_N1 = "open"; //// const char MSG_POWERUP[] PROGMEM_N1 = "PowerUp"; //// const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"; //// const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; //// -const char MSG_OCTOPRINT_PAUSE[] PROGMEM_N1 = "// action:pause"; //// +const char MSG_OCTOPRINT_PAUSED[] PROGMEM_N1 = "// action:paused"; //// +const char MSG_OCTOPRINT_RESUMED[] PROGMEM_N1 = "// action:resumed"; //// diff --git a/Firmware/messages.h b/Firmware/messages.h index b48337efd..a6525491d 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -130,7 +130,8 @@ extern const char MSG_ERR_STOPPED[]; extern const char MSG_ENDSTOP_HIT[]; extern const char MSG_EJECT_FILAMENT[]; extern const char MSG_CUT_FILAMENT[]; -extern const char MSG_OCTOPRINT_PAUSE[]; +extern const char MSG_OCTOPRINT_PAUSED[]; +extern const char MSG_OCTOPRINT_RESUMED[]; #if defined(__cplusplus) } diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 3c7f5fbc4..f88933a19 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -503,7 +503,7 @@ void checkFanSpeed() // drop the fan_check_error flag when both fans are ok if( fan_speed_errors[0] == 0 && fan_speed_errors[1] == 0 && fan_check_error == EFCE_REPORTED){ // we may even send some info to the LCD from here - fan_check_error = EFCE_OK; + fan_check_error = EFCE_FIXED; } if ((fan_speed_errors[0] > max_extruder_fan_errors) && fans_check_enabled) { @@ -529,21 +529,21 @@ static void fanSpeedErrorBeep(const char *serialMsg, const char *lcdMsg){ } void fanSpeedError(unsigned char _fan) { - if (get_message_level() != 0 && isPrintPaused) return; - //to ensure that target temp. is not set to zero in case taht we are resuming print + if (get_message_level() != 0 && isPrintPaused) return; + //to ensure that target temp. is not set to zero in case that we are resuming print if (card.sdprinting || is_usb_printing) { if (heating_status != 0) { lcd_print_stop(); } else { - fan_check_error = EFCE_DETECTED; + fan_check_error = EFCE_DETECTED; //plans error for next processed command } } else { - SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); //for octoprint - setTargetHotend0(0); - heating_status = 0; - fan_check_error = EFCE_REPORTED; + // SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); //Why pause octoprint? is_usb_printing would be true in that case, so there is no need for this. + setTargetHotend0(0); + heating_status = 0; + fan_check_error = EFCE_REPORTED; } switch (_fan) { case 0: // extracting the same code from case 0 and case 1 into a function saves 72B @@ -553,7 +553,7 @@ void fanSpeedError(unsigned char _fan) { fanSpeedErrorBeep(PSTR("Print fan speed is lower than expected"), PSTR("Err: PRINT FAN ERROR") ); break; } - SERIAL_PROTOCOLLNRPGM(MSG_OK); + // SERIAL_PROTOCOLLNRPGM(MSG_OK); //This ok messes things up with octoprint. } #endif //(defined(TACH_0) && TACH_0 >-1) || (defined(TACH_1) && TACH_1 > -1) diff --git a/Firmware/temperature.h b/Firmware/temperature.h index 7f4daa2e4..7c40eae65 100755 --- a/Firmware/temperature.h +++ b/Firmware/temperature.h @@ -241,6 +241,7 @@ void checkExtruderAutoFans(); enum { EFCE_OK = 0, //!< normal operation, both fans are ok + EFCE_FIXED, //!< previous fan error was fixed EFCE_DETECTED, //!< fan error detected, but not reported yet EFCE_REPORTED //!< fan error detected and reported to LCD and serial }; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 0abdf1b59..87a64e72b 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1650,7 +1650,7 @@ void lcd_pause_print() { lcd_commands_type = LcdCommands::LongPause; } - SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); //pause for octoprint + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); //pause for octoprint } @@ -6322,13 +6322,14 @@ static void lcd_test_menu() void lcd_resume_print() { lcd_return_to_status(); - lcd_reset_alert_level(); + lcd_reset_alert_level(); lcd_setstatuspgm(_T(MSG_RESUMING_PRINT)); lcd_reset_alert_level(); //for fan speed error restore_print_from_ram_and_continue(0.0); pause_time += (_millis() - start_pause_print); //accumulate time when print is paused for correct statistics calculation refresh_cmd_timeout(); isPrintPaused = false; + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_RESUMED); //resume octoprint } static void change_sheet() @@ -6461,6 +6462,11 @@ static void lcd_main_menu() } +#ifdef FANCHECK + checkFanSpeed(); //Check manually to get most recent fan speed status + if((fan_check_error == EFCE_FIXED) && (saved_printing_type == PRINTING_TYPE_USB)) + MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT +#endif #ifdef SDSUPPORT if (card.cardOK || lcd_commands_type == LcdCommands::Layer1Cal) @@ -6475,9 +6481,8 @@ static void lcd_main_menu() else { #ifdef FANCHECK - checkFanSpeed(); //Check manually to get most recent fan speed status - if(fan_check_error == EFCE_OK) - MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT + if(fan_check_error == EFCE_FIXED) + MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT #else MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT #endif From 2363f19a626bc3d9921c13044dec7c375fe4e39a Mon Sep 17 00:00:00 2001 From: leptun Date: Fri, 20 Sep 2019 21:07:20 +0300 Subject: [PATCH 30/54] Minor tweaks for usb printing --- Firmware/Marlin.h | 9 ++++----- Firmware/Marlin_main.cpp | 6 +++++- Firmware/ultralcd.cpp | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 3c96cfc0d..ee7f15d8c 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -240,11 +240,6 @@ void prepare_move(); void kill(const char *full_screen_message = NULL, unsigned char id = 0); void Stop(); -#define PRINTING_TYPE_SD 0 -#define PRINTING_TYPE_USB 1 -#define PRINTING_TYPE_NONE 2 -extern uint8_t saved_printing_type; - bool IsStopped(); //put an ASCII command at the end of the current buffer. @@ -381,6 +376,10 @@ extern char dir_names[3][9]; extern int8_t lcd_change_fil_state; // save/restore printing extern bool saved_printing; +extern uint8_t saved_printing_type; +#define PRINTING_TYPE_SD 0 +#define PRINTING_TYPE_USB 1 +#define PRINTING_TYPE_NONE 2 //save/restore printing in case that mmu is not responding extern bool mmu_print_saved; diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index b73ef5941..3e1372edb 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1747,6 +1747,10 @@ void loop() { is_usb_printing = false; } + if (isPrintPaused && saved_printing_type == PRINTING_TYPE_USB) //keep believing that usb is being printed. Prevents accessing dangerous menus while pausing. + { + is_usb_printing = true; + } #ifdef FANCHECK if ((saved_printing_type == PRINTING_TYPE_USB) && fan_check_error) @@ -3463,7 +3467,7 @@ void process_commands() // SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); lcd_pause_print(); } // otherwise it has already been reported, so just ignore further processing - if(saved_printing_type == PRINTING_TYPE_USB) return; //ignore usb stream. + return; //ignore usb stream. It is reenabled by selecting resume from the lcd. } #endif diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 87a64e72b..0fb1d3de6 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6847,6 +6847,7 @@ void lcd_print_stop() SERIAL_ECHOLNPGM("// action:cancel"); // for Octoprint } saved_printing = false; + saved_printing_type = PRINTING_TYPE_NONE; cancel_heatup = true; #ifdef MESH_BED_LEVELING mbl.active = false; From 3c17f7e145ab6cf346f02732f3c0193d217b1516 Mon Sep 17 00:00:00 2001 From: leptun Date: Sun, 22 Sep 2019 14:04:58 +0300 Subject: [PATCH 31/54] No need to check the fan in the menu --- Firmware/ultralcd.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 0fb1d3de6..1d970368a 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6463,7 +6463,6 @@ static void lcd_main_menu() #ifdef FANCHECK - checkFanSpeed(); //Check manually to get most recent fan speed status if((fan_check_error == EFCE_FIXED) && (saved_printing_type == PRINTING_TYPE_USB)) MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT #endif From 89de5aac77f382fd0257fa3779fdd866f1ab2bf6 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Mon, 23 Sep 2019 17:13:33 +0200 Subject: [PATCH 32/54] default nozzle diameter for farm mode --- Firmware/eeprom.h | 1 + Firmware/util.cpp | 6 +++++- Firmware/util.h | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 482ddf932..8276d61a7 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -25,6 +25,7 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP #endif #define EEPROM_EMPTY_VALUE 0xFF +#define EEPROM_EMPTY_VALUE16 0xFFFF // The total size of the EEPROM is // 4096 for the Atmega2560 #define EEPROM_TOP 4096 diff --git a/Firmware/util.cpp b/Firmware/util.cpp index aa1a624da..aac72ee0c 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -341,13 +341,17 @@ if(oCheckMode==ClCheckMode::_Undef) eeprom_update_byte((uint8_t*)EEPROM_CHECK_MODE,(uint8_t)oCheckMode); } if(farm_mode) + { oCheckMode=ClCheckMode::_Strict; + if(eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM)==EEPROM_EMPTY_VALUE16) + eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,EEPROM_NOZZLE_DIAMETER_uM_DEFAULT); + } oNozzleDiameter=(ClNozzleDiameter)eeprom_read_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER); if((oNozzleDiameter==ClNozzleDiameter::_Diameter_Undef)&& !farm_mode) { oNozzleDiameter=ClNozzleDiameter::_Diameter_400; eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)oNozzleDiameter); - eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,400); + eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,EEPROM_NOZZLE_DIAMETER_uM_DEFAULT); } oCheckModel=(ClCheckModel)eeprom_read_byte((uint8_t*)EEPROM_CHECK_MODEL); if(oCheckModel==ClCheckModel::_Undef) diff --git a/Firmware/util.h b/Firmware/util.h index a9bbcb1d6..8f23cd5c3 100644 --- a/Firmware/util.h +++ b/Firmware/util.h @@ -35,6 +35,8 @@ inline void eeprom_update_int8(unsigned char* addr, int8_t v) { //-// +#define EEPROM_NOZZLE_DIAMETER_uM_DEFAULT 400 + enum class ClPrintChecking:uint_least8_t { _Nozzle=1, From c3b7b5ebb57f0e8f197c195bf70db5cb9217a53b Mon Sep 17 00:00:00 2001 From: leptun Date: Wed, 25 Sep 2019 15:58:07 +0300 Subject: [PATCH 33/54] Check fans before resuming --- Firmware/ultralcd.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 1d970368a..574519f28 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6325,6 +6325,39 @@ void lcd_resume_print() lcd_reset_alert_level(); lcd_setstatuspgm(_T(MSG_RESUMING_PRINT)); lcd_reset_alert_level(); //for fan speed error + +#ifdef FANCHECK + fanSpeed = 255; +#ifdef FAN_SOFT_PWM + fanSpeedSoftPwm = 255; +#endif //FAN_SOFT_PWM + manage_heater(); //enables print fan + setExtruderAutoFanState(EXTRUDER_0_AUTO_FAN_PIN, 1); //force enables the extruder fan untill the first manage_heater() call. +#ifdef FAN_SOFT_PWM + extruder_autofan_last_check = _millis(); + fan_measuring = true; +#endif //FAN_SOFT_PWM + _delay(2000); //delay_keep_alive would turn off extruder fan, because temerature is too low (maybe) + manage_heater(); + fanSpeed = 0; +#ifdef FAN_SOFT_PWM + fanSpeedSoftPwm = 0; +#endif //FAN_SOFT_PWM + manage_heater(); +#ifdef TACH_0 + if (!fan_speed[0]) { //extruder fan error + LCD_ALERTMESSAGERPGM(PSTR("Err: EXTR. FAN ERROR")); + return; + } +#endif +#ifdef TACH_1 + if (!fan_speed[1]) { //print fan error + LCD_ALERTMESSAGERPGM(PSTR("Err: PRINT FAN ERROR")); + return; + } +#endif +#endif //FANCHECK + restore_print_from_ram_and_continue(0.0); pause_time += (_millis() - start_pause_print); //accumulate time when print is paused for correct statistics calculation refresh_cmd_timeout(); From 14b72d2b468eb7e50e5b310b5c94c0be2dc14258 Mon Sep 17 00:00:00 2001 From: leptun Date: Wed, 25 Sep 2019 18:12:19 +0300 Subject: [PATCH 34/54] Prevent timeout when printing from SD with USB host connected --- 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 3e1372edb..f9cfb9005 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1753,7 +1753,7 @@ void loop() } #ifdef FANCHECK - if ((saved_printing_type == PRINTING_TYPE_USB) && fan_check_error) + if (fan_check_error) { process_commands(); //used to process pausing KEEPALIVE_STATE(PAUSED_FOR_USER); From 532d1fc4ae9ef079982237bce42acbdf01711d1b Mon Sep 17 00:00:00 2001 From: leptun Date: Wed, 25 Sep 2019 18:32:35 +0300 Subject: [PATCH 35/54] Fix "Resume Print" missing when doing a normal pause --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 574519f28..a332911d9 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6513,7 +6513,7 @@ static void lcd_main_menu() else { #ifdef FANCHECK - if(fan_check_error == EFCE_FIXED) + if((fan_check_error == EFCE_FIXED) || (fan_check_error == EFCE_OK)) MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT #else MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT From 4d149f0dfa711f35905e606e4666146874b6cdc9 Mon Sep 17 00:00:00 2001 From: leptun Date: Wed, 25 Sep 2019 18:50:29 +0300 Subject: [PATCH 36/54] Do not send useless keepalive messages after print is canceled from lcd --- 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 f9cfb9005..10660195a 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1753,7 +1753,7 @@ void loop() } #ifdef FANCHECK - if (fan_check_error) + if (fan_check_error && isPrintPaused) { process_commands(); //used to process pausing KEEPALIVE_STATE(PAUSED_FOR_USER); From 9c2269282754e430b8b96bdebd889f7eae45ef28 Mon Sep 17 00:00:00 2001 From: leptun Date: Wed, 25 Sep 2019 22:34:31 +0300 Subject: [PATCH 37/54] Fix Cancel Print command processing --- Firmware/Marlin_main.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 10660195a..98dff2f9b 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1755,12 +1755,11 @@ void loop() #ifdef FANCHECK if (fan_check_error && isPrintPaused) { - process_commands(); //used to process pausing KEEPALIVE_STATE(PAUSED_FOR_USER); host_keepalive(); //prevent timeouts since usb processing is disabled until print is resumed. This is for a crude way of pausing a print on all hosts. } - else #endif + if (prusa_sd_card_upload) { //we read byte-by byte From dfd3f34351f96a6807e4ca931f9015b3150d6bff Mon Sep 17 00:00:00 2001 From: leptun Date: Wed, 25 Sep 2019 22:35:35 +0300 Subject: [PATCH 38/54] Check for minimum fan speed. Should be achievable by both fans in 1s. --- Firmware/ultralcd.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index a332911d9..b29d39fb3 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6337,7 +6337,7 @@ void lcd_resume_print() extruder_autofan_last_check = _millis(); fan_measuring = true; #endif //FAN_SOFT_PWM - _delay(2000); //delay_keep_alive would turn off extruder fan, because temerature is too low (maybe) + _delay(1000); //delay_keep_alive would turn off extruder fan, because temerature is too low (maybe) manage_heater(); fanSpeed = 0; #ifdef FAN_SOFT_PWM @@ -6345,13 +6345,13 @@ void lcd_resume_print() #endif //FAN_SOFT_PWM manage_heater(); #ifdef TACH_0 - if (!fan_speed[0]) { //extruder fan error + if (fan_speed[0] <= 20) { //extruder fan error LCD_ALERTMESSAGERPGM(PSTR("Err: EXTR. FAN ERROR")); return; } #endif #ifdef TACH_1 - if (!fan_speed[1]) { //print fan error + if (fan_speed[1] <= 20) { //print fan error LCD_ALERTMESSAGERPGM(PSTR("Err: PRINT FAN ERROR")); return; } From ff9a6c81772ce2735bc47bfe837c6ad625da03ce Mon Sep 17 00:00:00 2001 From: leptun Date: Thu, 26 Sep 2019 20:52:29 +0300 Subject: [PATCH 39/54] Prevent fan error while checking fan functionality --- Firmware/temperature.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index f88933a19..e1c467287 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -506,11 +506,11 @@ void checkFanSpeed() fan_check_error = EFCE_FIXED; } - if ((fan_speed_errors[0] > max_extruder_fan_errors) && fans_check_enabled) { + if ((fan_speed_errors[0] > max_extruder_fan_errors) && fans_check_enabled && (fan_check_error == EFCE_OK)) { fan_speed_errors[0] = 0; fanSpeedError(0); //extruder fan } - if ((fan_speed_errors[1] > max_print_fan_errors) && fans_check_enabled) { + if ((fan_speed_errors[1] > max_print_fan_errors) && fans_check_enabled && (fan_check_error == EFCE_OK)) { fan_speed_errors[1] = 0; fanSpeedError(1); //print fan } From 8c7015df53312aaf3557b2ac8354289b98556cd1 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Fri, 27 Sep 2019 15:42:31 +0200 Subject: [PATCH 40/54] Document set current command. --- Firmware/Marlin_main.cpp | 3 +- Firmware/tmc2130.cpp | 75 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 2423beafb..970b855f7 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7444,11 +7444,12 @@ Sigma_Exit: break; #endif - //! ### M907 - Set digital trimpot motor current using axis codes + //! ### M907 - Set digital trimpot motor current in mA using axis codes // --------------------------------------------------------------- case 907: { #ifdef TMC2130 + //! See tmc2130_cur2val() for translation to 0 .. 63 range for (int i = 0; i < NUM_AXIS; i++) if(code_seen(axis_codes[i])) { diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index 15188fc42..42359ba84 100755 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -1,3 +1,5 @@ +//! @file + #include "Marlin.h" #ifdef TMC2130 @@ -1009,6 +1011,79 @@ bool tmc2130_home_calibrate(uint8_t axis) return true; } + +//! @brief Translate current to tmc2130 vsense and IHOLD or IRUN +//! @param cur current in mA +//! @return 0 .. 63 +//! @n most significant bit is CHOPCONF vsense bit (sense resistor voltage based current scaling) +//! @n rest is to be used in IRUN or IHOLD register +//! +//! | mA | trinamic register | note | +//! | --- | --- | --- | +//! | 0 | 0 | doesn't mean current off, lowest current is 1/32 current with vsense low range | +//! | 30 | 1 | | +//! | 40 | 2 | | +//! | 60 | 3 | | +//! | 90 | 4 | | +//! | 100 | 5 | | +//! | 120 | 6 | | +//! | 130 | 7 | | +//! | 150 | 8 | | +//! | 180 | 9 | | +//! | 190 | 10 | | +//! | 210 | 11 | | +//! | 230 | 12 | | +//! | 240 | 13 | | +//! | 250 | 13 | | +//! | 260 | 14 | | +//! | 280 | 15 | | +//! | 300 | 16 | | +//! | 320 | 17 | | +//! | 340 | 18 | | +//! | 350 | 19 | | +//! | 370 | 20 | | +//! | 390 | 21 | | +//! | 410 | 22 | | +//! | 430 | 23 | | +//! | 450 | 24 | | +//! | 460 | 25 | | +//! | 480 | 26 | | +//! | 500 | 27 | | +//! | 520 | 28 | | +//! | 535 | 29 | | +//! | N/D | 30 | extruder default | +//! | 540 | 33 | | +//! | 560 | 34 | | +//! | 580 | 35 | | +//! | 590 | 36 | farm mode extruder default | +//! | 610 | 37 | | +//! | 630 | 38 | | +//! | 640 | 39 | | +//! | 660 | 40 | | +//! | 670 | 41 | | +//! | 690 | 42 | | +//! | 710 | 43 | | +//! | 720 | 44 | | +//! | 730 | 45 | | +//! | 760 | 46 | | +//! | 770 | 47 | | +//! | 790 | 48 | | +//! | 810 | 49 | | +//! | 820 | 50 | | +//! | 840 | 51 | | +//! | 850 | 52 | | +//! | 870 | 53 | | +//! | 890 | 54 | | +//! | 900 | 55 | | +//! | 920 | 56 | | +//! | 940 | 57 | | +//! | 950 | 58 | | +//! | 970 | 59 | | +//! | 980 | 60 | | +//! | 1000 | 61 | | +//! | 1020 | 62 | | +//! | 1029 | 63 | | + uint8_t tmc2130_cur2val(float cur) { if (cur < 0) cur = 0; //limit min From bf09eb943d56cdfc11847324c6ac04976f264b8d Mon Sep 17 00:00:00 2001 From: leptun Date: Sun, 29 Sep 2019 21:09:11 +0300 Subject: [PATCH 41/54] fix workDirDepth not reset after card init. --- Firmware/cardreader.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Firmware/cardreader.cpp b/Firmware/cardreader.cpp index a9cea244f..ab4d3776b 100644 --- a/Firmware/cardreader.cpp +++ b/Firmware/cardreader.cpp @@ -203,6 +203,7 @@ void CardReader::initsd() } workDir=root; curDir=&root; + workDirDepth = 0; #ifdef SDCARD_SORT_ALPHA presort(); From 30f325c81d190f24e9582b54f1c80643bb18cf32 Mon Sep 17 00:00:00 2001 From: leptun Date: Mon, 30 Sep 2019 20:01:31 +0300 Subject: [PATCH 42/54] Extract fan_error_selftest to function for readability --- Firmware/ultralcd.cpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index b29d39fb3..bd261d4e4 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6316,17 +6316,10 @@ static void lcd_test_menu() } #endif //LCD_TEST -//! @brief Resume paused print -//! @todo It is not good to call restore_print_from_ram_and_continue() from function called by lcd_update(), -//! as restore_print_from_ram_and_continue() calls lcd_update() internally. -void lcd_resume_print() +static void fan_error_selftest() { - lcd_return_to_status(); - lcd_reset_alert_level(); - lcd_setstatuspgm(_T(MSG_RESUMING_PRINT)); - lcd_reset_alert_level(); //for fan speed error - #ifdef FANCHECK + fanSpeed = 255; #ifdef FAN_SOFT_PWM fanSpeedSoftPwm = 255; @@ -6356,7 +6349,21 @@ void lcd_resume_print() return; } #endif -#endif //FANCHECK + +#endif //FANCHECK +} + +//! @brief Resume paused print +//! @todo It is not good to call restore_print_from_ram_and_continue() from function called by lcd_update(), +//! as restore_print_from_ram_and_continue() calls lcd_update() internally. +void lcd_resume_print() +{ + lcd_return_to_status(); + lcd_reset_alert_level(); + lcd_setstatuspgm(_T(MSG_RESUMING_PRINT)); + lcd_reset_alert_level(); //for fan speed error + + fan_error_selftest(); restore_print_from_ram_and_continue(0.0); pause_time += (_millis() - start_pause_print); //accumulate time when print is paused for correct statistics calculation From 61c74795791f3ec64411e6a4a8c43ae8f1aa448e Mon Sep 17 00:00:00 2001 From: leptun Date: Mon, 30 Sep 2019 20:16:01 +0300 Subject: [PATCH 43/54] Code cleanup: Move texts to messages.c/h --- Firmware/Marlin_main.cpp | 2 +- Firmware/messages.c | 3 +++ Firmware/messages.h | 3 +++ Firmware/temperature.cpp | 4 ++-- Firmware/ultralcd.cpp | 6 +++--- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 98dff2f9b..39013dc8d 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -619,7 +619,7 @@ void crashdet_cancel() if (saved_printing_type == PRINTING_TYPE_SD) { lcd_print_stop(); }else if(saved_printing_type == PRINTING_TYPE_USB){ - SERIAL_ECHOLNPGM("// action:cancel"); //for Octoprint: works the same as clicking "Abort" button in Octoprint GUI + SERIAL_ECHOLNRPGM(MSG_OCTOPRINT_CANCEL); //for Octoprint: works the same as clicking "Abort" button in Octoprint GUI SERIAL_PROTOCOLLNRPGM(MSG_OK); } } diff --git a/Firmware/messages.c b/Firmware/messages.c index 7803bb358..c0c3cfc3f 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -131,3 +131,6 @@ const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Fix th const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; //// const char MSG_OCTOPRINT_PAUSED[] PROGMEM_N1 = "// action:paused"; //// const char MSG_OCTOPRINT_RESUMED[] PROGMEM_N1 = "// action:resumed"; //// +const char MSG_OCTOPRINT_CANCEL[] PROGMEM_N1 = "// action:cancel"; //// +const char MSG_FANCHECK_EXTRUDER[] PROGMEM_N1 = "Err: EXTR. FAN ERROR"; ////c=20 +const char MSG_FANCHECK_PRINT[] PROGMEM_N1 = "Err: PRINT FAN ERROR"; ////c=20 diff --git a/Firmware/messages.h b/Firmware/messages.h index a6525491d..525b7c5b4 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -132,6 +132,9 @@ extern const char MSG_EJECT_FILAMENT[]; extern const char MSG_CUT_FILAMENT[]; extern const char MSG_OCTOPRINT_PAUSED[]; extern const char MSG_OCTOPRINT_RESUMED[]; +extern const char MSG_OCTOPRINT_CANCEL[]; +extern const char MSG_FANCHECK_EXTRUDER[]; +extern const char MSG_FANCHECK_PRINT[]; #if defined(__cplusplus) } diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index e1c467287..5a1b9c8c2 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -547,10 +547,10 @@ void fanSpeedError(unsigned char _fan) { } switch (_fan) { case 0: // extracting the same code from case 0 and case 1 into a function saves 72B - fanSpeedErrorBeep(PSTR("Extruder fan speed is lower than expected"), PSTR("Err: EXTR. FAN ERROR") ); + fanSpeedErrorBeep(PSTR("Extruder fan speed is lower than expected"), MSG_FANCHECK_EXTRUDER); break; case 1: - fanSpeedErrorBeep(PSTR("Print fan speed is lower than expected"), PSTR("Err: PRINT FAN ERROR") ); + fanSpeedErrorBeep(PSTR("Print fan speed is lower than expected"), MSG_FANCHECK_PRINT); break; } // SERIAL_PROTOCOLLNRPGM(MSG_OK); //This ok messes things up with octoprint. diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index bd261d4e4..5214ea59e 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6339,13 +6339,13 @@ static void fan_error_selftest() manage_heater(); #ifdef TACH_0 if (fan_speed[0] <= 20) { //extruder fan error - LCD_ALERTMESSAGERPGM(PSTR("Err: EXTR. FAN ERROR")); + LCD_ALERTMESSAGERPGM(MSG_FANCHECK_EXTRUDER); return; } #endif #ifdef TACH_1 if (fan_speed[1] <= 20) { //print fan error - LCD_ALERTMESSAGERPGM(PSTR("Err: PRINT FAN ERROR")); + LCD_ALERTMESSAGERPGM(MSG_FANCHECK_PRINT); return; } #endif @@ -6883,7 +6883,7 @@ void lcd_print_stop() //-// if(!card.sdprinting) { - SERIAL_ECHOLNPGM("// action:cancel"); // for Octoprint + SERIAL_ECHOLNRPGM(MSG_OCTOPRINT_CANCEL); // for Octoprint } saved_printing = false; saved_printing_type = PRINTING_TYPE_NONE; From 9d57f9c365c9999505415233727ee039199f7579 Mon Sep 17 00:00:00 2001 From: leptun Date: Mon, 30 Sep 2019 20:30:09 +0300 Subject: [PATCH 44/54] Fix fan_error_selftest() mistake --- Firmware/ultralcd.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5214ea59e..a5623fa61 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6316,7 +6316,7 @@ static void lcd_test_menu() } #endif //LCD_TEST -static void fan_error_selftest() +static bool fan_error_selftest() { #ifdef FANCHECK @@ -6340,15 +6340,16 @@ static void fan_error_selftest() #ifdef TACH_0 if (fan_speed[0] <= 20) { //extruder fan error LCD_ALERTMESSAGERPGM(MSG_FANCHECK_EXTRUDER); - return; + return 1; } #endif #ifdef TACH_1 if (fan_speed[1] <= 20) { //print fan error LCD_ALERTMESSAGERPGM(MSG_FANCHECK_PRINT); - return; + return 1; } #endif + return 0; #endif //FANCHECK } @@ -6363,7 +6364,7 @@ void lcd_resume_print() lcd_setstatuspgm(_T(MSG_RESUMING_PRINT)); lcd_reset_alert_level(); //for fan speed error - fan_error_selftest(); + if (fan_error_selftest()) return; //abort if error persists restore_print_from_ram_and_continue(0.0); pause_time += (_millis() - start_pause_print); //accumulate time when print is paused for correct statistics calculation From 543ad6eb4130a8c1cb47b0a2d96a4b74315e9da1 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 30 Sep 2019 19:58:09 +0200 Subject: [PATCH 45/54] Ask to reset Z offset before first layer calibration. --- Firmware/ultralcd.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 77af6d5f4..e352c8741 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4774,6 +4774,12 @@ void lcd_toshiba_flash_air_compatibility_toggle() void lcd_v2_calibration() { + if(lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Start from zero offset?"), false, false))////r=15 + { + eeprom_update_word(reinterpret_cast(&(EEPROM_Sheets_base-> + s[eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet))].z_offset)),0xffff); + } + if (mmu_enabled) { const uint8_t filament = choose_menu_P( From 72aed3c544f393653f9c2581eb952b55e9f77f99 Mon Sep 17 00:00:00 2001 From: DRracer Date: Tue, 1 Oct 2019 10:51:02 +0200 Subject: [PATCH 46/54] Allow knob-long-press only in listed menus --- Firmware/ultralcd.cpp | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 77af6d5f4..4812e343a 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -8606,7 +8606,6 @@ uint8_t get_message_level() return lcd_status_message_level; } - void menu_lcd_longpress_func(void) { if (homing_flag || mesh_bed_leveling_flag || menu_menu == lcd_babystep_z || menu_menu == lcd_move_z) @@ -8616,15 +8615,41 @@ void menu_lcd_longpress_func(void) return; } + // explicitely listed menus which are allowed to rise the move-z or live-adj-z functions + // The lists are not the same for both functions, so first decide which function is to be performed + // @@TODO - handle full-screen modal dialogs safely - i.e. they should not hang the printer while doing long press if (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU && (moves_planned() || IS_SD_PRINTING || is_usb_printing )) - { - lcd_clear(); - menu_submenu(lcd_babystep_z); - } - else - { - move_menu_scale = 1.0; - menu_submenu(lcd_move_z); + { // long press as live-adj-z + if(menu_menu == lcd_status_screen + || menu_menu == lcd_tune_menu + || menu_menu == lcd_support_menu + ){ + lcd_clear(); + menu_submenu(lcd_babystep_z); + } else { + // otherwise consume the long press as normal click + // consume the loreturns to sheet menu + menu_back(); + } + } else { // long press as move-z + if(menu_menu == lcd_status_screen + || menu_menu == lcd_main_menu + || menu_menu == lcd_preheat_menu + || menu_menu == lcd_sdcard_menu + || menu_menu == lcd_settings_menu + || menu_menu == lcd_control_temperature_menu +#if (LANG_MODE != 0) + || menu_menu == lcd_language +#endif + || menu_menu == lcd_support_menu + ){ + move_menu_scale = 1.0; + menu_submenu(lcd_move_z); + } else { + // otherwise consume the long press as normal click + // consume the loreturns to sheet menu + menu_back(); + } } } From 9ae75612b57661b3db55131179df6a3a8d7cc569 Mon Sep 17 00:00:00 2001 From: DRracer Date: Tue, 1 Oct 2019 15:31:01 +0200 Subject: [PATCH 47/54] Fixes after first feature tests --- Firmware/ultralcd.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 4812e343a..a966c81f6 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -8618,11 +8618,13 @@ void menu_lcd_longpress_func(void) // explicitely listed menus which are allowed to rise the move-z or live-adj-z functions // The lists are not the same for both functions, so first decide which function is to be performed // @@TODO - handle full-screen modal dialogs safely - i.e. they should not hang the printer while doing long press - if (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU && (moves_planned() || IS_SD_PRINTING || is_usb_printing )) - { // long press as live-adj-z - if(menu_menu == lcd_status_screen - || menu_menu == lcd_tune_menu - || menu_menu == lcd_support_menu + if ( (moves_planned() || IS_SD_PRINTING || is_usb_printing )){ // long press as live-adj-z + if(( current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU ) // only allow live-adj-z up to 2mm of print height + && ( menu_menu == lcd_status_screen // and in listed menus... + || menu_menu == lcd_main_menu + || menu_menu == lcd_tune_menu + || menu_menu == lcd_support_menu + ) ){ lcd_clear(); menu_submenu(lcd_babystep_z); From ed13788e0caf032bc8a3ab3f8db9a25ad138c67d Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Tue, 1 Oct 2019 16:57:37 +0200 Subject: [PATCH 48/54] EEPROM_BABYSTEP_Z using removal --- Firmware/Marlin_main.cpp | 9 +++++---- Firmware/eeprom.cpp | 2 +- Firmware/eeprom.h | 8 ++++++-- Firmware/ultralcd.cpp | 15 +++++---------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 970b855f7..2251b7e35 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1527,7 +1527,7 @@ void setup() calibration_status() == CALIBRATION_STATUS_UNKNOWN || calibration_status() == CALIBRATION_STATUS_XYZ_CALIBRATION) { // Reset the babystepping values, so the printer will not move the Z axis up when the babystepping is enabled. - eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0); + eeprom_update_word(reinterpret_cast(&(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),0); // Show the message. lcd_show_fullscreen_message_and_wait_P(_T(MSG_FOLLOW_CALIBRATION_FLOW)); } @@ -2694,6 +2694,7 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon previous_millis_cmd = _millis(); endstops_hit_on_purpose(); #ifndef MESH_BED_LEVELING +//-// Oct 2019 :: this part of code is (from) now probably un-compilable // If MESH_BED_LEVELING is not active, then it is the original Prusa i3. // Offer the user to load the baby step value, which has been adjusted at the previous print session. if(card.sdprinting && eeprom_read_word((uint16_t *)EEPROM_BABYSTEP_Z)) @@ -2886,7 +2887,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) { // Reset the baby step value and the baby step applied flag. calibration_status_store(CALIBRATION_STATUS_XYZ_CALIBRATION); - eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0); + eeprom_update_word(reinterpret_cast(&(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),0); // Complete XYZ calibration. uint8_t point_too_far_mask = 0; BedSkewOffsetDetectionResultType result = find_bed_offset_and_skew(verbosity_level, point_too_far_mask); @@ -3736,7 +3737,7 @@ void process_commands() lang_reset(); } else if(code_seen("Lz")) { // PRUSA Lz - EEPROM_save_B(EEPROM_BABYSTEP_Z,0); + eeprom_update_word(reinterpret_cast(&(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),0); } else if(code_seen("Beat")) { // PRUSA Beat // Kick farm link timer @@ -5507,7 +5508,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) // Reset the baby step value and the baby step applied flag. calibration_status_store(CALIBRATION_STATUS_ASSEMBLED); - eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0); + eeprom_update_word(reinterpret_cast(&(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),0); // Reset the skew and offset in both RAM and EEPROM. reset_bed_offset_and_skew(); diff --git a/Firmware/eeprom.cpp b/Firmware/eeprom.cpp index b33b2c3ca..93098e93b 100644 --- a/Firmware/eeprom.cpp +++ b/Firmware/eeprom.cpp @@ -62,7 +62,7 @@ void eeprom_init() if (eeprom_read_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT) == 0xffff) eeprom_update_word((uint16_t *)EEPROM_MMU_LOAD_FAIL_TOT, 0); if (eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_FAIL, 0); if (eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL, 0); - if (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == 0xff) + if (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == EEPROM_EMPTY_VALUE) { eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 0); // When upgrading from version older version (before multiple sheets were implemented in v3.8.0) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 482ddf932..197c18c25 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -3,9 +3,12 @@ #include +#define MAX_SHEETS 8 +#define MAX_SHEET_NAME_LENGTH 7 + typedef struct { - char name[7]; //!< Can be null terminated, doesn't need to be null terminated + char name[MAX_SHEET_NAME_LENGTH]; //!< Can be null terminated, doesn't need to be null terminated int16_t z_offset; //!< Z_BABYSTEP_MIN .. Z_BABYSTEP_MAX = Z_BABYSTEP_MIN*2/1000 [mm] .. Z_BABYSTEP_MAX*2/1000 [mm] uint8_t bed_temp; //!< 0 .. 254 [°C] uint8_t pinda_temp; //!< 0 .. 254 [°C] @@ -13,7 +16,7 @@ typedef struct typedef struct { - Sheet s[8]; + Sheet s[MAX_SHEETS]; uint8_t active_sheet; } Sheets; // sizeof(Sheets). Do not change it unless EEPROM_Sheets_base is last item in EEPROM. @@ -25,6 +28,7 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP #endif #define EEPROM_EMPTY_VALUE 0xFF +#define EEPROM_EMPTY_VALUE16 0xFFFF // The total size of the EEPROM is // 4096 for the Atmega2560 #define EEPROM_TOP 4096 diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 77af6d5f4..6bd834fb7 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3211,15 +3211,10 @@ static void lcd_babystep_z() if (LCD_CLICKED || menu_leaving) { // Only update the EEPROM when leaving the menu. - eeprom_update_word(reinterpret_cast(&(EEPROM_Sheets_base-> - s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)), - _md->babystepMemZ); - eeprom_update_byte(&(EEPROM_Sheets_base->s[(eeprom_read_byte( - &(EEPROM_Sheets_base->active_sheet)))].bed_temp), - target_temperature_bed); - eeprom_update_byte(&(EEPROM_Sheets_base->s[(eeprom_read_byte( - &(EEPROM_Sheets_base->active_sheet)))].pinda_temp), - current_temperature_pinda); + uint8_t active_sheet=eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)); + eeprom_update_word(reinterpret_cast(&(EEPROM_Sheets_base->s[active_sheet].z_offset)),_md->babystepMemZ); + eeprom_update_byte(&(EEPROM_Sheets_base->s[active_sheet].bed_temp),target_temperature_bed); + eeprom_update_byte(&(EEPROM_Sheets_base->s[active_sheet].pinda_temp),current_temperature_pinda); calibration_status_store(CALIBRATION_STATUS_CALIBRATED); } if (LCD_CLICKED) menu_back(); @@ -6649,7 +6644,7 @@ static void lcd_reset_sheet() { SheetName sheetName; eeprom_default_sheet_name(selected_sheet, sheetName); - eeprom_update_word(reinterpret_cast(&(EEPROM_Sheets_base->s[selected_sheet].z_offset)),0xffff); + eeprom_update_word(reinterpret_cast(&(EEPROM_Sheets_base->s[selected_sheet].z_offset)),EEPROM_EMPTY_VALUE16); eeprom_update_block(sheetName.c,EEPROM_Sheets_base->s[selected_sheet].name,sizeof(Sheet::name)); if (selected_sheet == eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet))) { From f3c3526aa5cdf49df526e2a2660d2ee43535112c Mon Sep 17 00:00:00 2001 From: DRracer Date: Tue, 1 Oct 2019 17:13:36 +0200 Subject: [PATCH 49/54] fix the knob long-press causing hang in modal dialogs --- Firmware/lcd.cpp | 3 +-- Firmware/ultralcd.cpp | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index 71948789b..3e39312c1 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -761,8 +761,7 @@ void lcd_buttons_update(void) //else if (menu_menu == lcd_move_z) lcd_quick_feedback(); //lcd_button_pressed is set back to false via lcd_quick_feedback function } - else - lcd_long_press_active = 0; + lcd_long_press_active = 0; } lcd_buttons = newbutton; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index a966c81f6..ac0067d06 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -8617,7 +8617,6 @@ void menu_lcd_longpress_func(void) // explicitely listed menus which are allowed to rise the move-z or live-adj-z functions // The lists are not the same for both functions, so first decide which function is to be performed - // @@TODO - handle full-screen modal dialogs safely - i.e. they should not hang the printer while doing long press if ( (moves_planned() || IS_SD_PRINTING || is_usb_printing )){ // long press as live-adj-z if(( current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU ) // only allow live-adj-z up to 2mm of print height && ( menu_menu == lcd_status_screen // and in listed menus... @@ -8630,8 +8629,8 @@ void menu_lcd_longpress_func(void) menu_submenu(lcd_babystep_z); } else { // otherwise consume the long press as normal click - // consume the loreturns to sheet menu - menu_back(); + if( menu_menu != lcd_status_screen ) + menu_back(); } } else { // long press as move-z if(menu_menu == lcd_status_screen @@ -8649,8 +8648,8 @@ void menu_lcd_longpress_func(void) menu_submenu(lcd_move_z); } else { // otherwise consume the long press as normal click - // consume the loreturns to sheet menu - menu_back(); + if( menu_menu != lcd_status_screen ) + menu_back(); } } } From 7c3f397a6240aba9bb7bf3cc9cb0617013f868bb Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 1 Oct 2019 18:22:12 +0200 Subject: [PATCH 50/54] Print sheet name and Z offset in first layer calibration reset dialog. --- Firmware/ultralcd.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e352c8741..4038cb3eb 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4772,6 +4772,17 @@ void lcd_toshiba_flash_air_compatibility_toggle() eeprom_update_byte((uint8_t*)EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY, card.ToshibaFlashAir_isEnabled()); } +void lcd_first_layer_calibration_reset() +{ + SheetFormatBuffer buffer; + menu_format_sheet_E(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], buffer); + lcd_set_cursor(0, 0); + lcd_print(buffer.c); + lcd_set_cursor(0, 1); + float offset = static_cast(eeprom_read_word(reinterpret_cast(&EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)))/cs.axis_steps_per_unit[Z_AXIS]; + lcd_printf_P(PSTR("%.14S%+5.3f"), _i("Adjusting Z:"), offset); //// c=14 +} + void lcd_v2_calibration() { if(lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Start from zero offset?"), false, false))////r=15 @@ -5751,7 +5762,7 @@ 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); + MENU_ITEM_SUBMENU_P(_T(MSG_V2_CALIBRATION), lcd_first_layer_calibration_reset); MENU_ITEM_GCODE_P(_T(MSG_AUTO_HOME), PSTR("G28 W")); MENU_ITEM_FUNCTION_P(_i("Selftest "), lcd_selftest_v);////MSG_SELFTEST #ifdef MK1BP @@ -6673,7 +6684,7 @@ static void lcd_reset_sheet() static void activate_calibrate_sheet() { eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), selected_sheet); - lcd_v2_calibration(); + lcd_first_layer_calibration_reset(); } static void lcd_sheet_menu() From 6bd35bfa2f37a4d79185a647d3b39bb76f01bc0e Mon Sep 17 00:00:00 2001 From: leptun Date: Tue, 1 Oct 2019 19:43:30 +0300 Subject: [PATCH 51/54] 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]; From aabf7655dcb5dcd6ac0aee3df4072cbcbbfcfd3f Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 1 Oct 2019 19:20:36 +0200 Subject: [PATCH 52/54] Do all text formatting in first layer calibration reset dialog in one line. --- Firmware/ultralcd.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 4038cb3eb..b5527f98e 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4774,13 +4774,12 @@ void lcd_toshiba_flash_air_compatibility_toggle() void lcd_first_layer_calibration_reset() { - SheetFormatBuffer buffer; - menu_format_sheet_E(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], buffer); + + char sheet_name[7]; + eeprom_read_block(sheet_name, &EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].name, 7); lcd_set_cursor(0, 0); - lcd_print(buffer.c); - lcd_set_cursor(0, 1); float offset = static_cast(eeprom_read_word(reinterpret_cast(&EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)))/cs.axis_steps_per_unit[Z_AXIS]; - lcd_printf_P(PSTR("%.14S%+5.3f"), _i("Adjusting Z:"), offset); //// c=14 + lcd_printf_P(_i("Sheet %.7s actual\nZ offset: %+1.3f\n%cContinue\n%cStart from zero"), sheet_name, offset); //// r=4 } void lcd_v2_calibration() From 087d3cb25032c1cd5b7b0d230cbe9af0663351ff Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 1 Oct 2019 21:04:00 +0200 Subject: [PATCH 53/54] Continue to lcd_v2_calibration() after selection is made in lcd_first_layer_calibration_reset(). Do not ask for selection if sheet is not calibrated, it is calibrated to zero offset or no first layer calibration was ever made. --- Firmware/ultralcd.cpp | 54 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index b5527f98e..0630eb7c1 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -130,6 +130,7 @@ 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_v2_calibration(); //static void lcd_menu_show_sensors_state(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") static void mmu_fil_eject_menu(); @@ -4772,24 +4773,59 @@ void lcd_toshiba_flash_air_compatibility_toggle() eeprom_update_byte((uint8_t*)EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY, card.ToshibaFlashAir_isEnabled()); } +//! @brief Continue first layer calibration with previous value or start from zero? +//! +//! @code{.unparsed} +//! |01234567890123456789| +//! |Sheet Smooth1 actual| c=a, c=b, a+b = 13 +//! |Z offset: -1.480 mm | c=a, c=b, a+b = 14 +//! |>Continue | c=19 +//! | Start from zero | c=19 +//! ---------------------- +//! @endcode void lcd_first_layer_calibration_reset() { + typedef struct + { + bool reset; + } MenuData; + static_assert(sizeof(menu_data)>= sizeof(MenuData),"_menu_data_t doesn't fit into menu_data"); + MenuData* menuData = (MenuData*)&(menu_data[0]); - char sheet_name[7]; - eeprom_read_block(sheet_name, &EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].name, 7); + if(LCD_CLICKED || !eeprom_is_sheet_initialized(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet))) || + (calibration_status() >= CALIBRATION_STATUS_LIVE_ADJUST) || + (0 == static_cast(eeprom_read_word(reinterpret_cast + (&EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset))))) + { + if (menuData->reset) + { + eeprom_update_word(reinterpret_cast(&EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset), 0xffff); + } + menu_goto(lcd_v2_calibration,0,true,true); + } + + if (lcd_encoder > 0) + { + menuData->reset = true; + lcd_encoder = 1; + } + else if (lcd_encoder < 1) + { + menuData->reset = false; + lcd_encoder = 0; + } + + char sheet_name[sizeof(Sheet::name)]; + eeprom_read_block(sheet_name, &EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].name, sizeof(Sheet::name)); lcd_set_cursor(0, 0); float offset = static_cast(eeprom_read_word(reinterpret_cast(&EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)))/cs.axis_steps_per_unit[Z_AXIS]; - lcd_printf_P(_i("Sheet %.7s actual\nZ offset: %+1.3f\n%cContinue\n%cStart from zero"), sheet_name, offset); //// r=4 + lcd_printf_P(_i("Sheet %.7s actual\nZ offset: %+1.3f mm\n%cContinue\n%cStart from zero"), //// \n denotes line break, %.7s is replaced by 7 character long sheet name, %+1.3f is replaced by 6 character long floating point number, %c is replaced by > or white space (one character) based on whether first or second option is selected. % denoted place holders can not be reordered. r=4 + sheet_name, offset, menuData->reset ? ' ' : '>', menuData->reset ? '>' : ' '); + } void lcd_v2_calibration() { - if(lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Start from zero offset?"), false, false))////r=15 - { - eeprom_update_word(reinterpret_cast(&(EEPROM_Sheets_base-> - s[eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet))].z_offset)),0xffff); - } - if (mmu_enabled) { const uint8_t filament = choose_menu_P( From ca9ef3aba123e45b792bddc4eace803ffedfd455 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 1 Oct 2019 22:57:15 +0200 Subject: [PATCH 54/54] Use content supplied strings for lcd_first_layer_calibration_reset(), as we have translations prepared for release. It will be reverted later to show current Z offset. --- Firmware/ultralcd.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 0630eb7c1..9f498e01a 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4777,10 +4777,10 @@ void lcd_toshiba_flash_air_compatibility_toggle() //! //! @code{.unparsed} //! |01234567890123456789| -//! |Sheet Smooth1 actual| c=a, c=b, a+b = 13 -//! |Z offset: -1.480 mm | c=a, c=b, a+b = 14 -//! |>Continue | c=19 -//! | Start from zero | c=19 +//! |[Smooth1]Live adj. Z| c=11 +//! |value set, continue | c=20 +//! |or start from zero? | c=20 +//! |>Continue Reset | c=a, c=b, a+b = 18 //! ---------------------- //! @endcode void lcd_first_layer_calibration_reset() @@ -4818,9 +4818,8 @@ void lcd_first_layer_calibration_reset() char sheet_name[sizeof(Sheet::name)]; eeprom_read_block(sheet_name, &EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].name, sizeof(Sheet::name)); lcd_set_cursor(0, 0); - float offset = static_cast(eeprom_read_word(reinterpret_cast(&EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)))/cs.axis_steps_per_unit[Z_AXIS]; - lcd_printf_P(_i("Sheet %.7s actual\nZ offset: %+1.3f mm\n%cContinue\n%cStart from zero"), //// \n denotes line break, %.7s is replaced by 7 character long sheet name, %+1.3f is replaced by 6 character long floating point number, %c is replaced by > or white space (one character) based on whether first or second option is selected. % denoted place holders can not be reordered. r=4 - sheet_name, offset, menuData->reset ? ' ' : '>', menuData->reset ? '>' : ' '); + lcd_printf_P(_i("[%.7s]Live adj. Z\nvalue set, continue\nor start from zero?\n%cContinue%cReset"), //// \n denotes line break, %.7s is replaced by 7 character long sheet name, %+1.3f is replaced by 6 character long floating point number, %c is replaced by > or white space (one character) based on whether first or second option is selected. % denoted place holders can not be reordered. r=4 + sheet_name, menuData->reset ? ' ' : '>', menuData->reset ? '>' : ' '); }