From a9e02eb23b9da86b49fa0e9368079c9d99cc7ffd Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Tue, 5 Sep 2017 11:19:10 +0200 Subject: [PATCH 01/14] added messages --- Firmware/language_en.h | 5 ++++- Firmware/ultralcd.cpp | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Firmware/language_en.h b/Firmware/language_en.h index 4e5e7b195..1afea9f31 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -315,4 +315,7 @@ #define(length=17, lines=1) MSG_SORT_TIME "Sort: [Time]" #define(length=17, lines=1) MSG_SORT_ALPHA "Sort: [Alphabet]" #define(length=17, lines=1) MSG_SORT_NONE "Sort: [None]" -#define(length=20, lines=1) MSG_SORTING "Sorting files" \ No newline at end of file +#define(length=20, lines=1) MSG_SORTING "Sorting files" +#define(length=17, lines=1) MSG_WIZARD "Wizard" +#define MSG_WIZARD_LANGUAGE "Please choose your language" +#define MSG_WIZARD_WELCOME "Hi, I’m your new Original Prusa i3 printer. Would you like me to guide you through the setup process?" \ No newline at end of file diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5e5ffc2b2..ba1a6a165 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2659,6 +2659,8 @@ static void lcd_settings_menu() MENU_ITEM(function, PSTR("Disable farm mode"), lcd_disable_farm_mode); } + MENU_ITEM(function, MSG_WIZARD, lcd_wizard); + END_MENU(); } From e52e8e21b1ed5ca3c34d4813657ec6424c4f72bb Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 7 Sep 2017 20:06:23 +0200 Subject: [PATCH 02/14] initial version of wizard --- Firmware/Configuration.h | 5 +- Firmware/Configuration_adv.h | 2 +- Firmware/Marlin.h | 5 + Firmware/Marlin_main.cpp | 375 +++++++++++++++++++---------------- Firmware/language_all.cpp | 85 ++++++++ Firmware/language_all.h | 34 ++++ Firmware/language_en.h | 18 +- Firmware/ultralcd.cpp | 364 +++++++++++++++++++++++++++++++++- Firmware/ultralcd.h | 10 +- 9 files changed, 714 insertions(+), 184 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index cac5271b4..2402f9070 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -5,7 +5,7 @@ #include "Configuration_prusa.h" // Firmware version -#define FW_version "3.0.12-5" +#define FW_version "3.0.12-6" #define FW_PRUSA3D_MAGIC "PRUSA3DFW" #define FW_PRUSA3D_MAGIC_LEN 10 @@ -49,6 +49,7 @@ #define EEPROM_CALIBRATION_STATUS_PINDA (EEPROM_BOWDEN_LENGTH - 1) //0 - not calibrated; 1 - calibrated #define EEPROM_SD_SORT (EEPROM_CALIBRATION_STATUS_PINDA - 1) //0 -time, 1-alpha, 2-none #define EEPROM_XYZ_CAL_SKEW (EEPROM_SD_SORT - 4) +#define EEPROM_WIZARD_ACTIVE (EEPROM_XYZ_CAL_SKEW - 1) // Currently running firmware, each digit stored as uint16_t. // The flavor differentiates a dev, alpha, beta, release candidate or a release version. @@ -722,7 +723,7 @@ enum CalibrationStatus CALIBRATION_STATUS_ASSEMBLED = 255, // For the wizard: self test has been performed, now the XYZ calibration is needed. - // CALIBRATION_STATUS_XYZ_CALIBRATION = 250, + CALIBRATION_STATUS_XYZ_CALIBRATION = 250, // For the wizard: factory assembled, needs to run Z calibration. CALIBRATION_STATUS_Z_CALIBRATION = 240, diff --git a/Firmware/Configuration_adv.h b/Firmware/Configuration_adv.h index 455eb5c18..4f3a71c49 100644 --- a/Firmware/Configuration_adv.h +++ b/Firmware/Configuration_adv.h @@ -323,7 +323,7 @@ * K=0 means advance disabled. * See Marlin documentation for calibration instructions. */ -//#define LIN_ADVANCE +#define LIN_ADVANCE #ifdef LIN_ADVANCE #define LIN_ADVANCE_K 0 //Try around 45 for PLA, around 25 for ABS. diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index bceec18ac..24cce19bd 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -222,6 +222,7 @@ void enquecommand(const char *cmd, bool from_progmem = false); //put an ASCII command at the end of the current buffer, read from flash #define enquecommand_P(cmd) enquecommand(cmd, true) void enquecommand_front(const char *cmd, bool from_progmem = false); +bool cmd_buffer_empty(); //put an ASCII command at the end of the current buffer, read from flash #define enquecommand_P(cmd) enquecommand(cmd, true) #define enquecommand_front_P(cmd) enquecommand_front(cmd, true) @@ -380,4 +381,8 @@ extern MarlinBusyState busy_state; #endif //HOST_KEEPALIVE_FEATURE +bool gcode_M45(bool onlyZ); +void gcode_M701(); + + #endif //ifndef marlin.h diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 2fa709945..66a53dd79 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -799,6 +799,11 @@ void enquecommand(const char *cmd, bool from_progmem) } } +bool cmd_buffer_empty() +{ + return (buflen == 0); +} + void enquecommand_front(const char *cmd, bool from_progmem) { int len = from_progmem ? strlen_P(cmd) : strlen(cmd); @@ -1231,30 +1236,39 @@ void setup() #ifndef DEBUG_DISABLE_STARTMSGS check_babystep(); //checking if Z babystep is in allowed range - - if (calibration_status() == CALIBRATION_STATUS_ASSEMBLED || - calibration_status() == CALIBRATION_STATUS_UNKNOWN) { - // 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); - // Show the message. - lcd_show_fullscreen_message_and_wait_P(MSG_FOLLOW_CALIBRATION_FLOW); - } else if (calibration_status() == CALIBRATION_STATUS_LIVE_ADJUST) { - // Show the message. - lcd_show_fullscreen_message_and_wait_P(MSG_BABYSTEP_Z_NOT_SET); - lcd_update_enable(true); - } else if (calibration_status() == CALIBRATION_STATUS_CALIBRATED && temp_cal_active == true && calibration_status_pinda() == false) { - lcd_show_fullscreen_message_and_wait_P(MSG_PINDA_NOT_CALIBRATED); - lcd_update_enable(true); - } else if (calibration_status() == CALIBRATION_STATUS_Z_CALIBRATION) { - // Show the message. - lcd_show_fullscreen_message_and_wait_P(MSG_FOLLOW_CALIBRATION_FLOW); + + if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 255) { + eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); + lcd_wizard(0); } - for (int i = 0; i<4; i++) EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]); - - //If eeprom version for storing parameters to eeprom using M500 changed, default settings are used. Inform user in this case - if (!previous_settings_retrieved) { - lcd_show_fullscreen_message_and_wait_P(MSG_DEFAULT_SETTINGS_LOADED); + else if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 0) { //dont show calibration status messages if wizard is currently active + + if (calibration_status() == CALIBRATION_STATUS_ASSEMBLED || + calibration_status() == CALIBRATION_STATUS_UNKNOWN) { + // 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); + // Show the message. + lcd_show_fullscreen_message_and_wait_P(MSG_FOLLOW_CALIBRATION_FLOW); + } + else if (calibration_status() == CALIBRATION_STATUS_LIVE_ADJUST) { + // Show the message. + lcd_show_fullscreen_message_and_wait_P(MSG_BABYSTEP_Z_NOT_SET); + lcd_update_enable(true); + } + else if (calibration_status() == CALIBRATION_STATUS_CALIBRATED && temp_cal_active == true && calibration_status_pinda() == false) { + lcd_show_fullscreen_message_and_wait_P(MSG_PINDA_NOT_CALIBRATED); + lcd_update_enable(true); + } + else if (calibration_status() == CALIBRATION_STATUS_Z_CALIBRATION) { + // Show the message. + lcd_show_fullscreen_message_and_wait_P(MSG_FOLLOW_CALIBRATION_FLOW); + } + //If eeprom version for storing parameters to eeprom using M500 changed, default settings are used. Inform user in this case + if (!previous_settings_retrieved) { + lcd_show_fullscreen_message_and_wait_P(MSG_DEFAULT_SETTINGS_LOADED); + } } + for (int i = 0; i < 4; i++) EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]); #endif //DEBUG_DISABLE_STARTMSGS lcd_update_enable(true); @@ -2115,6 +2129,162 @@ void ramming() { } } */ + + +void gcode_M701() { +#ifdef SNMM + extr_adj(snmm_extruder);//loads current extruder +#else + enable_z(); + custom_message = true; + custom_message_type = 2; + + lcd_setstatuspgm(MSG_LOADING_FILAMENT); + current_position[E_AXIS] += 70; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence + + current_position[E_AXIS] += 25; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 100 / 60, active_extruder); //slow sequence + st_synchronize(); + + if (!farm_mode && loading_flag) { + bool clean = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILAMENT_CLEAN, false, true); + + while (!clean) { + lcd_update_enable(true); + lcd_update(2); + current_position[E_AXIS] += 25; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 100 / 60, active_extruder); //slow sequence + st_synchronize(); + clean = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILAMENT_CLEAN, false, true); + } + } + lcd_update_enable(true); + lcd_update(2); + lcd_setstatuspgm(WELCOME_MSG); + disable_z(); + loading_flag = false; + custom_message = false; + custom_message_type = 0; +#endif +} + +bool gcode_M45(bool onlyZ) { + bool final_result = false; + if (!onlyZ) { + setTargetBed(0); + setTargetHotend(0, 0); + setTargetHotend(0, 1); + setTargetHotend(0, 2); + adjust_bed_reset(); //reset bed level correction + } + + // Disable the default update procedure of the display. We will do a modal dialog. + lcd_update_enable(false); + // Let the planner use the uncorrected coordinates. + mbl.reset(); + // Reset world2machine_rotation_and_skew and world2machine_shift, therefore + // the planner will not perform any adjustments in the XY plane. + // Wait for the motors to stop and update the current position with the absolute values. + world2machine_revert_to_uncorrected(); + // Reset the baby step value applied without moving the axes. + babystep_reset(); + // Mark all axes as in a need for homing. + memset(axis_known_position, 0, sizeof(axis_known_position)); + + // Let the user move the Z axes up to the end stoppers. + KEEPALIVE_STATE(PAUSED_FOR_USER); + if (lcd_calibrate_z_end_stop_manual(onlyZ)) { + KEEPALIVE_STATE(IN_HANDLER); + refresh_cmd_timeout(); + if (((degHotend(0) > MAX_HOTEND_TEMP_CALIBRATION) || (degBed() > MAX_BED_TEMP_CALIBRATION)) && (!onlyZ)) { + lcd_wait_for_cool_down(); + lcd_show_fullscreen_message_and_wait_P(MSG_PAPER); + lcd_display_message_fullscreen_P(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1); + lcd_implementation_print_at(0, 2, 1); + lcd_printPGM(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2); + } + + // Move the print head close to the bed. + current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder); + st_synchronize(); + + // Home in the XY plane. + set_destination_to_current(); + setup_for_endstop_move(); + home_xy(); + + int8_t verbosity_level = 0; + if (code_seen('V')) { + // Just 'V' without a number counts as V1. + char c = strchr_pointer[1]; + verbosity_level = (c == ' ' || c == '\t' || c == 0) ? 1 : code_value_short(); + } + + if (onlyZ) { + clean_up_after_endstop_move(); + // Z only calibration. + // Load the machine correction matrix + world2machine_initialize(); + // and correct the current_position to match the transformed coordinate system. + world2machine_update_current(); + //FIXME + bool result = sample_mesh_and_store_reference(); + if (result) { + if (calibration_status() == CALIBRATION_STATUS_Z_CALIBRATION) + // Shipped, the nozzle height has been set already. The user can start printing now. + calibration_status_store(CALIBRATION_STATUS_CALIBRATED); + // babystep_apply(); + final_result = true; + } + } + else { + // 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); + // Complete XYZ calibration. + uint8_t point_too_far_mask = 0; + BedSkewOffsetDetectionResultType result = find_bed_offset_and_skew(verbosity_level, point_too_far_mask); + clean_up_after_endstop_move(); + // Print head up. + current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder); + st_synchronize(); + if (result >= 0) { + point_too_far_mask = 0; + // Second half: The fine adjustment. + // Let the planner use the uncorrected coordinates. + mbl.reset(); + world2machine_reset(); + // Home in the XY plane. + setup_for_endstop_move(); + home_xy(); + result = improve_bed_offset_and_skew(1, verbosity_level, point_too_far_mask); + clean_up_after_endstop_move(); + // Print head up. + current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder); + st_synchronize(); + // if (result >= 0) babystep_apply(); + } + lcd_bed_calibration_show_result(result, point_too_far_mask); + if (result >= 0) { + // Calibration valid, the machine should be able to print. Advise the user to run the V2Calibration.gcode. + calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST); + if(eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) != 1) lcd_show_fullscreen_message_and_wait_P(MSG_BABYSTEP_Z_NOT_SET); + final_result = true; + } + } + } + else { + // Timeouted. + KEEPALIVE_STATE(IN_HANDLER); + } + lcd_update_enable(true); + return final_result; +} + void process_commands() { #ifdef FILAMENT_RUNOUT_SUPPORT @@ -3468,13 +3638,14 @@ void process_commands() calibration_status_store(CALIBRATION_STATUS_CALIBRATED); break; - /** - * G88: Prusa3D specific: Don't know what it is for, it is in V2Calibration.gcode - */ - case 88: - break; - - + case 88: //just for test + SERIAL_ECHOPGM("Calibration status:"); + MYSERIAL.println(int(calibration_status())); + if (code_seen('S')) codenum = code_value(); + calibration_status_store(codenum); + SERIAL_ECHOPGM("Calibration status:"); + MYSERIAL.println(int(calibration_status())); + break; #endif // ENABLE_MESH_BED_LEVELING @@ -3772,114 +3943,8 @@ void process_commands() case 45: // M45: Prusa3D: bed skew and offset with manual Z up { // Only Z calibration? - bool onlyZ = code_seen('Z'); - if (!onlyZ) { - setTargetBed(0); - setTargetHotend(0, 0); - setTargetHotend(0, 1); - setTargetHotend(0, 2); - adjust_bed_reset(); //reset bed level correction - } - - // Disable the default update procedure of the display. We will do a modal dialog. - lcd_update_enable(false); - // Let the planner use the uncorrected coordinates. - mbl.reset(); - // Reset world2machine_rotation_and_skew and world2machine_shift, therefore - // the planner will not perform any adjustments in the XY plane. - // Wait for the motors to stop and update the current position with the absolute values. - world2machine_revert_to_uncorrected(); - // Reset the baby step value applied without moving the axes. - babystep_reset(); - // Mark all axes as in a need for homing. - memset(axis_known_position, 0, sizeof(axis_known_position)); - - // Let the user move the Z axes up to the end stoppers. - KEEPALIVE_STATE(PAUSED_FOR_USER); - if (lcd_calibrate_z_end_stop_manual( onlyZ )) { - KEEPALIVE_STATE(IN_HANDLER); - refresh_cmd_timeout(); - if (((degHotend(0) > MAX_HOTEND_TEMP_CALIBRATION) || (degBed() > MAX_BED_TEMP_CALIBRATION)) && (!onlyZ)) { - lcd_wait_for_cool_down(); - lcd_show_fullscreen_message_and_wait_P(MSG_PAPER); - lcd_display_message_fullscreen_P(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1); - lcd_implementation_print_at(0, 2, 1); - lcd_printPGM(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2); - } - - // Move the print head close to the bed. - current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS],current_position[Z_AXIS] , current_position[E_AXIS], homing_feedrate[Z_AXIS]/40, active_extruder); - st_synchronize(); - - // Home in the XY plane. - set_destination_to_current(); - setup_for_endstop_move(); - home_xy(); - - int8_t verbosity_level = 0; - if (code_seen('V')) { - // Just 'V' without a number counts as V1. - char c = strchr_pointer[1]; - verbosity_level = (c == ' ' || c == '\t' || c == 0) ? 1 : code_value_short(); - } - - if (onlyZ) { - clean_up_after_endstop_move(); - // Z only calibration. - // Load the machine correction matrix - world2machine_initialize(); - // and correct the current_position to match the transformed coordinate system. - world2machine_update_current(); - //FIXME - bool result = sample_mesh_and_store_reference(); - if (result) { - if (calibration_status() == CALIBRATION_STATUS_Z_CALIBRATION) - // Shipped, the nozzle height has been set already. The user can start printing now. - calibration_status_store(CALIBRATION_STATUS_CALIBRATED); - // babystep_apply(); - } - } else { - // 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); - // Complete XYZ calibration. - uint8_t point_too_far_mask = 0; - BedSkewOffsetDetectionResultType result = find_bed_offset_and_skew(verbosity_level, point_too_far_mask); - clean_up_after_endstop_move(); - // Print head up. - current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS],current_position[Z_AXIS] , current_position[E_AXIS], homing_feedrate[Z_AXIS]/40, active_extruder); - st_synchronize(); - if (result >= 0) { - point_too_far_mask = 0; - // Second half: The fine adjustment. - // Let the planner use the uncorrected coordinates. - mbl.reset(); - world2machine_reset(); - // Home in the XY plane. - setup_for_endstop_move(); - home_xy(); - result = improve_bed_offset_and_skew(1, verbosity_level, point_too_far_mask); - clean_up_after_endstop_move(); - // Print head up. - current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS],current_position[Z_AXIS] , current_position[E_AXIS], homing_feedrate[Z_AXIS]/40, active_extruder); - st_synchronize(); - // if (result >= 0) babystep_apply(); - } - lcd_bed_calibration_show_result(result, point_too_far_mask); - if (result >= 0) { - // Calibration valid, the machine should be able to print. Advise the user to run the V2Calibration.gcode. - calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST); - lcd_show_fullscreen_message_and_wait_P(MSG_BABYSTEP_Z_NOT_SET); - } - } - } else { - // Timeouted. - KEEPALIVE_STATE(IN_HANDLER); - } - lcd_update_enable(true); + bool only_Z = code_seen('Z'); + gcode_M45(only_Z); break; } @@ -5633,41 +5698,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp break; case 701: //M701: load filament { -#ifdef SNMM - extr_adj(snmm_extruder);//loads current extruder -#else - enable_z(); - custom_message = true; - custom_message_type = 2; - - lcd_setstatuspgm(MSG_LOADING_FILAMENT); - current_position[E_AXIS] += 70; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence - - current_position[E_AXIS] += 25; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 100 / 60, active_extruder); //slow sequence - st_synchronize(); - - if (!farm_mode && loading_flag) { - bool clean = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILAMENT_CLEAN, false, true); - - while (!clean) { - lcd_update_enable(true); - lcd_update(2); - current_position[E_AXIS] += 25; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 100 / 60, active_extruder); //slow sequence - st_synchronize(); - clean = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILAMENT_CLEAN, false, true); - } - } - lcd_update_enable(true); - lcd_update(2); - lcd_setstatuspgm(WELCOME_MSG); - disable_z(); - loading_flag = false; - custom_message = false; - custom_message_type = 0; -#endif + gcode_M701(); } break; case 702: diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index 7035a2d8f..756682e25 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -3422,6 +3422,11 @@ const char * const MSG_USERWAIT_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_USERWAIT_DE }; +const char MSG_V2_CALIBRATION_EN[] PROGMEM = "First layer cal."; +const char * const MSG_V2_CALIBRATION_LANG_TABLE[1] PROGMEM = { + MSG_V2_CALIBRATION_EN +}; + const char MSG_VMIN_EN[] PROGMEM = "Vmin"; const char * const MSG_VMIN_LANG_TABLE[1] PROGMEM = { MSG_VMIN_EN @@ -3477,6 +3482,86 @@ const char * const MSG_WATCHDOG_RESET_LANG_TABLE[1] PROGMEM = { MSG_WATCHDOG_RESET_EN }; +const char MSG_WIZARD_EN[] PROGMEM = "Wizard"; +const char * const MSG_WIZARD_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_EN +}; + +const char MSG_WIZARD_DONE_EN[] PROGMEM = "All is done. Happy printing!"; +const char * const MSG_WIZARD_DONE_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_DONE_EN +}; + +const char MSG_WIZARD_FILAMENT_LOADED_EN[] PROGMEM = "Is filament loaded?"; +const char * const MSG_WIZARD_FILAMENT_LOADED_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_FILAMENT_LOADED_EN +}; + +const char MSG_WIZARD_HEATING_EN[] PROGMEM = "Preheating nozzle. Please wait."; +const char * const MSG_WIZARD_HEATING_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_HEATING_EN +}; + +const char MSG_WIZARD_LANGUAGE_EN[] PROGMEM = "Please choose your language"; +const char * const MSG_WIZARD_LANGUAGE_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_LANGUAGE_EN +}; + +const char MSG_WIZARD_LOAD_FILAMENT_EN[] PROGMEM = "Please insert PLA filament to the extruder, then press knob to load it."; +const char * const MSG_WIZARD_LOAD_FILAMENT_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_LOAD_FILAMENT_EN +}; + +const char MSG_WIZARD_QUIT_EN[] PROGMEM = "You can always resume the Wizard from Setting->Wizard."; +const char * const MSG_WIZARD_QUIT_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_QUIT_EN +}; + +const char MSG_WIZARD_RERUN_EN[] PROGMEM = "Running Wizard will delete current calibration results and start from the beginning. Continue?"; +const char * const MSG_WIZARD_RERUN_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_RERUN_EN +}; + +const char MSG_WIZARD_SELFTEST_EN[] PROGMEM = "First, I will run the selftest to check most common assembly problems."; +const char * const MSG_WIZARD_SELFTEST_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_SELFTEST_EN +}; + +const char MSG_WIZARD_SELFTEST_FAILED_EN[] PROGMEM = "Wizard: selftest failed"; +const char * const MSG_WIZARD_SELFTEST_FAILED_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_SELFTEST_FAILED_EN +}; + +const char MSG_WIZARD_V2_CAL_EN[] PROGMEM = "Now I will calibrate distance between tip of the nozzle and heatbed surface."; +const char * const MSG_WIZARD_V2_CAL_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_V2_CAL_EN +}; + +const char MSG_WIZARD_V2_CAL_2_EN[] PROGMEM = "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."; +const char * const MSG_WIZARD_V2_CAL_2_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_V2_CAL_2_EN +}; + +const char MSG_WIZARD_WELCOME_EN[] PROGMEM = "Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?"; +const char * const MSG_WIZARD_WELCOME_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_WELCOME_EN +}; + +const char MSG_WIZARD_WILL_PREHEAT_EN[] PROGMEM = "No I will preheat nozzle for PLA."; +const char * const MSG_WIZARD_WILL_PREHEAT_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_WILL_PREHEAT_EN +}; + +const char MSG_WIZARD_XYZ_CAL_EN[] PROGMEM = "I will run xyz calibration now\x85 It will take approx. 12 mins."; +const char * const MSG_WIZARD_XYZ_CAL_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_XYZ_CAL_EN +}; + +const char MSG_WIZARD_Z_CAL_EN[] PROGMEM = "I will run z calibration now\x85"; +const char * const MSG_WIZARD_Z_CAL_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_Z_CAL_EN +}; + const char MSG_XYZ_DETAILS_EN[] PROGMEM = "XYZ cal. details"; const char MSG_XYZ_DETAILS_CZ[] PROGMEM = "Detaily XYZ kal."; const char MSG_XYZ_DETAILS_IT[] PROGMEM = "XYZ Cal. dettagli"; diff --git a/Firmware/language_all.h b/Firmware/language_all.h index 209c4954a..1d42ea290 100644 --- a/Firmware/language_all.h +++ b/Firmware/language_all.h @@ -626,6 +626,8 @@ extern const char* const MSG_USED_LANG_TABLE[LANG_NUM]; #define MSG_USED LANG_TABLE_SELECT(MSG_USED_LANG_TABLE) extern const char* const MSG_USERWAIT_LANG_TABLE[LANG_NUM]; #define MSG_USERWAIT LANG_TABLE_SELECT(MSG_USERWAIT_LANG_TABLE) +extern const char* const MSG_V2_CALIBRATION_LANG_TABLE[1]; +#define MSG_V2_CALIBRATION LANG_TABLE_SELECT_EXPLICIT(MSG_V2_CALIBRATION_LANG_TABLE, 0) extern const char* const MSG_VMIN_LANG_TABLE[1]; #define MSG_VMIN LANG_TABLE_SELECT_EXPLICIT(MSG_VMIN_LANG_TABLE, 0) extern const char* const MSG_VOLUMETRIC_LANG_TABLE[1]; @@ -640,6 +642,38 @@ extern const char* const MSG_WATCH_LANG_TABLE[LANG_NUM]; #define MSG_WATCH LANG_TABLE_SELECT(MSG_WATCH_LANG_TABLE) extern const char* const MSG_WATCHDOG_RESET_LANG_TABLE[1]; #define MSG_WATCHDOG_RESET LANG_TABLE_SELECT_EXPLICIT(MSG_WATCHDOG_RESET_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_LANG_TABLE[1]; +#define MSG_WIZARD LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_DONE_LANG_TABLE[1]; +#define MSG_WIZARD_DONE LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_DONE_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_FILAMENT_LOADED_LANG_TABLE[1]; +#define MSG_WIZARD_FILAMENT_LOADED LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_FILAMENT_LOADED_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_HEATING_LANG_TABLE[1]; +#define MSG_WIZARD_HEATING LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_HEATING_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_LANGUAGE_LANG_TABLE[1]; +#define MSG_WIZARD_LANGUAGE LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_LANGUAGE_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_LOAD_FILAMENT_LANG_TABLE[1]; +#define MSG_WIZARD_LOAD_FILAMENT LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_LOAD_FILAMENT_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_QUIT_LANG_TABLE[1]; +#define MSG_WIZARD_QUIT LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_QUIT_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_RERUN_LANG_TABLE[1]; +#define MSG_WIZARD_RERUN LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_RERUN_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_SELFTEST_LANG_TABLE[1]; +#define MSG_WIZARD_SELFTEST LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_SELFTEST_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_SELFTEST_FAILED_LANG_TABLE[1]; +#define MSG_WIZARD_SELFTEST_FAILED LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_SELFTEST_FAILED_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_V2_CAL_LANG_TABLE[1]; +#define MSG_WIZARD_V2_CAL LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_V2_CAL_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_V2_CAL_2_LANG_TABLE[1]; +#define MSG_WIZARD_V2_CAL_2 LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_V2_CAL_2_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_WELCOME_LANG_TABLE[1]; +#define MSG_WIZARD_WELCOME LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_WELCOME_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_WILL_PREHEAT_LANG_TABLE[1]; +#define MSG_WIZARD_WILL_PREHEAT LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_WILL_PREHEAT_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_XYZ_CAL_LANG_TABLE[1]; +#define MSG_WIZARD_XYZ_CAL LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_XYZ_CAL_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_Z_CAL_LANG_TABLE[1]; +#define MSG_WIZARD_Z_CAL LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_Z_CAL_LANG_TABLE, 0) extern const char* const MSG_XYZ_DETAILS_LANG_TABLE[LANG_NUM]; #define MSG_XYZ_DETAILS LANG_TABLE_SELECT(MSG_XYZ_DETAILS_LANG_TABLE) extern const char* const MSG_X_MAX_LANG_TABLE[1]; diff --git a/Firmware/language_en.h b/Firmware/language_en.h index 1afea9f31..b97c49b49 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -317,5 +317,19 @@ #define(length=17, lines=1) MSG_SORT_NONE "Sort: [None]" #define(length=20, lines=1) MSG_SORTING "Sorting files" #define(length=17, lines=1) MSG_WIZARD "Wizard" -#define MSG_WIZARD_LANGUAGE "Please choose your language" -#define MSG_WIZARD_WELCOME "Hi, I’m your new Original Prusa i3 printer. Would you like me to guide you through the setup process?" \ No newline at end of file +#define MSG_WIZARD_LANGUAGE "Please choose your language" +#define MSG_WIZARD_WELCOME "Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?" +#define MSG_WIZARD_QUIT "You can always resume the Wizard from Calibration -> Wizard." +#define MSG_WIZARD_SELFTEST "First, I will run the selftest to check most common assembly problems." +#define MSG_WIZARD_CALIBRATION_FAILED "Please check our handbook and fix the problem. Then resume the Wizard by rebooting the printer." +#define MSG_WIZARD_XYZ_CAL "I will run xyz calibration now… It will take approx. 12 mins." +#define MSG_WIZARD_FILAMENT_LOADED "Is filament loaded?" +#define MSG_WIZARD_Z_CAL "I will run z calibration now…" +#define MSG_WIZARD_WILL_PREHEAT "No I will preheat nozzle for PLA." +#define MSG_WIZARD_HEATING "Preheating nozzle. Please wait." +#define MSG_WIZARD_V2_CAL "Now I will calibrate distance between tip of the nozzle and heatbed surface." +#define MSG_WIZARD_V2_CAL_2 "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." +#define MSG_V2_CALIBRATION "First layer cal." +#define MSG_WIZARD_DONE "All is done. Happy printing!" +#define MSG_WIZARD_LOAD_FILAMENT "Please insert PLA filament to the extruder, then press knob to load it." +#define MSG_WIZARD_RERUN "Running Wizard will delete current calibration results and start from the beginning. Continue?" diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index ba1a6a165..5ca340c16 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -590,6 +590,109 @@ void lcd_commands() } } + if (lcd_commands_type == LCD_COMMAND_V2_CAL) + { + lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; + if (lcd_commands_step == 0) + { + lcd_commands_step = 5; + } + if (lcd_commands_step == 5 && !blocks_queued() && cmd_buffer_empty()) + { + enquecommand_P(PSTR("M107")); + enquecommand_P(PSTR("M104 S210")); + enquecommand_P(PSTR("M140 S55")); + enquecommand_P(PSTR("M190 S55")); + enquecommand_P(PSTR("M109 S210")); + enquecommand_P(PSTR("M117 First layer cal.")); + enquecommand_P(PSTR("G87")); //sets calibration status + enquecommand_P(PSTR("G28")); + enquecommand_P(PSTR("G92 E0.0")); + lcd_commands_step = 4; + } + if (lcd_commands_step == 4 && !blocks_queued() && cmd_buffer_empty()) + { + + lcd_implementation_clear(); + lcd_goto_menu(lcd_babystep_z, 0, false); + enquecommand_P(PSTR("G1 X60.0 E9.0 F1000.0")); //intro line + enquecommand_P(PSTR("G1 X100.0 E12.5 F1000.0")); //intro line + enquecommand_P(PSTR("G92 E0.0")); + enquecommand_P(PSTR("G21")); //set units to millimeters + enquecommand_P(PSTR("G90")); //use absolute coordinates + enquecommand_P(PSTR("M83")); //use relative distances for extrusion + enquecommand_P(PSTR("G1 E - 1.50000 F2100.00000")); + enquecommand_P(PSTR("G1 Z0.150 F7200.000")); + enquecommand_P(PSTR("M204 S1000")); //set acceleration + enquecommand_P(PSTR("G1 F4000")); + lcd_commands_step = 3; + } + if (lcd_commands_step == 3 && !blocks_queued() && cmd_buffer_empty()) //draw meander + { + lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; + + + //just opposite direction + /*enquecommand_P(PSTR("G1 X50 Y55")); + enquecommand_P(PSTR("G1 F1080")); + enquecommand_P(PSTR("G1 X200 Y55 E3.62773")); + enquecommand_P(PSTR("G1 X200 Y75 E0.49386")); + enquecommand_P(PSTR("G1 X50 Y75 E3.62773")); + enquecommand_P(PSTR("G1 X50 Y95 E0.49386")); + enquecommand_P(PSTR("G1 X200 Y95 E3.62773")); + enquecommand_P(PSTR("G1 X200 Y115 E0.49386")); + enquecommand_P(PSTR("G1 X50 Y115 E3.62773")); + enquecommand_P(PSTR("G1 X50 Y135 E0.49386")); + enquecommand_P(PSTR("G1 X200 Y135 E3.62773")); + enquecommand_P(PSTR("G1 X200 Y155 E0.66174")); + enquecommand_P(PSTR("G1 X100 Y155 E2.62773")); + enquecommand_P(PSTR("G1 X75 Y155 E2")); + enquecommand_P(PSTR("G1 X50 Y155 E2.5")); + enquecommand_P(PSTR("G1 E - 0.07500 F2100.00000"));*/ + + + enquecommand_P(PSTR("G1 X50 Y155")); + enquecommand_P(PSTR("G1 F1080")); + enquecommand_P(PSTR("G1 X75 Y155 E2.5")); + enquecommand_P(PSTR("G1 X100 Y155 E2")); + enquecommand_P(PSTR("G1 X200 Y155 E2.62773")); + enquecommand_P(PSTR("G1 X200 Y135 E0.66174")); + enquecommand_P(PSTR("G1 X50 Y135 E3.62773")); + enquecommand_P(PSTR("G1 X50 Y115 E0.49386")); + enquecommand_P(PSTR("G1 X200 Y115 E3.62773")); + enquecommand_P(PSTR("G1 X200 Y95 E0.49386")); + enquecommand_P(PSTR("G1 X50 Y95 E3.62773")); + enquecommand_P(PSTR("G1 X50 Y75 E0.49386")); + enquecommand_P(PSTR("G1 X200 Y75 E3.62773")); + enquecommand_P(PSTR("G1 X200 Y55 E0.49386")); + enquecommand_P(PSTR("G1 X50 Y55 E3.62773")); + enquecommand_P(PSTR("G1 E - 0.07500 F2100.00000")); + lcd_commands_step = 2; + } + + if (lcd_commands_step == 2 && !blocks_queued() && cmd_buffer_empty()) + { + lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; + enquecommand_P(PSTR("M107")); //turn off printer fan + enquecommand_P(PSTR("M104 S0")); // turn off temperature + enquecommand_P(PSTR("M140 S0")); // turn off heatbed + enquecommand_P(PSTR("G1 Z10 F1300.000")); + enquecommand_P(PSTR("G1 X10 Y180 F4000")); //home X axis + enquecommand_P(PSTR("M84"));// disable motors + lcd_commands_step = 1; + } + if (lcd_commands_step == 1 && !blocks_queued() && cmd_buffer_empty()) + { + lcd_setstatuspgm(WELCOME_MSG); + lcd_commands_step = 0; + lcd_commands_type = 0; + if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) { + lcd_wizard(9); + } + } + + } + if (lcd_commands_type == LCD_COMMAND_STOP_PRINT) /// stop print { uint8_t stopped_extruder; @@ -1906,6 +2009,73 @@ void lcd_wait_for_click() } } +int8_t lcd_show_multiscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting, bool default_yes) //currently just max. n*4 + 3 lines supported (set in language header files) +{ + const char *msg_next = lcd_display_message_fullscreen_P(msg); + bool multi_screen = msg_next != NULL; + bool yes = default_yes ? true : false; + + // Wait for user confirmation or a timeout. + unsigned long previous_millis_cmd = millis(); + int8_t enc_dif = encoderDiff; + KEEPALIVE_STATE(PAUSED_FOR_USER); + for (;;) { + for (uint8_t i = 0; i < 100; ++i) { + delay_keep_alive(50); + if (allow_timeouting && millis() - previous_millis_cmd > LCD_TIMEOUT_TO_STATUS) + return -1; + manage_heater(); + manage_inactivity(true); + + if (abs(enc_dif - encoderDiff) > 4) { + if (msg_next == NULL) { + lcd.setCursor(0, 3); + if (enc_dif < encoderDiff && yes) { + lcd_printPGM((PSTR(" "))); + lcd.setCursor(7, 3); + lcd_printPGM((PSTR(">"))); + yes = false; + } + else if (enc_dif > encoderDiff && !yes) { + lcd_printPGM((PSTR(">"))); + lcd.setCursor(7, 3); + lcd_printPGM((PSTR(" "))); + yes = true; + } + enc_dif = encoderDiff; + } + else { + break; //turning knob skips waiting loop + } + } + if (lcd_clicked()) { + while (lcd_clicked()); + delay(10); + while (lcd_clicked()); + KEEPALIVE_STATE(IN_HANDLER); + if(msg_next == NULL) return yes; + else break; + } + } + if (multi_screen) { + if (msg_next == NULL) { + msg_next = msg; + } + msg_next = lcd_display_message_fullscreen_P(msg_next); + } + if (msg_next == NULL){ + lcd.setCursor(0, 3); + if (yes) lcd_printPGM(PSTR(">")); + lcd.setCursor(1, 3); + lcd_printPGM(MSG_YES); + lcd.setCursor(7, 3); + if (!yes) lcd_printPGM(PSTR(">")); + lcd.setCursor(8, 3); + lcd_printPGM(MSG_NO); + } + } +} + int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting, bool default_yes) { lcd_display_message_fullscreen_P(msg); @@ -2618,6 +2788,185 @@ void lcd_toshiba_flash_air_compatibility_toggle() eeprom_update_byte((uint8_t*)EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY, card.ToshibaFlashAir_isEnabled()); } +void lcd_v2_calibration() { + lcd_commands_type = LCD_COMMAND_V2_CAL; + lcd_return_to_status(); +} + +void lcd_wizard() { + bool result = true; + if(calibration_status() != CALIBRATION_STATUS_ASSEMBLED){ + result = lcd_show_multiscreen_message_yes_no_and_wait_P(MSG_WIZARD_RERUN, true ,false); + } + if (result) { + calibration_status_store(CALIBRATION_STATUS_ASSEMBLED); + lcd_wizard(0); + } + else { + lcd_update_enable(true); + lcd_update(2); + } +} + +void lcd_wizard(int state) { + + /* + if (eeprom_read_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE) == 255) { + eeprom_write_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE, 0); + */ + eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); + +#define WIZARD_END 255 + + //int state = 0; + bool end = false; + int wizard_event; + const char *msg = NULL; + + while (!end) { + switch (state) { + case 0: // run wizard? + wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(MSG_WIZARD_WELCOME, false, true); + if (wizard_event) { + state = 1; + //eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); + }else end = true; + break; + case 1: // restore calibration status + + switch (calibration_status()) { + case CALIBRATION_STATUS_ASSEMBLED: state = 2; break; //run selftest + case CALIBRATION_STATUS_XYZ_CALIBRATION: state = 3; break; //run xyz cal. + case CALIBRATION_STATUS_Z_CALIBRATION: state = 4; break; //run z cal. + case CALIBRATION_STATUS_LIVE_ADJUST: state = 5; break; //run live adjust + case CALIBRATION_STATUS_CALIBRATED: end = true; break; + default: state = 2; break; //if calibration status is unknown, run wizard from the beginning + } + case 2: //selftest + lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_SELFTEST); + wizard_event = lcd_selftest(); + if (wizard_event) state = 3; + else end = true; + break; + case 3: //xyz cal. + lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_XYZ_CAL); + wizard_event = gcode_M45(false); + if (wizard_event) state = 5; + else end = true; + break; + case 4: //z cal. + lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_Z_CAL); + wizard_event = gcode_M45(true); + if (wizard_event) state = 9; //shipped, no need to set first layer, go to final message directly + else end = true; + break; + case 5: //is filament loaded? + //start to preheat nozzle and bed to save some time later + setTargetHotend(PLA_PREHEAT_HOTEND_TEMP, 0); + setTargetBed(PLA_PREHEAT_HPB_TEMP); + wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_WIZARD_FILAMENT_LOADED, false); + if (wizard_event) state = 8; + else state = 6; + break; + case 6: //waiting for preheat nozzle for PLA; + lcd_display_message_fullscreen_P(MSG_WIZARD_WILL_PREHEAT); + delay_keep_alive(2000); + lcd_display_message_fullscreen_P(MSG_WIZARD_HEATING); + while (abs(degHotend(0) - PLA_PREHEAT_HOTEND_TEMP) > 3) { + lcd_display_message_fullscreen_P(MSG_WIZARD_HEATING); + + lcd.setCursor(0, 4); + lcd.print(LCD_STR_THERMOMETER[0]); + lcd.print(ftostr3(degHotend(0))); + lcd.print("/"); + lcd.print(PLA_PREHEAT_HOTEND_TEMP); + lcd.print(LCD_STR_DEGREE); + lcd_set_custom_characters(); + delay_keep_alive(1000); + } + state = 7; + break; + case 7: //load filament + lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_LOAD_FILAMENT); + lcd_implementation_clear(); + lcd_print_at_PGM(0,2,MSG_LOADING_FILAMENT); + loading_flag = true; + gcode_M701(); + state = 8; + break; + case 8: + lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_V2_CAL); + lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_V2_CAL_2); + lcd_commands_type = LCD_COMMAND_V2_CAL; + end = true; + break; + case 9: //we are finished + eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); + end = true; + break; + + /* + // Freshly assembled, needs to peform a self-test and the XYZ calibration. + CALIBRATION_STATUS_ASSEMBLED = 255, + + // For the wizard: self test has been performed, now the XYZ calibration is needed. + CALIBRATION_STATUS_XYZ_CALIBRATION = 250, + + // For the wizard: factory assembled, needs to run Z calibration. + CALIBRATION_STATUS_Z_CALIBRATION = 240, + + // The XYZ calibration has been performed, now it remains to run the V2Calibration.gcode. + CALIBRATION_STATUS_LIVE_ADJUST = 230, + + // Calibrated, ready to print. + CALIBRATION_STATUS_CALIBRATED = 1, + + // Legacy: resetted by issuing a G86 G-code. + // This value can only be expected after an upgrade from the initial MK2 firmware releases. + // Currently the G86 sets the calibration status to + CALIBRATION_STATUS_UNKNOWN = 0, + */ + + default: break; + } + } + + SERIAL_ECHOPGM("State: "); + MYSERIAL.println(state); + switch (state) { //final message + case 0: //user dont want to use wizard + msg = MSG_WIZARD_QUIT; + break; + + case 1: //printer was already calibrated + msg = MSG_WIZARD_DONE; + break; + case 2: //selftest + msg = MSG_WIZARD_CALIBRATION_FAILED; + break; + case 3: //xyz cal. + msg = MSG_WIZARD_CALIBRATION_FAILED; + case 4: //z cal. + msg = MSG_WIZARD_CALIBRATION_FAILED; + case 8: break; //exit wizard for v2 calibration, which is implemted in lcd_commands (we need lcd_update running) + case 9: //we are finished + + msg = MSG_WIZARD_DONE; + lcd_reset_alert_level(); + lcd_setstatuspgm(WELCOME_MSG); + break; + + default: + lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_QUIT); + break; + + } + if(state != 8) lcd_show_fullscreen_message_and_wait_P(msg); + lcd_update_enable(true); + lcd_return_to_status(); + lcd_update(2); +} + static void lcd_settings_menu() { EEPROM_read(EEPROM_SILENT, (uint8_t*)&SilentModeMenu, sizeof(SilentModeMenu)); @@ -2677,9 +3026,10 @@ static void lcd_calibration_menu() MENU_ITEM(gcode, MSG_HOMEYZ, PSTR("G28 Z")); #else //MK1BP // MK2 -MENU_ITEM(function, MSG_CALIBRATE_BED, lcd_mesh_calibration); + MENU_ITEM(function, MSG_CALIBRATE_BED, lcd_mesh_calibration); // "Calibrate Z" with storing the reference values to EEPROM. MENU_ITEM(submenu, MSG_HOMEYZ, lcd_mesh_calibration_z); + MENU_ITEM(submenu, MSG_V2_CALIBRATION, lcd_v2_calibration); #ifndef SNMM //MENU_ITEM(function, MSG_CALIBRATE_E, lcd_calibrate_extruder); @@ -4346,7 +4696,7 @@ menu_edit_type(float, float51, ftostr51, 10) menu_edit_type(float, float52, ftostr52, 100) menu_edit_type(unsigned long, long5, ftostr5, 0.01) -static void lcd_selftest() +static bool lcd_selftest() { int _progress = 0; bool _result = false; @@ -4409,8 +4759,10 @@ static void lcd_selftest() current_position[Y_AXIS] = current_position[Y_AXIS] - 14; _progress = lcd_selftest_screen(4, _progress, 3, true, 1500); _result = lcd_selfcheck_axis(2, Z_MAX_POS); - enquecommand_P(PSTR("G28 W")); - enquecommand_P(PSTR("G1 Z15")); + if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) != 1) { + enquecommand_P(PSTR("G28 W")); + enquecommand_P(PSTR("G1 Z15")); + } } if (_result) @@ -4433,12 +4785,13 @@ static void lcd_selftest() if (_result) { - LCD_ALERTMESSAGERPGM(MSG_SELFTEST_OK); + LCD_ALERTMESSAGERPGM(MSG_SELFTEST_OK); } else { LCD_ALERTMESSAGERPGM(MSG_SELFTEST_FAILED); } + return(_result); } static bool lcd_selfcheck_axis(int _axis, int _travel) @@ -5221,6 +5574,7 @@ void lcd_update(uint8_t lcdDrawUpdateOverride) if (!SdFatUtil::test_stack_integrity()) stack_error(); lcd_ping(); //check that we have received ping command if we are in farm mode lcd_send_status(); + if (lcd_commands_type == LCD_COMMAND_V2_CAL) lcd_commands(); } void lcd_printer_connected() { diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 216752f98..7ff4ab805 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -33,7 +33,7 @@ void lcd_mylang(); bool lcd_detected(void); - static void lcd_selftest(); + static bool lcd_selftest(); static bool lcd_selfcheck_endstops(); static bool lcd_selfcheck_axis(int _axis, int _travel); static bool lcd_selfcheck_check_heater(bool _isbed); @@ -44,6 +44,7 @@ void lcd_mylang(); void lcd_menu_statistics(); static bool lcd_selfcheck_pulleys(int axis); + extern const char* lcd_display_message_fullscreen_P(const char *msg, uint8_t &nlines); inline const char* lcd_display_message_fullscreen_P(const char *msg) { uint8_t nlines; return lcd_display_message_fullscreen_P(msg, nlines); } @@ -52,7 +53,7 @@ void lcd_mylang(); extern void lcd_show_fullscreen_message_and_wait_P(const char *msg); // 0: no, 1: yes, -1: timeouted extern int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false); - + extern int8_t lcd_show_multiscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false); // Ask the user to move the Z axis up to the end stoppers and let // the user confirm that it has been done. extern bool lcd_calibrate_z_end_stop_manual(bool only_z); @@ -95,6 +96,7 @@ void lcd_mylang(); #define LCD_COMMAND_LONG_PAUSE 5 #define LCD_COMMAND_LONG_PAUSE_RESUME 6 #define LCD_COMMAND_PID_EXTRUDER 7 + #define LCD_COMMAND_V2_CAL 8 extern unsigned long lcd_timeoutToStatus; extern int lcd_commands_type; @@ -227,6 +229,7 @@ void extr_unload_all(); void extr_unload_used(); void extr_unload(); static char snmm_stop_print_menu(); +static void lcd_babystep_z(); #ifdef SDCARD_SORT_ALPHA static void lcd_sort_type_set(); #endif @@ -269,4 +272,7 @@ void lcd_set_progress(); static void lcd_send_status(); static void lcd_connect_printer(); +void lcd_wizard(); +void lcd_wizard(int state); + #endif //ULTRALCD_H \ No newline at end of file From 29f6033bdb0d81435cb74eb7d4354698e07132de Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 8 Sep 2017 11:20:41 +0200 Subject: [PATCH 03/14] message added --- Firmware/language_all.cpp | 12 ++++++------ Firmware/language_all.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index 756682e25..03a4eac69 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -3487,6 +3487,11 @@ const char * const MSG_WIZARD_LANG_TABLE[1] PROGMEM = { MSG_WIZARD_EN }; +const char MSG_WIZARD_CALIBRATION_FAILED_EN[] PROGMEM = "Please check our handbook and fix the problem. Then resume the Wizard by rebooting the printer."; +const char * const MSG_WIZARD_CALIBRATION_FAILED_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_CALIBRATION_FAILED_EN +}; + const char MSG_WIZARD_DONE_EN[] PROGMEM = "All is done. Happy printing!"; const char * const MSG_WIZARD_DONE_LANG_TABLE[1] PROGMEM = { MSG_WIZARD_DONE_EN @@ -3512,7 +3517,7 @@ const char * const MSG_WIZARD_LOAD_FILAMENT_LANG_TABLE[1] PROGMEM = { MSG_WIZARD_LOAD_FILAMENT_EN }; -const char MSG_WIZARD_QUIT_EN[] PROGMEM = "You can always resume the Wizard from Setting->Wizard."; +const char MSG_WIZARD_QUIT_EN[] PROGMEM = "You can always resume the Wizard from Calibration -> Wizard."; const char * const MSG_WIZARD_QUIT_LANG_TABLE[1] PROGMEM = { MSG_WIZARD_QUIT_EN }; @@ -3527,11 +3532,6 @@ const char * const MSG_WIZARD_SELFTEST_LANG_TABLE[1] PROGMEM = { MSG_WIZARD_SELFTEST_EN }; -const char MSG_WIZARD_SELFTEST_FAILED_EN[] PROGMEM = "Wizard: selftest failed"; -const char * const MSG_WIZARD_SELFTEST_FAILED_LANG_TABLE[1] PROGMEM = { - MSG_WIZARD_SELFTEST_FAILED_EN -}; - const char MSG_WIZARD_V2_CAL_EN[] PROGMEM = "Now I will calibrate distance between tip of the nozzle and heatbed surface."; const char * const MSG_WIZARD_V2_CAL_LANG_TABLE[1] PROGMEM = { MSG_WIZARD_V2_CAL_EN diff --git a/Firmware/language_all.h b/Firmware/language_all.h index 1d42ea290..012e24d9e 100644 --- a/Firmware/language_all.h +++ b/Firmware/language_all.h @@ -644,6 +644,8 @@ extern const char* const MSG_WATCHDOG_RESET_LANG_TABLE[1]; #define MSG_WATCHDOG_RESET LANG_TABLE_SELECT_EXPLICIT(MSG_WATCHDOG_RESET_LANG_TABLE, 0) extern const char* const MSG_WIZARD_LANG_TABLE[1]; #define MSG_WIZARD LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_CALIBRATION_FAILED_LANG_TABLE[1]; +#define MSG_WIZARD_CALIBRATION_FAILED LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_CALIBRATION_FAILED_LANG_TABLE, 0) extern const char* const MSG_WIZARD_DONE_LANG_TABLE[1]; #define MSG_WIZARD_DONE LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_DONE_LANG_TABLE, 0) extern const char* const MSG_WIZARD_FILAMENT_LOADED_LANG_TABLE[1]; @@ -660,8 +662,6 @@ extern const char* const MSG_WIZARD_RERUN_LANG_TABLE[1]; #define MSG_WIZARD_RERUN LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_RERUN_LANG_TABLE, 0) extern const char* const MSG_WIZARD_SELFTEST_LANG_TABLE[1]; #define MSG_WIZARD_SELFTEST LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_SELFTEST_LANG_TABLE, 0) -extern const char* const MSG_WIZARD_SELFTEST_FAILED_LANG_TABLE[1]; -#define MSG_WIZARD_SELFTEST_FAILED LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_SELFTEST_FAILED_LANG_TABLE, 0) extern const char* const MSG_WIZARD_V2_CAL_LANG_TABLE[1]; #define MSG_WIZARD_V2_CAL LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_V2_CAL_LANG_TABLE, 0) extern const char* const MSG_WIZARD_V2_CAL_2_LANG_TABLE[1]; From 7b407b2aba74d085cfddf46040660f65f04a31fe Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 8 Sep 2017 15:22:42 +0200 Subject: [PATCH 04/14] run wizard after printer startup just in case, that it is freshly build machine --- Firmware/Marlin_main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 66a53dd79..bf3ac1806 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1206,6 +1206,8 @@ void setup() // EEPROM_LANG to number lower than 0x0ff. // 1) Set a high power mode. eeprom_write_byte((uint8_t*)EEPROM_SILENT, 0); + eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); //run wizard + } #ifdef SNMM if (eeprom_read_dword((uint32_t*)EEPROM_BOWDEN_LENGTH) == 0x0ffffffff) { //bowden length used for SNMM @@ -1237,8 +1239,7 @@ void setup() #ifndef DEBUG_DISABLE_STARTMSGS check_babystep(); //checking if Z babystep is in allowed range - if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 255) { - eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); + if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) { lcd_wizard(0); } else if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 0) { //dont show calibration status messages if wizard is currently active From 92d09efb012e46d9d872fff37fdc48d8d75ae2c8 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 8 Sep 2017 17:20:16 +0200 Subject: [PATCH 05/14] start using CALIBRATION_STATUS_XYZ_CALIBRATION --- Firmware/Marlin_main.cpp | 7 ++++-- Firmware/ultralcd.cpp | 47 ++++++++++------------------------------ 2 files changed, 17 insertions(+), 37 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index bf3ac1806..f048360f8 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1245,7 +1245,8 @@ void setup() else if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 0) { //dont show calibration status messages if wizard is currently active if (calibration_status() == CALIBRATION_STATUS_ASSEMBLED || - calibration_status() == CALIBRATION_STATUS_UNKNOWN) { + 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); // Show the message. @@ -3639,14 +3640,16 @@ void process_commands() calibration_status_store(CALIBRATION_STATUS_CALIBRATED); break; - case 88: //just for test + /*case 88: //just for test SERIAL_ECHOPGM("Calibration status:"); MYSERIAL.println(int(calibration_status())); if (code_seen('S')) codenum = code_value(); calibration_status_store(codenum); SERIAL_ECHOPGM("Calibration status:"); MYSERIAL.println(int(calibration_status())); + eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); //run wizard break; + */ #endif // ENABLE_MESH_BED_LEVELING diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5ca340c16..075d39b95 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2810,30 +2810,25 @@ void lcd_wizard() { void lcd_wizard(int state) { - /* - if (eeprom_read_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE) == 255) { - eeprom_write_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE, 0); - */ - eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); -#define WIZARD_END 255 - //int state = 0; bool end = false; int wizard_event; const char *msg = NULL; - while (!end) { switch (state) { case 0: // run wizard? wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(MSG_WIZARD_WELCOME, false, true); if (wizard_event) { state = 1; - //eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); - }else end = true; + eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); + } + else { + eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); + end = true; + } break; case 1: // restore calibration status - switch (calibration_status()) { case CALIBRATION_STATUS_ASSEMBLED: state = 2; break; //run selftest case CALIBRATION_STATUS_XYZ_CALIBRATION: state = 3; break; //run xyz cal. @@ -2842,10 +2837,14 @@ void lcd_wizard(int state) { case CALIBRATION_STATUS_CALIBRATED: end = true; break; default: state = 2; break; //if calibration status is unknown, run wizard from the beginning } + break; case 2: //selftest lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_SELFTEST); wizard_event = lcd_selftest(); - if (wizard_event) state = 3; + if (wizard_event) { + calibration_status_store(CALIBRATION_STATUS_XYZ_CALIBRATION); + state = 3; + } else end = true; break; case 3: //xyz cal. @@ -2905,28 +2904,6 @@ void lcd_wizard(int state) { end = true; break; - /* - // Freshly assembled, needs to peform a self-test and the XYZ calibration. - CALIBRATION_STATUS_ASSEMBLED = 255, - - // For the wizard: self test has been performed, now the XYZ calibration is needed. - CALIBRATION_STATUS_XYZ_CALIBRATION = 250, - - // For the wizard: factory assembled, needs to run Z calibration. - CALIBRATION_STATUS_Z_CALIBRATION = 240, - - // The XYZ calibration has been performed, now it remains to run the V2Calibration.gcode. - CALIBRATION_STATUS_LIVE_ADJUST = 230, - - // Calibrated, ready to print. - CALIBRATION_STATUS_CALIBRATED = 1, - - // Legacy: resetted by issuing a G86 G-code. - // This value can only be expected after an upgrade from the initial MK2 firmware releases. - // Currently the G86 sets the calibration status to - CALIBRATION_STATUS_UNKNOWN = 0, - */ - default: break; } } @@ -2957,7 +2934,7 @@ void lcd_wizard(int state) { break; default: - lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_QUIT); + msg = MSG_WIZARD_QUIT; break; } From dba7d51fc2cd0267de13232a8fb609b518a69b63 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 8 Sep 2017 17:27:38 +0200 Subject: [PATCH 06/14] version changed, wizard moved to calibration menu --- Firmware/Configuration.h | 2 +- Firmware/ultralcd.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 2402f9070..0f8b2986a 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -5,7 +5,7 @@ #include "Configuration_prusa.h" // Firmware version -#define FW_version "3.0.12-6" +#define FW_version "3.0.12-7" #define FW_PRUSA3D_MAGIC "PRUSA3DFW" #define FW_PRUSA3D_MAGIC_LEN 10 diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 075d39b95..35c73a550 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2985,8 +2985,6 @@ static void lcd_settings_menu() MENU_ITEM(function, PSTR("Disable farm mode"), lcd_disable_farm_mode); } - MENU_ITEM(function, MSG_WIZARD, lcd_wizard); - END_MENU(); } @@ -2996,6 +2994,7 @@ static void lcd_calibration_menu() MENU_ITEM(back, MSG_MAIN, lcd_main_menu); if (!isPrintPaused) { + MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28 W")); MENU_ITEM(function, MSG_SELFTEST, lcd_selftest); #ifdef MK1BP // MK1 @@ -3013,8 +3012,9 @@ static void lcd_calibration_menu() #endif // "Mesh Bed Leveling" MENU_ITEM(submenu, MSG_MESH_BED_LEVELING, lcd_mesh_bedleveling); + MENU_ITEM(function, MSG_WIZARD, lcd_wizard); #endif //MK1BP - MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28 W")); + MENU_ITEM(submenu, MSG_BED_CORRECTION_MENU, lcd_adjust_bed); #ifndef MK1BP MENU_ITEM(submenu, MSG_CALIBRATION_PINDA_MENU, lcd_pinda_calibration_menu); From 34a1a4d4c704040f10cdea23024f1f64ca170f64 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 11 Sep 2017 11:27:32 +0200 Subject: [PATCH 07/14] messages corrected --- Firmware/language_all.cpp | 6 +++--- Firmware/language_en.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index 03a4eac69..87919bf07 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -3547,17 +3547,17 @@ const char * const MSG_WIZARD_WELCOME_LANG_TABLE[1] PROGMEM = { MSG_WIZARD_WELCOME_EN }; -const char MSG_WIZARD_WILL_PREHEAT_EN[] PROGMEM = "No I will preheat nozzle for PLA."; +const char MSG_WIZARD_WILL_PREHEAT_EN[] PROGMEM = "Now I will preheat nozzle for PLA."; const char * const MSG_WIZARD_WILL_PREHEAT_LANG_TABLE[1] PROGMEM = { MSG_WIZARD_WILL_PREHEAT_EN }; -const char MSG_WIZARD_XYZ_CAL_EN[] PROGMEM = "I will run xyz calibration now\x85 It will take approx. 12 mins."; +const char MSG_WIZARD_XYZ_CAL_EN[] PROGMEM = "I will run xyz calibration now. It will take approx. 12 mins."; const char * const MSG_WIZARD_XYZ_CAL_LANG_TABLE[1] PROGMEM = { MSG_WIZARD_XYZ_CAL_EN }; -const char MSG_WIZARD_Z_CAL_EN[] PROGMEM = "I will run z calibration now\x85"; +const char MSG_WIZARD_Z_CAL_EN[] PROGMEM = "I will run z calibration now."; const char * const MSG_WIZARD_Z_CAL_LANG_TABLE[1] PROGMEM = { MSG_WIZARD_Z_CAL_EN }; diff --git a/Firmware/language_en.h b/Firmware/language_en.h index b97c49b49..a8112ac78 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -322,10 +322,10 @@ #define MSG_WIZARD_QUIT "You can always resume the Wizard from Calibration -> Wizard." #define MSG_WIZARD_SELFTEST "First, I will run the selftest to check most common assembly problems." #define MSG_WIZARD_CALIBRATION_FAILED "Please check our handbook and fix the problem. Then resume the Wizard by rebooting the printer." -#define MSG_WIZARD_XYZ_CAL "I will run xyz calibration now… It will take approx. 12 mins." +#define MSG_WIZARD_XYZ_CAL "I will run xyz calibration now. It will take approx. 12 mins." #define MSG_WIZARD_FILAMENT_LOADED "Is filament loaded?" -#define MSG_WIZARD_Z_CAL "I will run z calibration now…" -#define MSG_WIZARD_WILL_PREHEAT "No I will preheat nozzle for PLA." +#define MSG_WIZARD_Z_CAL "I will run z calibration now." +#define MSG_WIZARD_WILL_PREHEAT "Now I will preheat nozzle for PLA." #define MSG_WIZARD_HEATING "Preheating nozzle. Please wait." #define MSG_WIZARD_V2_CAL "Now I will calibrate distance between tip of the nozzle and heatbed surface." #define MSG_WIZARD_V2_CAL_2 "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." From 77937ab4bbe63d9395f9a7ce5738c202374a831e Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Tue, 12 Sep 2017 17:34:28 +0200 Subject: [PATCH 08/14] wizard :checking if PLA is loaded, user can repeat v2 cal., M117 and M1 hotfix --- Firmware/Marlin_main.cpp | 16 +++++++++---- Firmware/language_all.cpp | 30 ++++++++++++++++++++++++ Firmware/language_all.h | 12 ++++++++++ Firmware/language_en.h | 8 ++++++- Firmware/ultralcd.cpp | 49 ++++++++++++++++++++++++++++++++++----- 5 files changed, 104 insertions(+), 11 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index f048360f8..6bee0ae29 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2318,10 +2318,14 @@ void process_commands() KEEPALIVE_STATE(IN_HANDLER); if (code_seen("M117")) { //moved to highest priority place to be able to to print strings which includes "G", "PRUSA" and "^" + custom_message = true; + custom_message_type = 2; starpos = (strchr(strchr_pointer + 5, '*')); if (starpos != NULL) *(starpos) = '\0'; lcd_setstatus(strchr_pointer + 5); + custom_message = false; + custom_message_type = 0; } else if(code_seen("PRUSA")){ if (code_seen("Ping")) { //PRUSA Ping @@ -3716,9 +3720,11 @@ void process_commands() case 0: // M0 - Unconditional stop - Wait for user button press on LCD case 1: // M1 - Conditional stop - Wait for user button press on LCD { - char *src = strchr_pointer + 2; + custom_message = true; + custom_message_type = 2; - codenum = 0; + char *src = strchr_pointer + 2; + codenum = 0; bool hasP = false, hasS = false; if (code_seen('P')) { @@ -3744,7 +3750,7 @@ void process_commands() if (codenum > 0){ codenum += millis(); // keep track of when we started waiting KEEPALIVE_STATE(PAUSED_FOR_USER); - while(millis() < codenum && !lcd_clicked()){ + while(millis() < codenum && !lcd_clicked()){ manage_heater(); manage_inactivity(true); lcd_update(); @@ -3766,7 +3772,9 @@ void process_commands() LCD_MESSAGERPGM(MSG_RESUMING); else LCD_MESSAGERPGM(WELCOME_MSG); - } + custom_message = false; + custom_message_type = 0; + } break; #endif case 17: diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index 87919bf07..e947bc289 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -2097,6 +2097,16 @@ const char * const MSG_PLANNER_BUFFER_BYTES_LANG_TABLE[1] PROGMEM = { MSG_PLANNER_BUFFER_BYTES_EN }; +const char MSG_PLA_FILAMENT_LOADED_EN[] PROGMEM = "Is PLA filament loaded?"; +const char * const MSG_PLA_FILAMENT_LOADED_LANG_TABLE[1] PROGMEM = { + MSG_PLA_FILAMENT_LOADED_EN +}; + +const char MSG_PLEASE_LOAD_PLA_EN[] PROGMEM = "Please load PLA filament first."; +const char * const MSG_PLEASE_LOAD_PLA_LANG_TABLE[1] PROGMEM = { + MSG_PLEASE_LOAD_PLA_EN +}; + const char MSG_PLEASE_WAIT_EN[] PROGMEM = "Please wait"; const char MSG_PLEASE_WAIT_CZ[] PROGMEM = "Prosim cekejte"; const char MSG_PLEASE_WAIT_IT[] PROGMEM = "Aspetta"; @@ -3492,6 +3502,11 @@ const char * const MSG_WIZARD_CALIBRATION_FAILED_LANG_TABLE[1] PROGMEM = { MSG_WIZARD_CALIBRATION_FAILED_EN }; +const char MSG_WIZARD_CLEAN_HEATBED_EN[] PROGMEM = "Please clean heatbed and then press the knob."; +const char * const MSG_WIZARD_CLEAN_HEATBED_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_CLEAN_HEATBED_EN +}; + const char MSG_WIZARD_DONE_EN[] PROGMEM = "All is done. Happy printing!"; const char * const MSG_WIZARD_DONE_LANG_TABLE[1] PROGMEM = { MSG_WIZARD_DONE_EN @@ -3507,6 +3522,11 @@ const char * const MSG_WIZARD_HEATING_LANG_TABLE[1] PROGMEM = { MSG_WIZARD_HEATING_EN }; +const char MSG_WIZARD_INSERT_CORRECT_FILAMENT_EN[] PROGMEM = "Please load PLA filament and then resume Wizard by rebooting the printer."; +const char * const MSG_WIZARD_INSERT_CORRECT_FILAMENT_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_INSERT_CORRECT_FILAMENT_EN +}; + const char MSG_WIZARD_LANGUAGE_EN[] PROGMEM = "Please choose your language"; const char * const MSG_WIZARD_LANGUAGE_LANG_TABLE[1] PROGMEM = { MSG_WIZARD_LANGUAGE_EN @@ -3517,11 +3537,21 @@ const char * const MSG_WIZARD_LOAD_FILAMENT_LANG_TABLE[1] PROGMEM = { MSG_WIZARD_LOAD_FILAMENT_EN }; +const char MSG_WIZARD_PLA_FILAMENT_EN[] PROGMEM = "Is it PLA filament?"; +const char * const MSG_WIZARD_PLA_FILAMENT_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_PLA_FILAMENT_EN +}; + const char MSG_WIZARD_QUIT_EN[] PROGMEM = "You can always resume the Wizard from Calibration -> Wizard."; const char * const MSG_WIZARD_QUIT_LANG_TABLE[1] PROGMEM = { MSG_WIZARD_QUIT_EN }; +const char MSG_WIZARD_REPEAT_V2_CAL_EN[] PROGMEM = "Do you want to repeat last step to readjust distance between nozzle and heatbed?"; +const char * const MSG_WIZARD_REPEAT_V2_CAL_LANG_TABLE[1] PROGMEM = { + MSG_WIZARD_REPEAT_V2_CAL_EN +}; + const char MSG_WIZARD_RERUN_EN[] PROGMEM = "Running Wizard will delete current calibration results and start from the beginning. Continue?"; const char * const MSG_WIZARD_RERUN_LANG_TABLE[1] PROGMEM = { MSG_WIZARD_RERUN_EN diff --git a/Firmware/language_all.h b/Firmware/language_all.h index 012e24d9e..8a951d299 100644 --- a/Firmware/language_all.h +++ b/Firmware/language_all.h @@ -396,6 +396,10 @@ extern const char* const MSG_PINDA_PREHEAT_LANG_TABLE[LANG_NUM]; #define MSG_PINDA_PREHEAT LANG_TABLE_SELECT(MSG_PINDA_PREHEAT_LANG_TABLE) extern const char* const MSG_PLANNER_BUFFER_BYTES_LANG_TABLE[1]; #define MSG_PLANNER_BUFFER_BYTES LANG_TABLE_SELECT_EXPLICIT(MSG_PLANNER_BUFFER_BYTES_LANG_TABLE, 0) +extern const char* const MSG_PLA_FILAMENT_LOADED_LANG_TABLE[1]; +#define MSG_PLA_FILAMENT_LOADED LANG_TABLE_SELECT_EXPLICIT(MSG_PLA_FILAMENT_LOADED_LANG_TABLE, 0) +extern const char* const MSG_PLEASE_LOAD_PLA_LANG_TABLE[1]; +#define MSG_PLEASE_LOAD_PLA LANG_TABLE_SELECT_EXPLICIT(MSG_PLEASE_LOAD_PLA_LANG_TABLE, 0) extern const char* const MSG_PLEASE_WAIT_LANG_TABLE[LANG_NUM]; #define MSG_PLEASE_WAIT LANG_TABLE_SELECT(MSG_PLEASE_WAIT_LANG_TABLE) extern const char* const MSG_POSITION_UNKNOWN_LANG_TABLE[1]; @@ -646,18 +650,26 @@ extern const char* const MSG_WIZARD_LANG_TABLE[1]; #define MSG_WIZARD LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_LANG_TABLE, 0) extern const char* const MSG_WIZARD_CALIBRATION_FAILED_LANG_TABLE[1]; #define MSG_WIZARD_CALIBRATION_FAILED LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_CALIBRATION_FAILED_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_CLEAN_HEATBED_LANG_TABLE[1]; +#define MSG_WIZARD_CLEAN_HEATBED LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_CLEAN_HEATBED_LANG_TABLE, 0) extern const char* const MSG_WIZARD_DONE_LANG_TABLE[1]; #define MSG_WIZARD_DONE LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_DONE_LANG_TABLE, 0) extern const char* const MSG_WIZARD_FILAMENT_LOADED_LANG_TABLE[1]; #define MSG_WIZARD_FILAMENT_LOADED LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_FILAMENT_LOADED_LANG_TABLE, 0) extern const char* const MSG_WIZARD_HEATING_LANG_TABLE[1]; #define MSG_WIZARD_HEATING LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_HEATING_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_INSERT_CORRECT_FILAMENT_LANG_TABLE[1]; +#define MSG_WIZARD_INSERT_CORRECT_FILAMENT LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_INSERT_CORRECT_FILAMENT_LANG_TABLE, 0) extern const char* const MSG_WIZARD_LANGUAGE_LANG_TABLE[1]; #define MSG_WIZARD_LANGUAGE LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_LANGUAGE_LANG_TABLE, 0) extern const char* const MSG_WIZARD_LOAD_FILAMENT_LANG_TABLE[1]; #define MSG_WIZARD_LOAD_FILAMENT LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_LOAD_FILAMENT_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_PLA_FILAMENT_LANG_TABLE[1]; +#define MSG_WIZARD_PLA_FILAMENT LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_PLA_FILAMENT_LANG_TABLE, 0) extern const char* const MSG_WIZARD_QUIT_LANG_TABLE[1]; #define MSG_WIZARD_QUIT LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_QUIT_LANG_TABLE, 0) +extern const char* const MSG_WIZARD_REPEAT_V2_CAL_LANG_TABLE[1]; +#define MSG_WIZARD_REPEAT_V2_CAL LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_REPEAT_V2_CAL_LANG_TABLE, 0) extern const char* const MSG_WIZARD_RERUN_LANG_TABLE[1]; #define MSG_WIZARD_RERUN LANG_TABLE_SELECT_EXPLICIT(MSG_WIZARD_RERUN_LANG_TABLE, 0) extern const char* const MSG_WIZARD_SELFTEST_LANG_TABLE[1]; diff --git a/Firmware/language_en.h b/Firmware/language_en.h index a8112ac78..25209b417 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -323,7 +323,7 @@ #define MSG_WIZARD_SELFTEST "First, I will run the selftest to check most common assembly problems." #define MSG_WIZARD_CALIBRATION_FAILED "Please check our handbook and fix the problem. Then resume the Wizard by rebooting the printer." #define MSG_WIZARD_XYZ_CAL "I will run xyz calibration now. It will take approx. 12 mins." -#define MSG_WIZARD_FILAMENT_LOADED "Is filament loaded?" +#define MSG_WIZARD_FILAMENT_LOADED "Is filament loaded?" #define MSG_WIZARD_Z_CAL "I will run z calibration now." #define MSG_WIZARD_WILL_PREHEAT "Now I will preheat nozzle for PLA." #define MSG_WIZARD_HEATING "Preheating nozzle. Please wait." @@ -333,3 +333,9 @@ #define MSG_WIZARD_DONE "All is done. Happy printing!" #define MSG_WIZARD_LOAD_FILAMENT "Please insert PLA filament to the extruder, then press knob to load it." #define MSG_WIZARD_RERUN "Running Wizard will delete current calibration results and start from the beginning. Continue?" +#define MSG_WIZARD_REPEAT_V2_CAL "Do you want to repeat last step to readjust distance between nozzle and heatbed?" +#define MSG_WIZARD_CLEAN_HEATBED "Please clean heatbed and then press the knob." +#define MSG_WIZARD_PLA_FILAMENT "Is it PLA filament?" +#define MSG_WIZARD_INSERT_CORRECT_FILAMENT "Please load PLA filament and then resume Wizard by rebooting the printer." +#define MSG_PLA_FILAMENT_LOADED "Is PLA filament loaded?" +#define MSG_PLEASE_LOAD_PLA "Please load PLA filament first." \ No newline at end of file diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 35c73a550..4f19bcf7f 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -687,7 +687,7 @@ void lcd_commands() lcd_commands_step = 0; lcd_commands_type = 0; if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) { - lcd_wizard(9); + lcd_wizard(10); } } @@ -2789,7 +2789,21 @@ void lcd_toshiba_flash_air_compatibility_toggle() } void lcd_v2_calibration() { - lcd_commands_type = LCD_COMMAND_V2_CAL; + bool loaded = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_PLA_FILAMENT_LOADED, true, false); + if (loaded) lcd_commands_type = LCD_COMMAND_V2_CAL; + else { + lcd_display_message_fullscreen_P(MSG_PLEASE_LOAD_PLA); + for (int i = 0; i < 20; i++) { //wait max. 2s + delay_keep_alive(100); + if (lcd_clicked()) { + while (lcd_clicked()); + delay(10); + while (lcd_clicked()); + break; + } + } + } + lcd_update_enable(true); lcd_return_to_status(); } @@ -2891,15 +2905,33 @@ void lcd_wizard(int state) { lcd_print_at_PGM(0,2,MSG_LOADING_FILAMENT); loading_flag = true; gcode_M701(); - state = 8; + state = 9; break; case 8: + wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_WIZARD_PLA_FILAMENT, false, true); + if (wizard_event) state = 9; + else end = true; + break; + case 9: lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_V2_CAL); lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_V2_CAL_2); lcd_commands_type = LCD_COMMAND_V2_CAL; end = true; break; - case 9: //we are finished + case 10: //repeat firt layer cal.? + wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(MSG_WIZARD_REPEAT_V2_CAL, false); + if (wizard_event) { + current_position[Z_AXIS] += 100; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS]/60, active_extruder); + current_position[Y_AXIS] = 205; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Y_AXIS]/60, active_extruder); + lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_CLEAN_HEATBED); + state = 9; + } + else { + state = 11; + } + case 11: //we are finished eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); end = true; break; @@ -2923,10 +2955,15 @@ void lcd_wizard(int state) { break; case 3: //xyz cal. msg = MSG_WIZARD_CALIBRATION_FAILED; + break; case 4: //z cal. msg = MSG_WIZARD_CALIBRATION_FAILED; - case 8: break; //exit wizard for v2 calibration, which is implemted in lcd_commands (we need lcd_update running) - case 9: //we are finished + break; + case 8: + msg = MSG_WIZARD_INSERT_CORRECT_FILAMENT; + break; + case 9: break; //exit wizard for v2 calibration, which is implemted in lcd_commands (we need lcd_update running) + case 11: //we are finished msg = MSG_WIZARD_DONE; lcd_reset_alert_level(); From 7e7a562ee0b87dc11776f26ef8518135c9724828 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 13 Sep 2017 11:49:54 +0200 Subject: [PATCH 09/14] v2 cal. for multi material added, "Is PLA filament loaded?" question added when run v2 cal. from menu --- Firmware/ultralcd.cpp | 158 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 151 insertions(+), 7 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 4f19bcf7f..1acee81c7 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -589,6 +589,146 @@ void lcd_commands() lcd_commands_step = 3; } } +#ifdef SNMM + if (lcd_commands_type == LCD_COMMAND_V2_CAL) + { + lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; + if (lcd_commands_step == 0) + { + lcd_commands_step = 6; + } + if (lcd_commands_step == 6 && !blocks_queued() && cmd_buffer_empty()) + { + enquecommand_P(PSTR("M107")); + enquecommand_P(PSTR("M104 S210")); + enquecommand_P(PSTR("M140 S55")); + enquecommand_P(PSTR("M190 S55")); + enquecommand_P(PSTR("M109 S210")); + enquecommand_P(PSTR("T0")); + enquecommand_P(PSTR("M117 First layer cal.")); + enquecommand_P(PSTR("G87")); //sets calibration status + enquecommand_P(PSTR("G28")); + enquecommand_P(PSTR("G21")); //set units to millimeters + enquecommand_P(PSTR("G90")); //use absolute coordinates + enquecommand_P(PSTR("M83")); //use relative distances for extrusion + enquecommand_P(PSTR("G92 E0")); + enquecommand_P(PSTR("M203 E100")); + enquecommand_P(PSTR("M92 E140")); + lcd_commands_step = 5; + } + if (lcd_commands_step == 5 && !blocks_queued() && cmd_buffer_empty()) + { + lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; + enquecommand_P(PSTR("G1 Z0.250 F7200.000")); + enquecommand_P(PSTR("G1 X50.0 E80.0 F1000.0)); + nquecommand_P(PSTR("G1 X160.0 E20.0 F1000.0)); + enquecommand_P(PSTR("G1 Z0.200 F7200.000)); + enquecommand_P(PSTR("G1 X220.0 E13 F1000.0")); + enquecommand_P(PSTR("G1 X240.0 E0 F1000.0")); + enquecommand_P(PSTR("G92 E0.0")); + enquecommand_P(PSTR("G21")); + enquecommand_P(PSTR("G90")); + enquecommand_P(PSTR("M83")); + enquecommand_P(PSTR("G1 E-4 F2100.00000")); + enquecommand_P(PSTR("G1 Z0.150 F7200.000")); + enquecommand_P(PSTR("M204 S1000")); + enquecommand_P(PSTR("G1 F4000")); + + lcd_implementation_clear(); + lcd_goto_menu(lcd_babystep_z, 0, false); + + + lcd_commands_step = 4; + } + if (lcd_commands_step == 4 && !blocks_queued() && cmd_buffer_empty()) //draw meander + { + lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; + + + enquecommand_P(PSTR("G1 X50 Y155")); + enquecommand_P(PSTR("G1 X60 Y155 E4")); + enquecommand_P(PSTR("G1 F1080")); + enquecommand_P(PSTR("G1 X75 Y155 E2.5")); + enquecommand_P(PSTR("G1 X100 Y155 E2")); + enquecommand_P(PSTR("G1 X200 Y155 E2.62773")); + enquecommand_P(PSTR("G1 X200 Y135 E0.66174")); + enquecommand_P(PSTR("G1 X50 Y135 E3.62773")); + enquecommand_P(PSTR("G1 X50 Y115 E0.49386")); + enquecommand_P(PSTR("G1 X200 Y115 E3.62773")); + enquecommand_P(PSTR("G1 X200 Y95 E0.49386")); + enquecommand_P(PSTR("G1 X50 Y95 E3.62773")); + enquecommand_P(PSTR("G1 X50 Y75 E0.49386")); + enquecommand_P(PSTR("G1 X200 Y75 E3.62773")); + enquecommand_P(PSTR("G1 X200 Y55 E0.49386")); + enquecommand_P(PSTR("G1 X50 Y55 E3.62773")); + enquecommand_P(PSTR("G1 E - 0.07500 F2100.00000")); + lcd_commands_step = 3; + } + + if (lcd_commands_step == 3 && !blocks_queued() && cmd_buffer_empty()) + { + lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; + + enquecommand_P(PSTR("G4 S0")); + enquecommand_P(PSTR("G1 E-4 F2100.00000")); + enquecommand_P(PSTR("G1 Z0.5 F7200.000")); + enquecommand_P(PSTR("G1 X245 Y1")); + enquecommand_P(PSTR("G1 X240 E4")); + enquecommand_P(PSTR("G1 F4000")); + enquecommand_P(PSTR("G1 X190 E2.7")); + enquecommand_P(PSTR("G1 F4600")); + enquecommand_P(PSTR("G1 X110 E2.8")); + enquecommand_P(PSTR("G1 F5200")); + enquecommand_P(PSTR("G1 X40 E3")); + enquecommand_P(PSTR("G1 E-15.0000 F5000")); + enquecommand_P(PSTR("G1 E-50.0000 F5400")); + enquecommand_P(PSTR("G1 E-15.0000 F3000")); + enquecommand_P(PSTR("G1 E-12.0000 F2000")); + enquecommand_P(PSTR("G1 F1600")); + + lcd_commands_step = 2; + } + if (lcd_commands_step == 2 && !blocks_queued() && cmd_buffer_empty()) + { + lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; + + enquecommand_P(PSTR("G1 X0 Y1 E3.0000")); + enquecommand_P(PSTR("G1 X50 Y1 E-5.0000")); + enquecommand_P(PSTR("G1 F2000")); + enquecommand_P(PSTR("G1 X0 Y1 E5.0000")); + enquecommand_P(PSTR("G1 X50 Y1 E-5.0000")); + enquecommand_P(PSTR("G1 F2400")); + enquecommand_P(PSTR("G1 X0 Y1 E5.0000")); + enquecommand_P(PSTR("G1 X50 Y1 E - 5.0000")); + enquecommand_P(PSTR("G1 F2400")); + enquecommand_P(PSTR("G1 X0 Y1 E5.0000")); + enquecommand_P(PSTR("G1 X50 Y1 E-3.0000")); + enquecommand_P(PSTR("G4 S0")); + enquecommand_P(PSTR("M107")); + enquecommand_P(PSTR("M104 S0")); + enquecommand_P(PSTR("M140 S0")); + enquecommand_P(PSTR("G1 X10 Y180 F4000")); + enquecommand_P(PSTR("G1 Z10 F1300.000")); + enquecommand_P(PSTR("M84")); + + lcd_commands_step = 1; + + } + + if (lcd_commands_step == 1 && !blocks_queued() && cmd_buffer_empty()) + { + lcd_setstatuspgm(WELCOME_MSG); + lcd_commands_step = 0; + lcd_commands_type = 0; + if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) { + lcd_wizard(10); + } + } + + } + +#else //if not SNMM + if (lcd_commands_type == LCD_COMMAND_V2_CAL) { @@ -614,7 +754,7 @@ void lcd_commands() { lcd_implementation_clear(); - lcd_goto_menu(lcd_babystep_z, 0, false); + lcd_goto_menu(lcd_babystep_z, 0, false); enquecommand_P(PSTR("G1 X60.0 E9.0 F1000.0")); //intro line enquecommand_P(PSTR("G1 X100.0 E12.5 F1000.0")); //intro line enquecommand_P(PSTR("G92 E0.0")); @@ -630,8 +770,8 @@ void lcd_commands() if (lcd_commands_step == 3 && !blocks_queued() && cmd_buffer_empty()) //draw meander { lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; - - + + //just opposite direction /*enquecommand_P(PSTR("G1 X50 Y55")); enquecommand_P(PSTR("G1 F1080")); @@ -650,7 +790,7 @@ void lcd_commands() enquecommand_P(PSTR("G1 X50 Y155 E2.5")); enquecommand_P(PSTR("G1 E - 0.07500 F2100.00000"));*/ - + enquecommand_P(PSTR("G1 X50 Y155")); enquecommand_P(PSTR("G1 F1080")); enquecommand_P(PSTR("G1 X75 Y155 E2.5")); @@ -693,6 +833,8 @@ void lcd_commands() } +#endif // not SNMM + if (lcd_commands_type == LCD_COMMAND_STOP_PRINT) /// stop print { uint8_t stopped_extruder; @@ -2789,8 +2931,10 @@ void lcd_toshiba_flash_air_compatibility_toggle() } void lcd_v2_calibration() { - bool loaded = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_PLA_FILAMENT_LOADED, true, false); - if (loaded) lcd_commands_type = LCD_COMMAND_V2_CAL; + bool loaded = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_PLA_FILAMENT_LOADED, false, true); + if (loaded) { + lcd_commands_type = LCD_COMMAND_V2_CAL; + } else { lcd_display_message_fullscreen_P(MSG_PLEASE_LOAD_PLA); for (int i = 0; i < 20; i++) { //wait max. 2s @@ -2803,8 +2947,8 @@ void lcd_v2_calibration() { } } } - lcd_update_enable(true); lcd_return_to_status(); + lcd_update_enable(true); } void lcd_wizard() { From c3e01dd4495abca3b2382375ca39f9bfe7e12ea1 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 13 Sep 2017 13:50:32 +0200 Subject: [PATCH 10/14] wizard: loading filament for SNMM, saving calibration status in xyz cal. updated --- Firmware/Marlin_main.cpp | 5 ++++- Firmware/ultralcd.cpp | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 6bee0ae29..144b01d48 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2242,8 +2242,11 @@ bool gcode_M45(bool onlyZ) { } } else { + //if wizard is active and selftest was succefully completed, we dont want to loose information about it + if (calibration_status() != 250 || eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 0) { + calibration_status_store(CALIBRATION_STATUS_ASSEMBLED); + } // 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); // Complete XYZ calibration. uint8_t point_too_far_mask = 0; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 1acee81c7..a839e753f 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2968,8 +2968,6 @@ void lcd_wizard() { void lcd_wizard(int state) { - - bool end = false; int wizard_event; const char *msg = NULL; @@ -3048,6 +3046,9 @@ void lcd_wizard(int state) { lcd_implementation_clear(); lcd_print_at_PGM(0,2,MSG_LOADING_FILAMENT); loading_flag = true; +#ifdef SNMM + change_extr(0); +#endif gcode_M701(); state = 9; break; @@ -3062,7 +3063,7 @@ void lcd_wizard(int state) { lcd_commands_type = LCD_COMMAND_V2_CAL; end = true; break; - case 10: //repeat firt layer cal.? + case 10: //repeat first layer cal.? wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(MSG_WIZARD_REPEAT_V2_CAL, false); if (wizard_event) { current_position[Z_AXIS] += 100; @@ -3075,6 +3076,7 @@ void lcd_wizard(int state) { else { state = 11; } + break; case 11: //we are finished eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); end = true; From 827a9ce6cb7e73b50da75e44c30b159c87260e65 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 13 Sep 2017 15:41:19 +0200 Subject: [PATCH 11/14] added confirm character for messages which waits for user to press the knob --- Firmware/ultralcd.cpp | 31 ++++++++++++++----- .../ultralcd_implementation_hitachi_HD44780.h | 10 ++++++ 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index a839e753f..d2bcc13da 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2096,13 +2096,13 @@ const char* lcd_display_message_fullscreen_P(const char *msg, uint8_t &nlines) } if (multi_screen) { - // Display the "next screen" indicator character. - // lcd_set_custom_characters_arrows(); - lcd_set_custom_characters_nextpage(); - lcd.setCursor(19, 3); + // Display the "next screen" indicator character. + // lcd_set_custom_characters_arrows(); + lcd_set_custom_characters_nextpage(); + lcd.setCursor(19, 3); // Display the down arrow. lcd.print(char(1)); - } + } nlines = row; return multi_screen ? msgend : NULL; @@ -2123,15 +2123,30 @@ void lcd_show_fullscreen_message_and_wait_P(const char *msg) while (lcd_clicked()) ; delay(10); while (lcd_clicked()) ; + lcd_set_custom_characters(); + lcd_update_enable(true); + lcd_update(2); KEEPALIVE_STATE(IN_HANDLER); return; } } if (multi_screen) { - if (msg_next == NULL) - msg_next = msg; + if (msg_next == NULL) + msg_next = msg; msg_next = lcd_display_message_fullscreen_P(msg_next); - } + if (msg_next == NULL) { + lcd_set_custom_characters_nextpage(); + lcd.setCursor(19, 3); + // Display the confirm char. + lcd.print(char(2)); + } + } + else { + lcd_set_custom_characters_nextpage(); + lcd.setCursor(19, 3); + // Display the confirm char. + lcd.print(char(2)); + } } } diff --git a/Firmware/ultralcd_implementation_hitachi_HD44780.h b/Firmware/ultralcd_implementation_hitachi_HD44780.h index ec360c626..f880da88c 100644 --- a/Firmware/ultralcd_implementation_hitachi_HD44780.h +++ b/Firmware/ultralcd_implementation_hitachi_HD44780.h @@ -491,8 +491,18 @@ void lcd_set_custom_characters_nextpage() B01010, B00100 }; + byte confirm[8] = { + B00000, + B00001, + B00011, + B10110, + B11100, + B01000, + B00000 + }; lcd.createChar(1, arrdown); + lcd.createChar(2, confirm); } void lcd_set_custom_characters_degree() From 0f8468bef29250b41de1e84b30b145e33aca53f5 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 13 Sep 2017 16:57:53 +0200 Subject: [PATCH 12/14] comments added --- Firmware/Marlin_main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 144b01d48..da848e0fa 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2321,8 +2321,8 @@ void process_commands() KEEPALIVE_STATE(IN_HANDLER); if (code_seen("M117")) { //moved to highest priority place to be able to to print strings which includes "G", "PRUSA" and "^" - custom_message = true; - custom_message_type = 2; + custom_message = true; //fixes using M117 during SD print, but needs to be be updated in future + custom_message_type = 2; //fixes using M117 during SD print, but needs to be be updated in future starpos = (strchr(strchr_pointer + 5, '*')); if (starpos != NULL) *(starpos) = '\0'; @@ -3723,8 +3723,8 @@ void process_commands() case 0: // M0 - Unconditional stop - Wait for user button press on LCD case 1: // M1 - Conditional stop - Wait for user button press on LCD { - custom_message = true; - custom_message_type = 2; + custom_message = true; //fixes using M1 during SD print, but needs to be be updated in future + custom_message_type = 2; //fixes using M1 during SD print, but needs to be be updated in future char *src = strchr_pointer + 2; codenum = 0; @@ -3775,7 +3775,7 @@ void process_commands() LCD_MESSAGERPGM(MSG_RESUMING); else LCD_MESSAGERPGM(WELCOME_MSG); - custom_message = false; + custom_message = false; custom_message_type = 0; } break; From 362ffa158587f697d6b4a45b635055d2a9f68b73 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 13 Sep 2017 19:18:31 +0200 Subject: [PATCH 13/14] storing calibration status after v2 cal. changed, changed some axes moves during cal. proces --- Firmware/ultralcd.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d2bcc13da..defa24cf9 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3021,7 +3021,11 @@ void lcd_wizard(int state) { case 3: //xyz cal. lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_XYZ_CAL); wizard_event = gcode_M45(false); - if (wizard_event) state = 5; + if (wizard_event) { + current_position[Z_AXIS] += 100; //move in z axis to make space for loading filament + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 60, active_extruder); + state = 5; + } else end = true; break; case 4: //z cal. @@ -3033,7 +3037,7 @@ void lcd_wizard(int state) { case 5: //is filament loaded? //start to preheat nozzle and bed to save some time later setTargetHotend(PLA_PREHEAT_HOTEND_TEMP, 0); - setTargetBed(PLA_PREHEAT_HPB_TEMP); + setTargetBed(PLA_PREHEAT_HPB_TEMP); wizard_event = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_WIZARD_FILAMENT_LOADED, false); if (wizard_event) state = 8; else state = 6; @@ -3081,10 +3085,7 @@ void lcd_wizard(int state) { case 10: //repeat first layer cal.? wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(MSG_WIZARD_REPEAT_V2_CAL, false); if (wizard_event) { - current_position[Z_AXIS] += 100; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS]/60, active_extruder); - current_position[Y_AXIS] = 205; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Y_AXIS]/60, active_extruder); + calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST) lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_CLEAN_HEATBED); state = 9; } @@ -3136,7 +3137,7 @@ void lcd_wizard(int state) { break; } - if(state != 8) lcd_show_fullscreen_message_and_wait_P(msg); + if(state != 9) lcd_show_fullscreen_message_and_wait_P(msg); lcd_update_enable(true); lcd_return_to_status(); lcd_update(2); From 0a8572bfbe628e1f81eb48b91eb89482c5b09296 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 14 Sep 2017 13:28:15 +0200 Subject: [PATCH 14/14] fullscreen message confirm char displayed imidiately, different changes in wizard --- Firmware/ultralcd.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index defa24cf9..9fa1759dc 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2113,9 +2113,15 @@ void lcd_show_fullscreen_message_and_wait_P(const char *msg) const char *msg_next = lcd_display_message_fullscreen_P(msg); bool multi_screen = msg_next != NULL; + lcd_set_custom_characters_nextpage(); KEEPALIVE_STATE(PAUSED_FOR_USER); // Until confirmed by a button click. for (;;) { + if (!multi_screen) { + lcd.setCursor(19, 3); + // Display the confirm char. + lcd.print(char(2)); + } // Wait for 5 seconds before displaying the next text. for (uint8_t i = 0; i < 100; ++ i) { delay_keep_alive(50); @@ -2135,18 +2141,12 @@ void lcd_show_fullscreen_message_and_wait_P(const char *msg) msg_next = msg; msg_next = lcd_display_message_fullscreen_P(msg_next); if (msg_next == NULL) { - lcd_set_custom_characters_nextpage(); + lcd.setCursor(19, 3); // Display the confirm char. lcd.print(char(2)); } } - else { - lcd_set_custom_characters_nextpage(); - lcd.setCursor(19, 3); - // Display the confirm char. - lcd.print(char(2)); - } } } @@ -3005,7 +3005,7 @@ void lcd_wizard(int state) { case CALIBRATION_STATUS_XYZ_CALIBRATION: state = 3; break; //run xyz cal. case CALIBRATION_STATUS_Z_CALIBRATION: state = 4; break; //run z cal. case CALIBRATION_STATUS_LIVE_ADJUST: state = 5; break; //run live adjust - case CALIBRATION_STATUS_CALIBRATED: end = true; break; + case CALIBRATION_STATUS_CALIBRATED: end = true; eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); break; default: state = 2; break; //if calibration status is unknown, run wizard from the beginning } break; @@ -3021,17 +3021,13 @@ void lcd_wizard(int state) { case 3: //xyz cal. lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_XYZ_CAL); wizard_event = gcode_M45(false); - if (wizard_event) { - current_position[Z_AXIS] += 100; //move in z axis to make space for loading filament - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 60, active_extruder); - state = 5; - } + if (wizard_event) state = 5; else end = true; break; case 4: //z cal. lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_Z_CAL); wizard_event = gcode_M45(true); - if (wizard_event) state = 9; //shipped, no need to set first layer, go to final message directly + if (wizard_event) state = 11; //shipped, no need to set first layer, go to final message directly else end = true; break; case 5: //is filament loaded? @@ -3044,6 +3040,8 @@ void lcd_wizard(int state) { break; case 6: //waiting for preheat nozzle for PLA; lcd_display_message_fullscreen_P(MSG_WIZARD_WILL_PREHEAT); + current_position[Z_AXIS] = 100; //move in z axis to make space for loading filament + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 60, active_extruder); delay_keep_alive(2000); lcd_display_message_fullscreen_P(MSG_WIZARD_HEATING); while (abs(degHotend(0) - PLA_PREHEAT_HOTEND_TEMP) > 3) { @@ -3085,7 +3083,7 @@ void lcd_wizard(int state) { case 10: //repeat first layer cal.? wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(MSG_WIZARD_REPEAT_V2_CAL, false); if (wizard_event) { - calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST) + calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST); lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_CLEAN_HEATBED); state = 9; }