From bf077125b9828b871e5750e8e03e96a44c6bfbfd Mon Sep 17 00:00:00 2001 From: Bernhard Date: Sat, 2 Jun 2012 20:32:28 +0200 Subject: [PATCH] added firmware retract. disabled by default --- Marlin/Configuration_adv.h | 10 + Marlin/Marlin.pde | 132 +++++++- Marlin/language.h | 639 +++++++++++++++++++------------------ Marlin/ultralcd.h | 3 +- Marlin/ultralcd.pde | 255 +++++++++++++++ 5 files changed, 722 insertions(+), 317 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index d796a08291..8a817c13ed 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -179,6 +179,16 @@ const int dropsegments=5; //everything with less than this number of steps will #define MAX_CMD_SIZE 96 #define BUFSIZE 4 + +// Firmware based and LCD controled retract +// M207 and M208 can be used to define parameters for the retraction. +// The retraction can be called by the slicer using G10 and G11 +// until then, intended retractions can be detected by moves that only extrude and the direction. +// the moves are than replaced by the firmware controlled ones. + +// #define FWRETRACT //ONLY PARTIALLY TESTED +#define MIN_RETRACT 0.1 //minimum extruded mm to accept a automatic gcode retraction attempt + //=========================================================================== //============================= Define Defines ============================ //=========================================================================== diff --git a/Marlin/Marlin.pde b/Marlin/Marlin.pde index c817be275f..78eba68709 100644 --- a/Marlin/Marlin.pde +++ b/Marlin/Marlin.pde @@ -50,6 +50,8 @@ // G2 - CW ARC // G3 - CCW ARC // G4 - Dwell S or P +// G10 - retract filament according to settings of M207 +// G11 - retract recover filament according to settings of M208 // G28 - Home all Axis // G90 - Use Absolute Coordinates // G91 - Use Relative Coordinates @@ -102,6 +104,9 @@ // M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) im mm/sec^2 also sets minimum segment time in ms (B20000) to prevent buffer underruns and M20 minimum feedrate // M205 - advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk, E=maximum E jerk // M206 - set additional homeing offset +// M207 - set retract length S[positive mm] F[feedrate mm/sec] Z[additional zlift/hop] +// M208 - set recover=unretract length S[positive mm surplus to the M207 S*] F[feedrate mm/sec] +// M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction. // M220 S- set speed factor override percentage // M221 S- set extrude factor override percentage // M240 - Trigger a camera to take a photograph @@ -139,6 +144,12 @@ float add_homeing[3]={0,0,0}; uint8_t active_extruder = 0; unsigned char FanSpeed=0; +#ifdef FWRETRACT + bool autoretract_enabled=true; + bool retracted=false; + float retract_length=3, retract_feedrate=17*60, retract_zlift=0.8; + float retract_recover_length=0, retract_recover_feedrate=8*60; +#endif //=========================================================================== //=============================private variables============================= @@ -179,6 +190,7 @@ static unsigned long stoptime=0; static uint8_t tmp_extruder; + bool Stopped=false; //=========================================================================== @@ -601,6 +613,36 @@ void process_commands() LCD_STATUS; } break; + #ifdef FWRETRACT + case 10: // G10 retract + if(!retracted) + { + destination[X_AXIS]=current_position[X_AXIS]; + destination[Y_AXIS]=current_position[Y_AXIS]; + destination[Z_AXIS]=current_position[Z_AXIS]; + current_position[Z_AXIS]+=-retract_zlift; + destination[E_AXIS]=current_position[E_AXIS]-retract_length; + feedrate=retract_feedrate; + retracted=true; + prepare_move(); + } + + break; + case 11: // G10 retract_recover + if(!retracted) + { + destination[X_AXIS]=current_position[X_AXIS]; + destination[Y_AXIS]=current_position[Y_AXIS]; + destination[Z_AXIS]=current_position[Z_AXIS]; + + current_position[Z_AXIS]+=retract_zlift; + current_position[E_AXIS]+=-retract_recover_length; + feedrate=retract_recover_feedrate; + retracted=false; + prepare_move(); + } + break; + #endif //FWRETRACT case 28: //G28 Home all Axis one at a time saved_feedrate = feedrate; saved_feedmultiply = feedmultiply; @@ -1212,6 +1254,53 @@ void process_commands() if(code_seen(axis_codes[i])) add_homeing[i] = code_value(); } break; + #ifdef FWRETRACT + case 207: //M207 - set retract length S[positive mm] F[feedrate mm/sec] Z[additional zlift/hop] + { + if(code_seen('S')) + { + retract_length = code_value() ; + } + if(code_seen('F')) + { + retract_feedrate = code_value() ; + } + if(code_seen('Z')) + { + retract_zlift = code_value() ; + } + }break; + case 208: // M208 - set retract recover length S[positive mm surplus to the M207 S*] F[feedrate mm/sec] + { + if(code_seen('S')) + { + retract_recover_length = code_value() ; + } + if(code_seen('F')) + { + retract_recover_feedrate = code_value() ; + } + }break; + + case 209: // M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction. + { + if(code_seen('S')) + { + int t= code_value() ; + switch(t) + { + case 0: autoretract_enabled=false;retracted=false;break; + case 1: autoretract_enabled=true;retracted=false;break; + default: + SERIAL_ECHO_START; + SERIAL_ECHOPGM(MSG_UNKNOWN_COMMAND); + SERIAL_ECHO(cmdbuffer[bufindr]); + SERIAL_ECHOLNPGM("\""); + } + } + + }break; + #endif case 220: // M220 S- set speed factor override percentage { if(code_seen('S')) @@ -1373,14 +1462,55 @@ void ClearToSend() void get_coordinates() { + bool seen[4]={false,false,false,false}; for(int8_t i=0; i < NUM_AXIS; i++) { - if(code_seen(axis_codes[i])) destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i]; + if(code_seen(axis_codes[i])) + { + destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i]; + seen[i]=true; + } else destination[i] = current_position[i]; //Are these else lines really needed? } if(code_seen('F')) { next_feedrate = code_value(); if(next_feedrate > 0.0) feedrate = next_feedrate; } + #ifdef FWRETRACT + if(autoretract_enabled) + if( !(seen[X_AXIS] || seen[Y_AXIS] || seen[Z_AXIS]) && seen[E_AXIS]) + { + float echange=destination[E_AXIS]-current_position[E_AXIS]; + if(echange<-MIN_RETRACT) //retract + { + if(!retracted) + { + + destination[Z_AXIS]+=retract_zlift; //not sure why chaninging current_position negatively does not work. + //if slicer retracted by echange=-1mm and you want to retract 3mm, corrrectede=-2mm additionally + float correctede=-echange-retract_length; + //to generate the additional steps, not the destination is changed, but inversely the current position + destination[E_AXIS]+=correctede; + feedrate=retract_feedrate; + retracted=true; + } + + } + else + if(echange>MIN_RETRACT) //retract_recover + { + if(retracted) + { + //current_position[Z_AXIS]+=-retract_zlift; + //if slicer retracted_recovered by echange=+1mm and you want to retract_recover 3mm, corrrectede=2mm additionally + float correctede=-echange+0*retract_length+retract_recover_length; //total unretract=retract_length+retract_recover_length[surplus] + current_position[E_AXIS]+=-correctede; //to generate the additional steps, not the destination is changed, but inversely the current position + feedrate=retract_recover_feedrate; + retracted=false; + } + } + + } + #endif //FWRETRACT } void get_arc_coordinates() diff --git a/Marlin/language.h b/Marlin/language.h index aae99f7095..1a99e1846b 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -1,316 +1,325 @@ -#ifndef LANGUAGE_H -#define LANGUAGE_H - -// Languages -// 1 Custom (For you to add your own messages) -// 2 English -// 3 French (Waiting translation) -// 4 German (Waiting translation) -// 5 Etc - -#define LANGUAGE_CHOICE 1 // Pick your language from the list above - -#define PROTOCOL_VERSION "1.0" - -#if MOTHERBOARD == 7 || MOTHERBOARD == 71 - #define MACHINE_NAME "Ultimaker" - #define FIRMWARE_URL "http://firmware.ultimaker.com" -#else - #define MACHINE_NAME "Mendel" - #define FIRMWARE_URL "http://www.mendel-parts.com" -#endif - -#define STRINGIFY_(n) #n -#define STRINGIFY(n) STRINGIFY_(n) - -#if LANGUAGE_CHOICE == 1 - -// LCD Menu Messages - #define WELCOME_MSG MACHINE_NAME " Ready." - #define MSG_SD_INSERTED "Card inserted" - #define MSG_SD_REMOVED "Card removed" - #define MSG_MAIN " Main \003" - #define MSG_AUTOSTART " Autostart" - #define MSG_DISABLE_STEPPERS " Disable Steppers" - #define MSG_AUTO_HOME " Auto Home" - #define MSG_SET_ORIGIN " Set Origin" - #define MSG_COOLDOWN " Cooldown" - #define MSG_EXTRUDE " Extrude" - #define MSG_PREHEAT_PLA " Preheat PLA" - #define MSG_PREHEAT_ABS " Preheat ABS" - #define MSG_MOVE_AXIS " Move Axis \x7E" - #define MSG_SPEED " Speed:" - #define MSG_NOZZLE " \002Nozzle:" - #define MSG_NOZZLE1 " \002Nozzle2:" - #define MSG_NOZZLE2 " \002Nozzle3:" - #define MSG_BED " \002Bed:" - #define MSG_FAN_SPEED " Fan speed:" - #define MSG_FLOW " Flow:" - #define MSG_CONTROL " Control \003" - #define MSG_MIN " \002 Min:" - #define MSG_MAX " \002 Max:" - #define MSG_FACTOR " \002 Fact:" - #define MSG_AUTOTEMP " Autotemp:" - #define MSG_ON "On " - #define MSG_OFF "Off" - #define MSG_PID_P " PID-P: " - #define MSG_PID_I " PID-I: " - #define MSG_PID_D " PID-D: " - #define MSG_PID_C " PID-C: " - #define MSG_ACC " Acc:" - #define MSG_VXY_JERK " Vxy-jerk: " - #define MSG_VMAX " Vmax " - #define MSG_X "x:" - #define MSG_Y "y:" - #define MSG_Z "z:" - #define MSG_E "e:" - #define MSG_VMIN " Vmin:" - #define MSG_VTRAV_MIN " VTrav min:" - #define MSG_AMAX " Amax " - #define MSG_A_RETRACT " A-retract:" - #define MSG_XSTEPS " Xsteps/mm:" - #define MSG_YSTEPS " Ysteps/mm:" - #define MSG_ZSTEPS " Zsteps/mm:" - #define MSG_ESTEPS " Esteps/mm:" - #define MSG_MAIN_WIDE " Main \003" - #define MSG_TEMPERATURE_WIDE " Temperature \x7E" - #define MSG_MOTION_WIDE " Motion \x7E" - #define MSG_STORE_EPROM " Store memory" - #define MSG_LOAD_EPROM " Load memory" - #define MSG_RESTORE_FAILSAFE " Restore Failsafe" - #define MSG_REFRESH "\004Refresh" - #define MSG_WATCH " Watch \003" - #define MSG_PREPARE " Prepare \x7E" - #define MSG_PREPARE_ALT " Prepare \003" - #define MSG_CONTROL_ARROW " Control \x7E" - #define MSG_TUNE " Tune \x7E" - #define MSG_STOP_PRINT " Stop Print \x7E" - #define MSG_CARD_MENU " Card Menu \x7E" - #define MSG_NO_CARD " No Card" - #define MSG_SERIAL_ERROR_MENU_STRUCTURE "Something is wrong in the MenuStructure." - #define MSG_DWELL "Sleep..." - #define MSG_USERWAIT "Wait for user..." - #define MSG_NO_MOVE "No move." - #define MSG_PART_RELEASE "Partial Release" - #define MSG_KILLED "KILLED. " - #define MSG_STOPPED "STOPPED. " - #define MSG_PREHEAT_PLA " Preheat PLA" - #define MSG_PREHEAT_ABS " Preheat ABS" - #define MSG_STEPPER_RELEASED "Released." - - -// Serial Console Messages - - #define MSG_Enqueing "enqueing \"" - #define MSG_POWERUP "PowerUp" - #define MSG_EXTERNAL_RESET " External Reset" - #define MSG_BROWNOUT_RESET " Brown out Reset" - #define MSG_WATCHDOG_RESET " Watchdog Reset" - #define MSG_SOFTWARE_RESET " Software Reset" - #define MSG_MARLIN "Marlin " - #define MSG_AUTHOR " | Author: " - #define MSG_CONFIGURATION_VER " Last Updated: " - #define MSG_FREE_MEMORY " Free Memory: " - #define MSG_PLANNER_BUFFER_BYTES " PlannerBufferBytes: " - #define MSG_OK "ok" - #define MSG_FILE_SAVED "Done saving file." - #define MSG_ERR_LINE_NO "Line Number is not Last Line Number+1, Last Line:" - #define MSG_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line:" - #define MSG_ERR_NO_CHECKSUM "No Checksum with line number, Last Line:" - #define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "No Line Number with checksum, Last Line:" - #define MSG_FILE_PRINTED "Done printing file" - #define MSG_BEGIN_FILE_LIST "Begin file list" - #define MSG_END_FILE_LIST "End file list" - #define MSG_M104_INVALID_EXTRUDER "M104 Invalid extruder " - #define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder " - #define MSG_ERR_NO_THERMISTORS "No thermistors - no temp" - #define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder " - #define MSG_HEATING "Heating..." - #define MSG_HEATING_COMPLETE "Heating done." - #define MSG_BED_HEATING "Bed Heating." - #define MSG_BED_DONE "Bed done." - #define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) "\n" - #define MSG_COUNT_X " Count X:" - #define MSG_ERR_KILLED "Printer halted. kill() called !!" - #define MSG_ERR_STOPPED "Printer stopped deu to errors. Fix the error and use M999 to restart!. (Temperature is reset. Set it before restarting)" - #define MSG_RESEND "Resend:" - #define MSG_UNKNOWN_COMMAND "Unknown command:\"" - #define MSG_ACTIVE_EXTRUDER "Active Extruder: " - #define MSG_INVALID_EXTRUDER "Invalid extruder" - #define MSG_X_MIN "x_min:" - #define MSG_X_MAX "x_max:" - #define MSG_Y_MIN "y_min:" - #define MSG_Y_MAX "y_max:" - #define MSG_Z_MIN "z_min:" - #define MSG_Z_MAX "z_max:" - - #define MSG_SD_CANT_OPEN_SUBDIR "Cannot open subdir" - #define MSG_SD_INIT_FAIL "SD init fail" - #define MSG_SD_VOL_INIT_FAIL "volume.init failed" - #define MSG_SD_OPENROOT_FAIL "openRoot failed" - #define MSG_SD_CARD_OK "SD card ok" - #define MSG_SD_WORKDIR_FAIL "workDir open failed" - #define MSG_SD_OPEN_FILE_FAIL "open failed, File: " - #define MSG_SD_FILE_OPENED "File opened:" - #define MSG_SD_SIZE " Size:" - #define MSG_SD_FILE_SELECTED "File selected" - #define MSG_SD_WRITE_TO_FILE "Writing to file: " - #define MSG_SD_PRINTING_BYTE "SD printing byte " - #define MSG_SD_NOT_PRINTING "Not SD printing" - #define MSG_SD_ERR_WRITE_TO_FILE "error writing to file" - #define MSG_SD_CANT_ENTER_SUBDIR "Cannot enter subdir:" - - #define MSG_STEPPER_TO_HIGH "Steprate to high : " - #define MSG_ENDSTOPS_HIT "endstops hit: " - #define MSG_ERR_COLD_EXTRUDE_STOP " cold extrusion prevented" - #define MSG_ERR_LONG_EXTRUDE_STOP " too long extrusion prevented" - -#endif -#if LANGUAGE_CHOICE == 4 - -// LCD Menu Messages - - #define WELCOME_MSG MACHINE_NAME " Ready." - - #define MSG_SD_INSERTED "Card inserted" - #define MSG_SD_REMOVED "Card removed" - #define MSG_MAIN " Main \003" - #define MSG_AUTOSTART " Autostart" - #define MSG_DISABLE_STEPPERS " Stepper abschalten" - #define MSG_AUTO_HOME " Auto Heim" - #define MSG_SET_ORIGIN " Position setzen" - #define MSG_PREHEAT_PLA " Aufheizen PLA" - #define MSG_PREHEAT_ABS " Aufheizen ABS" - #define MSG_COOLDOWN " Abkuehlen" - #define MSG_EXTRUDE " Extrude" - #define MSG_PREHEAT_PLA " Preheat PLA" - #define MSG_PREHEAT_ABS " Preheat ABS" - #define MSG_MOVE_AXIS " Move Axis \x7E" - #define MSG_MOVE_AXIS " Achsen verfahren \x7E" - #define MSG_SPEED " Geschw:" - #define MSG_NOZZLE " \002Duese:" - #define MSG_NOZZLE1 " \002Duese2:" - #define MSG_NOZZLE2 " \002Duese3:" - #define MSG_BED " \002Bett:" - #define MSG_FAN_SPEED " Luefter geschw.:" - #define MSG_FLOW " Fluss:" - #define MSG_CONTROL " Kontrolle \003" - #define MSG_MIN " \002 Min:" - #define MSG_MAX " \002 Max:" - #define MSG_FACTOR " \002 Faktor:" - #define MSG_AUTOTEMP " AutoTemp:" - #define MSG_ON "Ein " - #define MSG_OFF "Aus " - #define MSG_PID_P " PID-P: " - #define MSG_PID_I " PID-I: " - #define MSG_PID_D " PID-D: " - #define MSG_PID_C " PID-C: " - #define MSG_ACC " Acc:" - #define MSG_VXY_JERK " Vxy-jerk: " - #define MSG_VMAX " Vmax " - #define MSG_X "x:" - #define MSG_Y "y:" - #define MSG_Z "z:" - #define MSG_E "e:" - #define MSG_VMIN " Vmin:" - #define MSG_VTRAV_MIN " VTrav min:" - #define MSG_AMAX " Amax " - #define MSG_A_RETRACT " A-retract:" - #define MSG_XSTEPS " Xsteps/mm:" - #define MSG_YSTEPS " Ysteps/mm:" - #define MSG_ZSTEPS " Zsteps/mm:" - #define MSG_ESTEPS " Esteps/mm:" - #define MSG_MAIN_WIDE " Main \003" - #define MSG_TEMPERATURE_WIDE " Temperatur \x7E" - #define MSG_MOTION_WIDE " Motion \x7E" - #define MSG_STORE_EPROM " EPROM speichern" - #define MSG_LOAD_EPROM " EPROM laden" - #define MSG_RESTORE_FAILSAFE " Standard Konfig." - #define MSG_REFRESH "\004Refresh" - #define MSG_WATCH " Beobachten \003" - #define MSG_PREPARE " Prepare \x7E" - #define MSG_PREPARE_ALT " Prepare \003" - #define MSG_CONTROL_ARROW " Control \x7E" - #define MSG_TUNE " Tune \x7E" - #define MSG_STOP_PRINT " Druck stoppen \x7E" - #define MSG_CARD_MENU " SDKarten Menue \x7E" - #define MSG_NO_CARD " Keine SDKarte" - #define MSG_SERIAL_ERROR_MENU_STRUCTURE "Fehler in der Menuestruktur." - #define MSG_DWELL "DWELL..." - #define MSG_NO_MOVE "No move." - #define MSG_PART_RELEASE "Partial Release" - #define MSG_KILLED "KILLED. " - #define MSG_STOPPED "STOPPED. " - #define MSG_PREHEAT_PLA " Preheat PLA" - #define MSG_PREHEAT_ABS " Preheat ABS" - #define MSG_STEPPER_RELEASED "Released." - - -// Serial Console Messages - - #define MSG_Enqueing "enqueing \"" - #define MSG_POWERUP "PowerUp" - #define MSG_EXTERNAL_RESET " External Reset" - #define MSG_BROWNOUT_RESET " Brown out Reset" - #define MSG_WATCHDOG_RESET " Watchdog Reset" - #define MSG_SOFTWARE_RESET " Software Reset" - #define MSG_MARLIN "Marlin: " - #define MSG_AUTHOR " | Author: " - #define MSG_CONFIGURATION_VER " Last Updated: " - #define MSG_FREE_MEMORY " Free Memory: " - #define MSG_PLANNER_BUFFER_BYTES " PlannerBufferBytes: " - #define MSG_OK "ok" - #define MSG_FILE_SAVED "Done saving file." - #define MSG_ERR_LINE_NO "Line Number is not Last Line Number+1, Last Line:" - #define MSG_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line:" - #define MSG_ERR_NO_CHECKSUM "No Checksum with line number, Last Line:" - #define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "No Line Number with checksum, Last Line:" - #define MSG_FILE_PRINTED "Done printing file" - #define MSG_BEGIN_FILE_LIST "Begin file list" - #define MSG_END_FILE_LIST "End file list" - #define MSG_M104_INVALID_EXTRUDER "M104 Invalid extruder " - #define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder " - #define MSG_ERR_NO_THERMISTORS "No thermistors - no temp" - #define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder " - #define MSG_HEATING "Heating..." - #define MSG_HEATING_COMPLETE "Heating done." - #define MSG_BED_HEATING "Bed Heating." - #define MSG_BED_DONE "Bed done." - #define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) "\n" - #define MSG_COUNT_X " Count X:" - #define MSG_ERR_KILLED "Printer halted. kill() called !!" - #define MSG_ERR_STOPPED "Printer stopped due to errors. Fix the error and use M999 to restart!" - #define MSG_RESEND "Resend:" - #define MSG_UNKNOWN_COMMAND "Unknown command:\"" - #define MSG_ACTIVE_EXTRUDER "Active Extruder: " - #define MSG_INVALID_EXTRUDER "Invalid extruder" - #define MSG_X_MIN "x_min:" - #define MSG_X_MAX "x_max:" - #define MSG_Y_MIN "y_min:" - #define MSG_Y_MAX "y_max:" - #define MSG_Z_MIN "z_min:" - #define MSG_Z_MAX "z_max:" - - #define MSG_SD_CANT_OPEN_SUBDIR "Cannot open subdir" - #define MSG_SD_INIT_FAIL "SD init fail" - #define MSG_SD_VOL_INIT_FAIL "volume.init failed" - #define MSG_SD_OPENROOT_FAIL "openRoot failed" - #define MSG_SD_CARD_OK "SD card ok" - #define MSG_SD_WORKDIR_FAIL "workDir open failed" - #define MSG_SD_OPEN_FILE_FAIL "open failed, File: " - #define MSG_SD_FILE_OPENED "File opened:" - #define MSG_SD_SIZE " Size:" - #define MSG_SD_FILE_SELECTED "File selected" - #define MSG_SD_WRITE_TO_FILE "Writing to file: " - #define MSG_SD_PRINTING_BYTE "SD printing byte " - #define MSG_SD_NOT_PRINTING "Not SD printing" - #define MSG_SD_ERR_WRITE_TO_FILE "error writing to file" - #define MSG_SD_CANT_ENTER_SUBDIR "Cannot enter subdir:" - - #define MSG_STEPPER_TO_HIGH "Steprate to high : " - #define MSG_ENDSTOPS_HIT "endstops hit: " - #define MSG_ERR_COLD_EXTRUDE_STOP " cold extrusion prevented" - #define MSG_ERR_LONG_EXTRUDE_STOP " too long extrusion prevented" - -#endif +#ifndef LANGUAGE_H +#define LANGUAGE_H + +// Languages +// 1 Custom (For you to add your own messages) +// 2 English +// 3 French (Waiting translation) +// 4 German (Waiting translation) +// 5 Etc + +#define LANGUAGE_CHOICE 1 // Pick your language from the list above + +#define PROTOCOL_VERSION "1.0" + +#if MOTHERBOARD == 7 || MOTHERBOARD == 71 + #define MACHINE_NAME "Ultimaker" + #define FIRMWARE_URL "http://firmware.ultimaker.com" +#else + #define MACHINE_NAME "Mendel" + #define FIRMWARE_URL "http://www.mendel-parts.com" +#endif + +#define STRINGIFY_(n) #n +#define STRINGIFY(n) STRINGIFY_(n) + +#if LANGUAGE_CHOICE == 1 + +// LCD Menu Messages + #define WELCOME_MSG MACHINE_NAME " Ready." + #define MSG_SD_INSERTED "Card inserted" + #define MSG_SD_REMOVED "Card removed" + #define MSG_MAIN " Main \003" + #define MSG_AUTOSTART " Autostart" + #define MSG_DISABLE_STEPPERS " Disable Steppers" + #define MSG_AUTO_HOME " Auto Home" + #define MSG_SET_ORIGIN " Set Origin" + #define MSG_COOLDOWN " Cooldown" + #define MSG_EXTRUDE " Extrude" + #define MSG_PREHEAT_PLA " Preheat PLA" + #define MSG_PREHEAT_ABS " Preheat ABS" + #define MSG_MOVE_AXIS " Move Axis \x7E" + #define MSG_SPEED " Speed:" + #define MSG_NOZZLE " \002Nozzle:" + #define MSG_NOZZLE1 " \002Nozzle2:" + #define MSG_NOZZLE2 " \002Nozzle3:" + #define MSG_BED " \002Bed:" + #define MSG_FAN_SPEED " Fan speed:" + #define MSG_FLOW " Flow:" + #define MSG_CONTROL " Control \003" + #define MSG_MIN " \002 Min:" + #define MSG_MAX " \002 Max:" + #define MSG_FACTOR " \002 Fact:" + #define MSG_AUTOTEMP " Autotemp:" + #define MSG_ON "On " + #define MSG_OFF "Off" + #define MSG_PID_P " PID-P: " + #define MSG_PID_I " PID-I: " + #define MSG_PID_D " PID-D: " + #define MSG_PID_C " PID-C: " + #define MSG_ACC " Acc:" + #define MSG_VXY_JERK " Vxy-jerk: " + #define MSG_VMAX " Vmax " + #define MSG_X "x:" + #define MSG_Y "y:" + #define MSG_Z "z:" + #define MSG_E "e:" + #define MSG_VMIN " Vmin:" + #define MSG_VTRAV_MIN " VTrav min:" + #define MSG_AMAX " Amax " + #define MSG_A_RETRACT " A-retract:" + #define MSG_XSTEPS " Xsteps/mm:" + #define MSG_YSTEPS " Ysteps/mm:" + #define MSG_ZSTEPS " Zsteps/mm:" + #define MSG_ESTEPS " Esteps/mm:" + #define MSG_MAIN_WIDE " Main \003" + #define MSG_RECTRACT_WIDE " Rectract \x7E" + #define MSG_TEMPERATURE_WIDE " Temperature \x7E" + #define MSG_MOTION_WIDE " Motion \x7E" + #define MSG_STORE_EPROM " Store memory" + #define MSG_LOAD_EPROM " Load memory" + #define MSG_RESTORE_FAILSAFE " Restore Failsafe" + #define MSG_REFRESH "\004Refresh" + #define MSG_WATCH " Watch \003" + #define MSG_PREPARE " Prepare \x7E" + #define MSG_PREPARE_ALT " Prepare \003" + #define MSG_CONTROL_ARROW " Control \x7E" + #define MSG_RETRACT_ARROW " Control \x7E" + #define MSG_TUNE " Tune \x7E" + #define MSG_STOP_PRINT " Stop Print \x7E" + #define MSG_CARD_MENU " Card Menu \x7E" + #define MSG_NO_CARD " No Card" + #define MSG_SERIAL_ERROR_MENU_STRUCTURE "Something is wrong in the MenuStructure." + #define MSG_DWELL "Sleep..." + #define MSG_USERWAIT "Wait for user..." + #define MSG_NO_MOVE "No move." + #define MSG_PART_RELEASE "Partial Release" + #define MSG_KILLED "KILLED. " + #define MSG_STOPPED "STOPPED. " + #define MSG_PREHEAT_PLA " Preheat PLA" + #define MSG_PREHEAT_ABS " Preheat ABS" + #define MSG_STEPPER_RELEASED "Released." + #define MSG_CONTROL_RETRACT " Retract mm:" + #define MSG_CONTROL_RETRACTF " Retract F:" + #define MSG_CONTROL_RETRACT_ZLIFT " Hop mm:" + #define MSG_CONTROL_RETRACT_RECOVER " UnRet +mm:" + #define MSG_CONTROL_RETRACT_RECOVERF " UnRet F:" + #define MSG_AUTORETRACT " AutoRetr.:" + +// Serial Console Messages + + #define MSG_Enqueing "enqueing \"" + #define MSG_POWERUP "PowerUp" + #define MSG_EXTERNAL_RESET " External Reset" + #define MSG_BROWNOUT_RESET " Brown out Reset" + #define MSG_WATCHDOG_RESET " Watchdog Reset" + #define MSG_SOFTWARE_RESET " Software Reset" + #define MSG_MARLIN "Marlin " + #define MSG_AUTHOR " | Author: " + #define MSG_CONFIGURATION_VER " Last Updated: " + #define MSG_FREE_MEMORY " Free Memory: " + #define MSG_PLANNER_BUFFER_BYTES " PlannerBufferBytes: " + #define MSG_OK "ok" + #define MSG_FILE_SAVED "Done saving file." + #define MSG_ERR_LINE_NO "Line Number is not Last Line Number+1, Last Line:" + #define MSG_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line:" + #define MSG_ERR_NO_CHECKSUM "No Checksum with line number, Last Line:" + #define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "No Line Number with checksum, Last Line:" + #define MSG_FILE_PRINTED "Done printing file" + #define MSG_BEGIN_FILE_LIST "Begin file list" + #define MSG_END_FILE_LIST "End file list" + #define MSG_M104_INVALID_EXTRUDER "M104 Invalid extruder " + #define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder " + #define MSG_ERR_NO_THERMISTORS "No thermistors - no temp" + #define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder " + #define MSG_HEATING "Heating..." + #define MSG_HEATING_COMPLETE "Heating done." + #define MSG_BED_HEATING "Bed Heating." + #define MSG_BED_DONE "Bed done." + #define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) "\n" + #define MSG_COUNT_X " Count X:" + #define MSG_ERR_KILLED "Printer halted. kill() called !!" + #define MSG_ERR_STOPPED "Printer stopped deu to errors. Fix the error and use M999 to restart!. (Temperature is reset. Set it before restarting)" + #define MSG_RESEND "Resend:" + #define MSG_UNKNOWN_COMMAND "Unknown command:\"" + #define MSG_ACTIVE_EXTRUDER "Active Extruder: " + #define MSG_INVALID_EXTRUDER "Invalid extruder" + #define MSG_X_MIN "x_min:" + #define MSG_X_MAX "x_max:" + #define MSG_Y_MIN "y_min:" + #define MSG_Y_MAX "y_max:" + #define MSG_Z_MIN "z_min:" + #define MSG_Z_MAX "z_max:" + + #define MSG_SD_CANT_OPEN_SUBDIR "Cannot open subdir" + #define MSG_SD_INIT_FAIL "SD init fail" + #define MSG_SD_VOL_INIT_FAIL "volume.init failed" + #define MSG_SD_OPENROOT_FAIL "openRoot failed" + #define MSG_SD_CARD_OK "SD card ok" + #define MSG_SD_WORKDIR_FAIL "workDir open failed" + #define MSG_SD_OPEN_FILE_FAIL "open failed, File: " + #define MSG_SD_FILE_OPENED "File opened:" + #define MSG_SD_SIZE " Size:" + #define MSG_SD_FILE_SELECTED "File selected" + #define MSG_SD_WRITE_TO_FILE "Writing to file: " + #define MSG_SD_PRINTING_BYTE "SD printing byte " + #define MSG_SD_NOT_PRINTING "Not SD printing" + #define MSG_SD_ERR_WRITE_TO_FILE "error writing to file" + #define MSG_SD_CANT_ENTER_SUBDIR "Cannot enter subdir:" + + #define MSG_STEPPER_TO_HIGH "Steprate to high : " + #define MSG_ENDSTOPS_HIT "endstops hit: " + #define MSG_ERR_COLD_EXTRUDE_STOP " cold extrusion prevented" + #define MSG_ERR_LONG_EXTRUDE_STOP " too long extrusion prevented" + +#endif +#if LANGUAGE_CHOICE == 4 + +// LCD Menu Messages + + #define WELCOME_MSG MACHINE_NAME " Ready." + + #define MSG_SD_INSERTED "Card inserted" + #define MSG_SD_REMOVED "Card removed" + #define MSG_MAIN " Main \003" + #define MSG_AUTOSTART " Autostart" + #define MSG_DISABLE_STEPPERS " Stepper abschalten" + #define MSG_AUTO_HOME " Auto Heim" + #define MSG_SET_ORIGIN " Position setzen" + #define MSG_PREHEAT_PLA " Aufheizen PLA" + #define MSG_PREHEAT_ABS " Aufheizen ABS" + #define MSG_COOLDOWN " Abkuehlen" + #define MSG_EXTRUDE " Extrude" + #define MSG_PREHEAT_PLA " Preheat PLA" + #define MSG_PREHEAT_ABS " Preheat ABS" + #define MSG_MOVE_AXIS " Move Axis \x7E" + #define MSG_MOVE_AXIS " Achsen verfahren \x7E" + #define MSG_SPEED " Geschw:" + #define MSG_NOZZLE " \002Duese:" + #define MSG_NOZZLE1 " \002Duese2:" + #define MSG_NOZZLE2 " \002Duese3:" + #define MSG_BED " \002Bett:" + #define MSG_FAN_SPEED " Luefter geschw.:" + #define MSG_FLOW " Fluss:" + #define MSG_CONTROL " Kontrolle \003" + #define MSG_MIN " \002 Min:" + #define MSG_MAX " \002 Max:" + #define MSG_FACTOR " \002 Faktor:" + #define MSG_AUTOTEMP " AutoTemp:" + #define MSG_ON "Ein " + #define MSG_OFF "Aus " + #define MSG_PID_P " PID-P: " + #define MSG_PID_I " PID-I: " + #define MSG_PID_D " PID-D: " + #define MSG_PID_C " PID-C: " + #define MSG_ACC " Acc:" + #define MSG_VXY_JERK " Vxy-jerk: " + #define MSG_VMAX " Vmax " + #define MSG_X "x:" + #define MSG_Y "y:" + #define MSG_Z "z:" + #define MSG_E "e:" + #define MSG_VMIN " Vmin:" + #define MSG_VTRAV_MIN " VTrav min:" + #define MSG_AMAX " Amax " + #define MSG_A_RETRACT " A-retract:" + #define MSG_XSTEPS " Xsteps/mm:" + #define MSG_YSTEPS " Ysteps/mm:" + #define MSG_ZSTEPS " Zsteps/mm:" + #define MSG_ESTEPS " Esteps/mm:" + #define MSG_MAIN_WIDE " Main \003" + #define MSG_TEMPERATURE_WIDE " Temperatur \x7E" + #define MSG_MOTION_WIDE " Motion \x7E" + #define MSG_STORE_EPROM " EPROM speichern" + #define MSG_LOAD_EPROM " EPROM laden" + #define MSG_RESTORE_FAILSAFE " Standard Konfig." + #define MSG_REFRESH "\004Refresh" + #define MSG_WATCH " Beobachten \003" + #define MSG_PREPARE " Prepare \x7E" + #define MSG_PREPARE_ALT " Prepare \003" + #define MSG_CONTROL_ARROW " Control \x7E" + + #define MSG_TUNE " Tune \x7E" + #define MSG_STOP_PRINT " Druck stoppen \x7E" + #define MSG_CARD_MENU " SDKarten Menue \x7E" + #define MSG_NO_CARD " Keine SDKarte" + #define MSG_SERIAL_ERROR_MENU_STRUCTURE "Fehler in der Menuestruktur." + #define MSG_DWELL "DWELL..." + #define MSG_NO_MOVE "No move." + #define MSG_PART_RELEASE "Partial Release" + #define MSG_KILLED "KILLED. " + #define MSG_STOPPED "STOPPED. " + #define MSG_PREHEAT_PLA " Preheat PLA" + #define MSG_PREHEAT_ABS " Preheat ABS" + #define MSG_STEPPER_RELEASED "Released." + + + +// Serial Console Messages + + #define MSG_Enqueing "enqueing \"" + #define MSG_POWERUP "PowerUp" + #define MSG_EXTERNAL_RESET " External Reset" + #define MSG_BROWNOUT_RESET " Brown out Reset" + #define MSG_WATCHDOG_RESET " Watchdog Reset" + #define MSG_SOFTWARE_RESET " Software Reset" + #define MSG_MARLIN "Marlin: " + #define MSG_AUTHOR " | Author: " + #define MSG_CONFIGURATION_VER " Last Updated: " + #define MSG_FREE_MEMORY " Free Memory: " + #define MSG_PLANNER_BUFFER_BYTES " PlannerBufferBytes: " + #define MSG_OK "ok" + #define MSG_FILE_SAVED "Done saving file." + #define MSG_ERR_LINE_NO "Line Number is not Last Line Number+1, Last Line:" + #define MSG_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line:" + #define MSG_ERR_NO_CHECKSUM "No Checksum with line number, Last Line:" + #define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "No Line Number with checksum, Last Line:" + #define MSG_FILE_PRINTED "Done printing file" + #define MSG_BEGIN_FILE_LIST "Begin file list" + #define MSG_END_FILE_LIST "End file list" + #define MSG_M104_INVALID_EXTRUDER "M104 Invalid extruder " + #define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder " + #define MSG_ERR_NO_THERMISTORS "No thermistors - no temp" + #define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder " + #define MSG_HEATING "Heating..." + #define MSG_HEATING_COMPLETE "Heating done." + #define MSG_BED_HEATING "Bed Heating." + #define MSG_BED_DONE "Bed done." + #define MSG_M115_REPORT "FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) "\n" + #define MSG_COUNT_X " Count X:" + #define MSG_ERR_KILLED "Printer halted. kill() called !!" + #define MSG_ERR_STOPPED "Printer stopped due to errors. Fix the error and use M999 to restart!" + #define MSG_RESEND "Resend:" + #define MSG_UNKNOWN_COMMAND "Unknown command:\"" + #define MSG_ACTIVE_EXTRUDER "Active Extruder: " + #define MSG_INVALID_EXTRUDER "Invalid extruder" + #define MSG_X_MIN "x_min:" + #define MSG_X_MAX "x_max:" + #define MSG_Y_MIN "y_min:" + #define MSG_Y_MAX "y_max:" + #define MSG_Z_MIN "z_min:" + #define MSG_Z_MAX "z_max:" + + #define MSG_SD_CANT_OPEN_SUBDIR "Cannot open subdir" + #define MSG_SD_INIT_FAIL "SD init fail" + #define MSG_SD_VOL_INIT_FAIL "volume.init failed" + #define MSG_SD_OPENROOT_FAIL "openRoot failed" + #define MSG_SD_CARD_OK "SD card ok" + #define MSG_SD_WORKDIR_FAIL "workDir open failed" + #define MSG_SD_OPEN_FILE_FAIL "open failed, File: " + #define MSG_SD_FILE_OPENED "File opened:" + #define MSG_SD_SIZE " Size:" + #define MSG_SD_FILE_SELECTED "File selected" + #define MSG_SD_WRITE_TO_FILE "Writing to file: " + #define MSG_SD_PRINTING_BYTE "SD printing byte " + #define MSG_SD_NOT_PRINTING "Not SD printing" + #define MSG_SD_ERR_WRITE_TO_FILE "error writing to file" + #define MSG_SD_CANT_ENTER_SUBDIR "Cannot enter subdir:" + + #define MSG_STEPPER_TO_HIGH "Steprate to high : " + #define MSG_ENDSTOPS_HIT "endstops hit: " + #define MSG_ERR_COLD_EXTRUDE_STOP " cold extrusion prevented" + #define MSG_ERR_LONG_EXTRUDE_STOP " too long extrusion prevented" + +#endif #endif // ifndef LANGUAGE_H diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index 72df26d1e0..f62662a6d0 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -51,7 +51,7 @@ #define blocktime 500 #define lcdslow 5 - enum MainStatus{Main_Status, Main_Menu, Main_Prepare,Sub_PrepareMove, Main_Control, Main_SD,Sub_TempControl,Sub_MotionControl}; + enum MainStatus{Main_Status, Main_Menu, Main_Prepare,Sub_PrepareMove, Main_Control, Main_SD,Sub_TempControl,Sub_MotionControl,Sub_RetractControl}; class MainMenu{ public: @@ -68,6 +68,7 @@ void showControl(); void showControlMotion(); void showControlTemp(); + void showControlRetract(); void showAxisMove(); void showSD(); bool force_lcd_update; diff --git a/Marlin/ultralcd.pde b/Marlin/ultralcd.pde index d1b93ddb32..1b9390298f 100644 --- a/Marlin/ultralcd.pde +++ b/Marlin/ultralcd.pde @@ -1688,6 +1688,8 @@ void MainMenu::showControlMotion() } }break; + + case ItemCM_aret://float retract_acceleration = 7000; { if(force_lcd_update) @@ -1884,8 +1886,252 @@ void MainMenu::showControlMotion() } +enum { + ItemR_exit, + ItemR_autoretract, + ItemR_retract_length,ItemR_retract_feedrate,ItemR_retract_zlift, + ItemR_unretract_length,ItemR_unretract_feedrate, + +}; + + + +void MainMenu::showControlRetract() +{ +#ifdef FWRETRACT + uint8_t line=0; + clearIfNecessary(); + for(int8_t i=lineoffset;i990) encoderpos=990; + lcd.setCursor(13,line);lcd.print(ftostr52(encoderpos/100.)); + } + + }break; + case ItemR_retract_feedrate: + { + if(force_lcd_update) + { + lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACTF); + lcd.setCursor(13,line);lcd.print(itostr4(retract_feedrate)); + } + + if((activeline!=line) ) + break; + + if(CLICKED) + { + linechanging=!linechanging; + if(linechanging) + { + encoderpos=(long)(retract_feedrate/5); + } + else + { + retract_feedrate= encoderpos*5.; + encoderpos=activeline*lcdslow; + + } + BLOCK; + beepshort(); + } + if(linechanging) + { + if(encoderpos<1) encoderpos=1; + if(encoderpos>990) encoderpos=990; + lcd.setCursor(13,line);lcd.print(itostr4(encoderpos*5)); + } + + }break; + case ItemR_retract_zlift://float retract_acceleration = 7000; + { + if(force_lcd_update) + { + lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACT_ZLIFT); + lcd.setCursor(13,line);lcd.print(ftostr52(retract_zlift));; + } + + if((activeline!=line) ) + break; + + if(CLICKED) + { + linechanging=!linechanging; + if(linechanging) + { + encoderpos=(long)(retract_zlift*10); + } + else + { + retract_zlift= encoderpos/10.; + encoderpos=activeline*lcdslow; + + } + BLOCK; + beepshort(); + } + if(linechanging) + { + if(encoderpos<0) encoderpos=0; + if(encoderpos>990) encoderpos=990; + lcd.setCursor(13,line);lcd.print(ftostr52(encoderpos/10.)); + } + + }break; + case ItemR_unretract_length: + { + if(force_lcd_update) + { + lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACT_RECOVER); + lcd.setCursor(13,line);lcd.print(ftostr52(retract_recover_length));; + } + + if((activeline!=line) ) + break; + + if(CLICKED) + { + linechanging=!linechanging; + if(linechanging) + { + encoderpos=(long)(retract_recover_length*100); + } + else + { + retract_recover_length= encoderpos/100.; + encoderpos=activeline*lcdslow; + + } + BLOCK; + beepshort(); + } + if(linechanging) + { + if(encoderpos<0) encoderpos=0; + if(encoderpos>990) encoderpos=990; + lcd.setCursor(13,line);lcd.print(ftostr52(encoderpos/100.)); + } + + }break; + + case ItemR_unretract_feedrate: + { + if(force_lcd_update) + { + lcd.setCursor(0,line);lcdprintPGM(MSG_CONTROL_RETRACT_RECOVERF); + lcd.setCursor(13,line);lcd.print(itostr4(retract_recover_feedrate)); + } + + if((activeline!=line) ) + break; + + if(CLICKED) + { + linechanging=!linechanging; + if(linechanging) + { + encoderpos=(long)retract_recover_feedrate/5; + } + else + { + retract_recover_feedrate= encoderpos*5.; + encoderpos=activeline*lcdslow; + + } + BLOCK; + beepshort(); + } + if(linechanging) + { + if(encoderpos<1) encoderpos=1; + if(encoderpos>990) encoderpos=990; + lcd.setCursor(13,line);lcd.print(itostr4(encoderpos*5)); + } + + }break; + + default: + break; + } + line++; + } + updateActiveLines(ItemR_unretract_feedrate,encoderpos); +#endif +} + + + enum { ItemC_exit,ItemC_temp,ItemC_move, +#ifdef FWRETRACT + ItemC_rectract, +#endif ItemC_store, ItemC_load,ItemC_failsafe }; @@ -1906,6 +2152,11 @@ void MainMenu::showControl() case ItemC_move: MENUITEM( lcdprintPGM(MSG_MOTION_WIDE) , BLOCK;status=Sub_MotionControl;beepshort(); ) ; break; +#ifdef FWRETRACT + case ItemC_rectract: + MENUITEM( lcdprintPGM(MSG_RECTRACT_WIDE) , BLOCK;status=Sub_RetractControl;beepshort(); ) ; + break; +#endif case ItemC_store: { if(force_lcd_update) @@ -2250,6 +2501,10 @@ void MainMenu::update() { showControlMotion(); }break; + case Sub_RetractControl: + { + showControlRetract(); + }break; case Sub_TempControl: { showControlTemp();