diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 2ca8b7b18821..cbb64459647a 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1,5 +1,5 @@ -#ifndef __CONFIGURATION_H -#define __CONFIGURATION_H +#ifndef CONFIGURATION_H +#define CONFIGURATION_H // This configurtion file contains the basic settings. // Advanced settings can be found in Configuration_adv.h @@ -35,6 +35,8 @@ #define MOTHERBOARD 33 #endif + + //=========================================================================== //=============================Thermal Settings ============================ //=========================================================================== @@ -128,9 +130,31 @@ //=============================Mechanical Settings=========================== //=========================================================================== -// Endstop Settings +// Uncomment the following line to enable CoreXY kinematics +// #define COREXY + +// corse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors +#ifndef ENDSTOPPULLUPS + // fine Enstop settings: Individual Pullups. will be ignord if ENDSTOPPULLUPS is defined + #define ENDSTOPPULLUP_XMAX + #define ENDSTOPPULLUP_YMAX + #define ENDSTOPPULLUP_ZMAX + #define ENDSTOPPULLUP_XMIN + #define ENDSTOPPULLUP_YMIN + //#define ENDSTOPPULLUP_ZMIN +#endif + +#ifdef ENDSTOPPULLUPS + #define ENDSTOPPULLUP_XMAX + #define ENDSTOPPULLUP_YMAX + #define ENDSTOPPULLUP_ZMAX + #define ENDSTOPPULLUP_XMIN + #define ENDSTOPPULLUP_YMIN + #define ENDSTOPPULLUP_ZMIN +#endif + // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. const bool X_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. const bool Y_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. @@ -164,9 +188,17 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th #define min_software_endstops true //If true, axis won't move to coordinates less than HOME_POS. #define max_software_endstops true //If true, axis won't move to coordinates greater than the defined lengths below. -#define X_MAX_LENGTH 200 -#define Y_MAX_LENGTH 198 -#define Z_MAX_LENGTH 86 +// Travel limits after homing +#define X_MAX_POS 200 +#define X_MIN_POS 0 +#define Y_MAX_POS 198 +#define Y_MIN_POS 0 +#define Z_MAX_POS 86 +#define Z_MIN_POS 0 + +#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS) +#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS) +#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS) // The position of the homing switches. Use MAX_LENGTH * -0.5 if the center should be 0, 0, 0 #define X_HOME_POS 0 diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 5d4b72016f4c..a33cf39e1c96 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1,5 +1,5 @@ -#ifndef __CONFIGURATION_ADV_H -#define __CONFIGURATION_ADV_H +#ifndef CONFIGURATION_ADV_H +#define CONFIGURATION_ADV_H //=========================================================================== //=============================Thermal Settings ============================ @@ -88,6 +88,12 @@ #define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step) +//By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step. +#define INVERT_X_STEP_PIN false +#define INVERT_Y_STEP_PIN false +#define INVERT_Z_STEP_PIN false +#define INVERT_E_STEP_PIN false + //default stepper release if idle #define DEFAULT_STEPPER_DEACTIVE_TIME 60 @@ -182,6 +188,16 @@ const int dropsegments=1; //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/EEPROMwrite.h b/Marlin/EEPROMwrite.h index d639e5639932..96e2ec9856e5 100644 --- a/Marlin/EEPROMwrite.h +++ b/Marlin/EEPROMwrite.h @@ -1,5 +1,5 @@ -#ifndef __EEPROMH -#define __EEPROMH +#ifndef EEPROM_H +#define EEPROM_H #include "Marlin.h" #include "planner.h" diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 5bb728c6fa0e..4123634442cf 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -1,8 +1,8 @@ // Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware. // Licence: GPL -#ifndef __MARLINH -#define __MARLINH +#ifndef MARLIN_H +#define MARLIN_H #define HardwareSerial_h // trick to disable the standard HWserial diff --git a/Marlin/Marlin.pde b/Marlin/Marlin.pde index c817be275ff7..73f1f4126b84 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; //=========================================================================== @@ -550,7 +562,7 @@ bool code_seen(char code) plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \ st_synchronize();\ \ - current_position[LETTER##_AXIS] = (LETTER##_HOME_DIR == -1) ? LETTER##_HOME_POS : LETTER##_MAX_LENGTH;\ + current_position[LETTER##_AXIS] = LETTER##_HOME_POS;\ destination[LETTER##_AXIS] = current_position[LETTER##_AXIS];\ feedrate = 0.0;\ endstops_hit_on_purpose();\ @@ -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; @@ -614,6 +656,13 @@ void process_commands() } feedrate = 0.0; home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2]))); + + #if Z_HOME_DIR > 0 // If homing away from BED do Z first + if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) { + HOMEAXIS(Z); + } + #endif + #ifdef QUICK_HOME if((home_all_axis)||( code_seen(axis_codes[X_AXIS]) && code_seen(axis_codes[Y_AXIS])) ) //first diagonal move { @@ -627,8 +676,8 @@ void process_commands() plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); st_synchronize(); - current_position[X_AXIS] = (X_HOME_DIR == -1) ? X_HOME_POS : X_MAX_LENGTH; - current_position[Y_AXIS] = (Y_HOME_DIR == -1) ? Y_HOME_POS : Y_MAX_LENGTH; + current_position[X_AXIS] = X_HOME_POS; + current_position[Y_AXIS] = Y_HOME_POS; plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); destination[X_AXIS] = current_position[X_AXIS]; destination[Y_AXIS] = current_position[Y_AXIS]; @@ -645,12 +694,14 @@ void process_commands() } if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) { - HOMEAXIS(Y); + HOMEAXIS(Y); } + #if Z_HOME_DIR < 0 // If homing towards BED do Z last if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) { HOMEAXIS(Z); } + #endif if(code_seen(axis_codes[X_AXIS])) { @@ -1212,6 +1263,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 +1471,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 + current_position[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+1*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() @@ -1403,15 +1542,15 @@ void get_arc_coordinates() void prepare_move() { if (min_software_endstops) { - if (destination[X_AXIS] < X_HOME_POS) destination[X_AXIS] = X_HOME_POS; - if (destination[Y_AXIS] < Y_HOME_POS) destination[Y_AXIS] = Y_HOME_POS; - if (destination[Z_AXIS] < Z_HOME_POS) destination[Z_AXIS] = Z_HOME_POS; + if (destination[X_AXIS] < X_MIN_POS) destination[X_AXIS] = X_MIN_POS; + if (destination[Y_AXIS] < Y_MIN_POS) destination[Y_AXIS] = Y_MIN_POS; + if (destination[Z_AXIS] < Z_MIN_POS) destination[Z_AXIS] = Z_MIN_POS; } if (max_software_endstops) { - if (destination[X_AXIS] > X_MAX_LENGTH) destination[X_AXIS] = X_MAX_LENGTH; - if (destination[Y_AXIS] > Y_MAX_LENGTH) destination[Y_AXIS] = Y_MAX_LENGTH; - if (destination[Z_AXIS] > Z_MAX_LENGTH) destination[Z_AXIS] = Z_MAX_LENGTH; + if (destination[X_AXIS] > X_MAX_POS) destination[X_AXIS] = X_MAX_POS; + if (destination[Y_AXIS] > Y_MAX_POS) destination[Y_AXIS] = Y_MAX_POS; + if (destination[Z_AXIS] > Z_MAX_POS) destination[Z_AXIS] = Z_MAX_POS; } previous_millis_cmd = millis(); plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder); diff --git a/Marlin/cardreader.h b/Marlin/cardreader.h index 5c6e29ad8124..964bbe76691a 100644 --- a/Marlin/cardreader.h +++ b/Marlin/cardreader.h @@ -1,5 +1,5 @@ -#ifndef __CARDREADERH -#define __CARDREADERH +#ifndef CARDREADER_H +#define CARDREADER_H #ifdef SDSUPPORT diff --git a/Marlin/language.h b/Marlin/language.h index aae99f7095ea..1a99e1846b20 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/pins.h b/Marlin/pins.h index c4d56590f768..419ddb643005 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -572,18 +572,33 @@ #define X_STEP_PIN 15 #define X_DIR_PIN 21 -#define X_MIN_PIN 18 -#define X_MAX_PIN -1 +#if X_HOME_DIR < 0 +# define X_MIN_PIN 18 +# define X_MAX_PIN -1 +#else +# define X_MIN_PIN -1 +# define X_MAX_PIN 18 +#endif #define Y_STEP_PIN 22 #define Y_DIR_PIN 23 -#define Y_MIN_PIN 19 -#define Y_MAX_PIN -1 +#if Y_HOME_DIR < 0 +# define Y_MIN_PIN 19 +# define Y_MAX_PIN -1 +#else +# define Y_MIN_PIN -1 +# define Y_MAX_PIN 19 +#endif #define Z_STEP_PIN 3 #define Z_DIR_PIN 2 -#define Z_MIN_PIN 20 -#define Z_MAX_PIN -1 +#if Z_HOME_DIR < 0 +# define Z_MIN_PIN 20 +# define Z_MAX_PIN -1 +#else +# define Z_MIN_PIN -1 +# define Z_MAX_PIN 20 +#endif #define E0_STEP_PIN 1 #define E0_DIR_PIN 0 diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index bb1e84be1027..93bd8225acd1 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -1,56 +1,56 @@ /* planner.c - buffers movement commands and manages the acceleration profile plan - Part of Grbl - - Copyright (c) 2009-2011 Simen Svale Skogsrud - - Grbl is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Grbl is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Grbl. If not, see . -*/ + Part of Grbl + + Copyright (c) 2009-2011 Simen Svale Skogsrud + + Grbl is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Grbl is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Grbl. If not, see . + */ /* The ring buffer implementation gleaned from the wiring_serial library by David A. Mellis. */ /* - Reasoning behind the mathematics in this module (in the key of 'Mathematica'): - - s == speed, a == acceleration, t == time, d == distance - - Basic definitions: - - Speed[s_, a_, t_] := s + (a*t) - Travel[s_, a_, t_] := Integrate[Speed[s, a, t], t] - - Distance to reach a specific speed with a constant acceleration: - - Solve[{Speed[s, a, t] == m, Travel[s, a, t] == d}, d, t] - d -> (m^2 - s^2)/(2 a) --> estimate_acceleration_distance() - - Speed after a given distance of travel with constant acceleration: - - Solve[{Speed[s, a, t] == m, Travel[s, a, t] == d}, m, t] - m -> Sqrt[2 a d + s^2] - - DestinationSpeed[s_, a_, d_] := Sqrt[2 a d + s^2] - - When to start braking (di) to reach a specified destionation speed (s2) after accelerating - from initial speed s1 without ever stopping at a plateau: - - Solve[{DestinationSpeed[s1, a, di] == DestinationSpeed[s2, a, d - di]}, di] - di -> (2 a d - s1^2 + s2^2)/(4 a) --> intersection_distance() + Reasoning behind the mathematics in this module (in the key of 'Mathematica'): + + s == speed, a == acceleration, t == time, d == distance + + Basic definitions: + + Speed[s_, a_, t_] := s + (a*t) + Travel[s_, a_, t_] := Integrate[Speed[s, a, t], t] + + Distance to reach a specific speed with a constant acceleration: + + Solve[{Speed[s, a, t] == m, Travel[s, a, t] == d}, d, t] + d -> (m^2 - s^2)/(2 a) --> estimate_acceleration_distance() + + Speed after a given distance of travel with constant acceleration: + + Solve[{Speed[s, a, t] == m, Travel[s, a, t] == d}, m, t] + m -> Sqrt[2 a d + s^2] + + DestinationSpeed[s_, a_, d_] := Sqrt[2 a d + s^2] + + When to start braking (di) to reach a specified destionation speed (s2) after accelerating + from initial speed s1 without ever stopping at a plateau: + + Solve[{DestinationSpeed[s1, a, di] == DestinationSpeed[s2, a, d - di]}, di] + di -> (2 a d - s1^2 + s2^2)/(4 a) --> intersection_distance() + + IntersectionDistance[s1_, s2_, a_, d_] := (2 a d - s1^2 + s2^2)/(4 a) + */ - IntersectionDistance[s1_, s2_, a_, d_] := (2 a d - s1^2 + s2^2)/(4 a) -*/ - #include "Marlin.h" #include "planner.h" #include "stepper.h" @@ -83,10 +83,10 @@ static float previous_nominal_speed; // Nominal speed of previous path line segm extern volatile int extrudemultiply; // Sets extrude multiply factor (in percent) #ifdef AUTOTEMP - float autotemp_max=250; - float autotemp_min=210; - float autotemp_factor=0.1; - bool autotemp_enabled=false; +float autotemp_max=250; +float autotemp_min=210; +float autotemp_factor=0.1; +bool autotemp_enabled=false; #endif //=========================================================================== @@ -100,27 +100,33 @@ volatile unsigned char block_buffer_tail; // Index of the block to pro //=============================private variables ============================ //=========================================================================== #ifdef PREVENT_DANGEROUS_EXTRUDE - bool allow_cold_extrude=false; +bool allow_cold_extrude=false; #endif #ifdef XY_FREQUENCY_LIMIT - // Used for the frequency limit - static unsigned char old_direction_bits = 0; // Old direction bits. Used for speed calculations - static long x_segment_time[3]={0,0,0}; // Segment times (in us). Used for speed calculations - static long y_segment_time[3]={0,0,0}; +// Used for the frequency limit +static unsigned char old_direction_bits = 0; // Old direction bits. Used for speed calculations +static long x_segment_time[3]={ + 0,0,0}; // Segment times (in us). Used for speed calculations +static long y_segment_time[3]={ + 0,0,0}; #endif // Returns the index of the next block in the ring buffer // NOTE: Removed modulo (%) operator, which uses an expensive divide and multiplication. static int8_t next_block_index(int8_t block_index) { block_index++; - if (block_index == BLOCK_BUFFER_SIZE) { block_index = 0; } + if (block_index == BLOCK_BUFFER_SIZE) { + block_index = 0; + } return(block_index); } // Returns the index of the previous block in the ring buffer static int8_t prev_block_index(int8_t block_index) { - if (block_index == 0) { block_index = BLOCK_BUFFER_SIZE; } + if (block_index == 0) { + block_index = BLOCK_BUFFER_SIZE; + } block_index--; return(block_index); } @@ -134,8 +140,8 @@ static int8_t prev_block_index(int8_t block_index) { FORCE_INLINE float estimate_acceleration_distance(float initial_rate, float target_rate, float acceleration) { if (acceleration!=0) { - return((target_rate*target_rate-initial_rate*initial_rate)/ - (2.0*acceleration)); + return((target_rate*target_rate-initial_rate*initial_rate)/ + (2.0*acceleration)); } else { return 0.0; // acceleration was 0, set acceleration distance to 0 @@ -149,9 +155,9 @@ FORCE_INLINE float estimate_acceleration_distance(float initial_rate, float targ FORCE_INLINE float intersection_distance(float initial_rate, float final_rate, float acceleration, float distance) { - if (acceleration!=0) { - return((2.0*acceleration*distance-initial_rate*initial_rate+final_rate*final_rate)/ - (4.0*acceleration) ); + if (acceleration!=0) { + return((2.0*acceleration*distance-initial_rate*initial_rate+final_rate*final_rate)/ + (4.0*acceleration) ); } else { return 0.0; // acceleration was 0, set intersection distance to 0 @@ -165,46 +171,50 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi unsigned long final_rate = ceil(block->nominal_rate*exit_factor); // (step/min) // Limit minimal step rate (Otherwise the timer will overflow.) - if(initial_rate <120) {initial_rate=120; } - if(final_rate < 120) {final_rate=120; } - + if(initial_rate <120) { + initial_rate=120; + } + if(final_rate < 120) { + final_rate=120; + } + long acceleration = block->acceleration_st; int32_t accelerate_steps = ceil(estimate_acceleration_distance(block->initial_rate, block->nominal_rate, acceleration)); int32_t decelerate_steps = floor(estimate_acceleration_distance(block->nominal_rate, block->final_rate, -acceleration)); - + // Calculate the size of Plateau of Nominal Rate. int32_t plateau_steps = block->step_event_count-accelerate_steps-decelerate_steps; - + // Is the Plateau of Nominal Rate smaller than nothing? That means no cruising, and we will // have to use intersection_distance() to calculate when to abort acceleration and start braking // in order to reach the final_rate exactly at the end of this block. if (plateau_steps < 0) { accelerate_steps = ceil( - intersection_distance(block->initial_rate, block->final_rate, acceleration, block->step_event_count)); + intersection_distance(block->initial_rate, block->final_rate, acceleration, block->step_event_count)); accelerate_steps = max(accelerate_steps,0); // Check limits due to numerical round-off accelerate_steps = min(accelerate_steps,block->step_event_count); plateau_steps = 0; } - #ifdef ADVANCE - volatile long initial_advance = block->advance*entry_factor*entry_factor; - volatile long final_advance = block->advance*exit_factor*exit_factor; - #endif // ADVANCE - - // block->accelerate_until = accelerate_steps; - // block->decelerate_after = accelerate_steps+plateau_steps; +#ifdef ADVANCE + volatile long initial_advance = block->advance*entry_factor*entry_factor; + volatile long final_advance = block->advance*exit_factor*exit_factor; +#endif // ADVANCE + + // block->accelerate_until = accelerate_steps; + // block->decelerate_after = accelerate_steps+plateau_steps; CRITICAL_SECTION_START; // Fill variables used by the stepper in a critical section if(block->busy == false) { // Don't update variables if block is busy. block->accelerate_until = accelerate_steps; block->decelerate_after = accelerate_steps+plateau_steps; block->initial_rate = initial_rate; block->final_rate = final_rate; - #ifdef ADVANCE - block->initial_advance = initial_advance; - block->final_advance = final_advance; - #endif //ADVANCE +#ifdef ADVANCE + block->initial_advance = initial_advance; + block->final_advance = final_advance; +#endif //ADVANCE } CRITICAL_SECTION_END; } @@ -226,24 +236,27 @@ FORCE_INLINE float max_allowable_speed(float acceleration, float target_velocity // The kernel called by planner_recalculate() when scanning the plan from last to first entry. void planner_reverse_pass_kernel(block_t *previous, block_t *current, block_t *next) { - if(!current) { return; } - - if (next) { + if(!current) { + return; + } + + if (next) { // If entry speed is already at the maximum entry speed, no need to recheck. Block is cruising. // If not, block in state of acceleration or deceleration. Reset entry speed to maximum and // check for maximum allowable speed reductions to ensure maximum possible planned speed. if (current->entry_speed != current->max_entry_speed) { - + // If nominal length true, max junction speed is guaranteed to be reached. Only compute // for max allowable speed if block is decelerating and nominal length is false. if ((!current->nominal_length_flag) && (current->max_entry_speed > next->entry_speed)) { current->entry_speed = min( current->max_entry_speed, - max_allowable_speed(-current->acceleration,next->entry_speed,current->millimeters)); - } else { + max_allowable_speed(-current->acceleration,next->entry_speed,current->millimeters)); + } + else { current->entry_speed = current->max_entry_speed; } current->recalculate_flag = true; - + } } // Skip last block. Already initialized and set for recalculation. } @@ -252,10 +265,17 @@ void planner_reverse_pass_kernel(block_t *previous, block_t *current, block_t *n // implements the reverse pass. void planner_reverse_pass() { uint8_t block_index = block_buffer_head; - if(((block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1)) > 3) { + + //Make a local copy of block_buffer_tail, because the interrupt can alter it + CRITICAL_SECTION_START; + unsigned char tail = block_buffer_tail; + CRITICAL_SECTION_END + + if(((block_buffer_head-tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1)) > 3) { block_index = (block_buffer_head - 3) & (BLOCK_BUFFER_SIZE - 1); - block_t *block[3] = { NULL, NULL, NULL }; - while(block_index != block_buffer_tail) { + block_t *block[3] = { + NULL, NULL, NULL }; + while(block_index != tail) { block_index = prev_block_index(block_index); block[2]= block[1]; block[1]= block[0]; @@ -267,8 +287,10 @@ void planner_reverse_pass() { // The kernel called by planner_recalculate() when scanning the plan from first to last entry. void planner_forward_pass_kernel(block_t *previous, block_t *current, block_t *next) { - if(!previous) { return; } - + if(!previous) { + return; + } + // If the previous block is an acceleration block, but it is not long enough to complete the // full speed change within the block, we need to adjust the entry speed accordingly. Entry // speeds have already been reset, maximized, and reverse planned by reverse planner. @@ -276,7 +298,7 @@ void planner_forward_pass_kernel(block_t *previous, block_t *current, block_t *n if (!previous->nominal_length_flag) { if (previous->entry_speed < current->entry_speed) { double entry_speed = min( current->entry_speed, - max_allowable_speed(-previous->acceleration,previous->entry_speed,previous->millimeters) ); + max_allowable_speed(-previous->acceleration,previous->entry_speed,previous->millimeters) ); // Check for junction speed change if (current->entry_speed != entry_speed) { @@ -291,7 +313,8 @@ void planner_forward_pass_kernel(block_t *previous, block_t *current, block_t *n // implements the forward pass. void planner_forward_pass() { uint8_t block_index = block_buffer_tail; - block_t *block[3] = { NULL, NULL, NULL }; + block_t *block[3] = { + NULL, NULL, NULL }; while(block_index != block_buffer_head) { block[0] = block[1]; @@ -310,7 +333,7 @@ void planner_recalculate_trapezoids() { int8_t block_index = block_buffer_tail; block_t *current; block_t *next = NULL; - + while(block_index != block_buffer_head) { current = next; next = &block_buffer[block_index]; @@ -319,7 +342,7 @@ void planner_recalculate_trapezoids() { if (current->recalculate_flag || next->recalculate_flag) { // NOTE: Entry and exit factors always > 0 by all previous logic operations. calculate_trapezoid_for_block(current, current->entry_speed/current->nominal_speed, - next->entry_speed/current->nominal_speed); + next->entry_speed/current->nominal_speed); current->recalculate_flag = false; // Reset current only to ensure next trapezoid is computed } } @@ -328,7 +351,7 @@ void planner_recalculate_trapezoids() { // Last/newest block in buffer. Exit speed is set with MINIMUM_PLANNER_SPEED. Always recalculated. if(next != NULL) { calculate_trapezoid_for_block(next, next->entry_speed/next->nominal_speed, - MINIMUM_PLANNER_SPEED/next->nominal_speed); + MINIMUM_PLANNER_SPEED/next->nominal_speed); next->recalculate_flag = false; } } @@ -380,14 +403,14 @@ void getHighESpeed() if(degTargetHotend0()+2high) @@ -397,7 +420,7 @@ void getHighESpeed() } block_index = (block_index+1) & (BLOCK_BUFFER_SIZE - 1); } - + float g=autotemp_min+high*autotemp_factor; float t=g; if(t -1 - if (FanSpeed != 0){ - analogWrite(FAN_PIN,FanSpeed); // If buffer is empty use current fan speed - } - #endif +#if FAN_PIN > -1 + if (FanSpeed != 0){ + analogWrite(FAN_PIN,FanSpeed); // If buffer is empty use current fan speed + } +#endif } if((DISABLE_X) && (x_active == 0)) disable_x(); if((DISABLE_Y) && (y_active == 0)) disable_y(); if((DISABLE_Z) && (z_active == 0)) disable_z(); - if((DISABLE_E) && (e_active == 0)) { disable_e0();disable_e1();disable_e2(); } - #if FAN_PIN > -1 + if((DISABLE_E) && (e_active == 0)) { + disable_e0(); + disable_e1(); + disable_e2(); + } +#if FAN_PIN > -1 if((FanSpeed == 0) && (fan_speed ==0)) { analogWrite(FAN_PIN, 0); } @@ -454,10 +481,10 @@ void check_axes_activity() { if (FanSpeed != 0 && tail_fan_speed !=0) { analogWrite(FAN_PIN,tail_fan_speed); } - #endif - #ifdef AUTOTEMP - getHighESpeed(); - #endif +#endif +#ifdef AUTOTEMP + getHighESpeed(); +#endif } @@ -477,7 +504,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa manage_inactivity(1); LCD_STATUS; } - + // The target position of the tool in absolute steps // Calculate target position in absolute steps //this should be done after the wait, because otherwise a M92 code within the gcode disrupts this calculation somehow @@ -486,28 +513,28 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa target[Y_AXIS] = lround(y*axis_steps_per_unit[Y_AXIS]); target[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]); target[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]); - - #ifdef PREVENT_DANGEROUS_EXTRUDE - if(target[E_AXIS]!=position[E_AXIS]) + +#ifdef PREVENT_DANGEROUS_EXTRUDE + if(target[E_AXIS]!=position[E_AXIS]) if(degHotend(active_extruder)axis_steps_per_unit[E_AXIS]*EXTRUDE_MAXLENGTH) - { - position[E_AXIS]=target[E_AXIS]; //behave as if the move really took place, but ignore E part - SERIAL_ECHO_START; - SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP); - } - #endif - #endif - +#ifdef PREVENT_LENGTHY_EXTRUDE + if(labs(target[E_AXIS]-position[E_AXIS])>axis_steps_per_unit[E_AXIS]*EXTRUDE_MAXLENGTH) + { + position[E_AXIS]=target[E_AXIS]; //behave as if the move really took place, but ignore E part + SERIAL_ECHO_START; + SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP); + } +#endif +#endif + // Prepare to set up new block block_t *block = &block_buffer[block_buffer_head]; - + // Mark block as not busy (Not executed by the stepper interrupt) block->busy = false; @@ -521,36 +548,50 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa block->step_event_count = max(block->steps_x, max(block->steps_y, max(block->steps_z, block->steps_e))); // Bail if this is a zero-length block - if (block->step_event_count <= dropsegments) { return; }; + if (block->step_event_count <= dropsegments) { + return; + }; block->fan_speed = FanSpeed; - + // Compute direction bits for this block block->direction_bits = 0; - if (target[X_AXIS] < position[X_AXIS]) { block->direction_bits |= (1<direction_bits |= (1<direction_bits |= (1<direction_bits |= (1<direction_bits |= (1<direction_bits |= (1<direction_bits |= (1<direction_bits |= (1<active_extruder = extruder; - + //enable active axes if(block->steps_x != 0) enable_x(); if(block->steps_y != 0) enable_y(); - #ifndef Z_LATE_ENABLE - if(block->steps_z != 0) enable_z(); - #endif +#ifndef Z_LATE_ENABLE + if(block->steps_z != 0) enable_z(); +#endif // Enable all - if(block->steps_e != 0) { enable_e0();enable_e1();enable_e2(); } + if(block->steps_e != 0) { + enable_e0(); + enable_e1(); + enable_e2(); + } if (block->steps_e == 0) { - if(feed_ratesteps_x <=dropsegments && block->steps_y <=dropsegments && block->steps_z <=dropsegments ) { block->millimeters = fabs(delta_mm[E_AXIS]); - } else { + } + else { block->millimeters = sqrt(square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_AXIS])); } float inverse_millimeters = 1.0/block->millimeters; // Inverse millimeters to remove multiple divides - - // Calculate speed in mm/second for each axis. No divide by zero due to previous checks. + + // Calculate speed in mm/second for each axis. No divide by zero due to previous checks. float inverse_second = feed_rate * inverse_millimeters; - + int moves_queued=(block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1); - + // slow down when de buffer starts to empty, rather than wait at the corner for a buffer refill - #ifdef OLD_SLOWDOWN - if(moves_queued < (BLOCK_BUFFER_SIZE * 0.5) && moves_queued > 1) feed_rate = feed_rate*moves_queued / (BLOCK_BUFFER_SIZE * 0.5); - #endif +#ifdef OLD_SLOWDOWN + if(moves_queued < (BLOCK_BUFFER_SIZE * 0.5) && moves_queued > 1) feed_rate = feed_rate*moves_queued / (BLOCK_BUFFER_SIZE * 0.5); +#endif - #ifdef SLOWDOWN +#ifdef SLOWDOWN // segment time im micro seconds unsigned long segment_time = lround(1000000.0/inverse_second); if ((moves_queued > 1) && (moves_queued < (BLOCK_BUFFER_SIZE * 0.5))) { if (segment_time < minsegmenttime) { // buffer is draining, add extra time. The amount of time added increases if the buffer is still emptied more. - inverse_second=1000000.0/(segment_time+lround(2*(minsegmenttime-segment_time)/moves_queued)); + inverse_second=1000000.0/(segment_time+lround(2*(minsegmenttime-segment_time)/moves_queued)); } } - #endif +#endif // END OF SLOW DOWN SECTION - + block->nominal_speed = block->millimeters * inverse_second; // (mm/sec) Always > 0 block->nominal_rate = ceil(block->step_event_count * inverse_second); // (step/sec) Always > 0 - // Calculate and limit speed in mm/sec for each axis + // Calculate and limit speed in mm/sec for each axis float current_speed[4]; float speed_factor = 1.0; //factor <=1 do decrease speed for(int i=0; i < 4; i++) { @@ -597,7 +639,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa speed_factor = min(speed_factor, max_feedrate[i] / fabs(current_speed[i])); } -// Max segement time in us. + // Max segement time in us. #ifdef XY_FREQUENCY_LIMIT #define MAX_FREQ_TIME (1000000.0/XY_FREQUENCY_LIMIT) @@ -606,7 +648,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa old_direction_bits = block->direction_bits; if((direction_change & (1<acceleration = block->acceleration_st / steps_per_mm; block->acceleration_rate = (long)((float)block->acceleration_st * 8.388608); - + #if 0 // Use old jerk for now // Compute path unit vector double unit_vec[3]; @@ -663,7 +705,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa unit_vec[X_AXIS] = delta_mm[X_AXIS]*inverse_millimeters; unit_vec[Y_AXIS] = delta_mm[Y_AXIS]*inverse_millimeters; unit_vec[Z_AXIS] = delta_mm[Z_AXIS]*inverse_millimeters; - + // Compute maximum allowable entry speed at junction by centripetal acceleration approximation. // Let a circle be tangent to both previous and current path line segments, where the junction // deviation is defined as the distance from the junction to the closest edge of the circle, @@ -680,9 +722,9 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa // Compute cosine of angle between previous and current path. (prev_unit_vec is negative) // NOTE: Max junction velocity is computed without sin() or acos() by trig half angle identity. double cos_theta = - previous_unit_vec[X_AXIS] * unit_vec[X_AXIS] - - previous_unit_vec[Y_AXIS] * unit_vec[Y_AXIS] - - previous_unit_vec[Z_AXIS] * unit_vec[Z_AXIS] ; - + - previous_unit_vec[Y_AXIS] * unit_vec[Y_AXIS] + - previous_unit_vec[Z_AXIS] * unit_vec[Z_AXIS] ; + // Skip and use default max junction speed for 0 degree acute junction. if (cos_theta < 0.95) { vmax_junction = min(previous_nominal_speed,block->nominal_speed); @@ -691,36 +733,39 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa // Compute maximum junction velocity based on maximum acceleration and junction deviation double sin_theta_d2 = sqrt(0.5*(1.0-cos_theta)); // Trig half angle identity. Always positive. vmax_junction = min(vmax_junction, - sqrt(block->acceleration * junction_deviation * sin_theta_d2/(1.0-sin_theta_d2)) ); + sqrt(block->acceleration * junction_deviation * sin_theta_d2/(1.0-sin_theta_d2)) ); } } } #endif // Start with a safe speed - float vmax_junction = max_xy_jerk/2; + float vmax_junction = max_xy_jerk/2; + float vmax_junction_factor = 1.0; if(fabs(current_speed[Z_AXIS]) > max_z_jerk/2) - vmax_junction = max_z_jerk/2; - vmax_junction = min(vmax_junction, block->nominal_speed); + vmax_junction = min(vmax_junction, max_z_jerk/2); if(fabs(current_speed[E_AXIS]) > max_e_jerk/2) vmax_junction = min(vmax_junction, max_e_jerk/2); - + vmax_junction = min(vmax_junction, block->nominal_speed); + float safe_speed = vmax_junction; + if ((moves_queued > 1) && (previous_nominal_speed > 0.0001)) { float jerk = sqrt(pow((current_speed[X_AXIS]-previous_speed[X_AXIS]), 2)+pow((current_speed[Y_AXIS]-previous_speed[Y_AXIS]), 2)); - if((fabs(previous_speed[X_AXIS]) > 0.0001) || (fabs(previous_speed[Y_AXIS]) > 0.0001)) { - vmax_junction = block->nominal_speed; - } + // if((fabs(previous_speed[X_AXIS]) > 0.0001) || (fabs(previous_speed[Y_AXIS]) > 0.0001)) { + vmax_junction = block->nominal_speed; + // } if (jerk > max_xy_jerk) { - vmax_junction *= (max_xy_jerk/jerk); + vmax_junction_factor = (max_xy_jerk/jerk); } if(fabs(current_speed[Z_AXIS] - previous_speed[Z_AXIS]) > max_z_jerk) { - vmax_junction *= (max_z_jerk/fabs(current_speed[Z_AXIS] - previous_speed[Z_AXIS])); + vmax_junction_factor= min(vmax_junction_factor, (max_z_jerk/fabs(current_speed[Z_AXIS] - previous_speed[Z_AXIS]))); } if(fabs(current_speed[E_AXIS] - previous_speed[E_AXIS]) > max_e_jerk) { - vmax_junction *= (max_e_jerk/fabs(current_speed[E_AXIS] - previous_speed[E_AXIS])); + vmax_junction_factor = min(vmax_junction_factor, (max_e_jerk/fabs(current_speed[E_AXIS] - previous_speed[E_AXIS]))); } + vmax_junction = min(previous_nominal_speed, vmax_junction * vmax_junction_factor); // Limit speed to max previous speed } block->max_entry_speed = vmax_junction; - + // Initialize block entry speed. Compute based on deceleration to user-defined MINIMUM_PLANNER_SPEED. double v_allowable = max_allowable_speed(-block->acceleration,MINIMUM_PLANNER_SPEED,block->millimeters); block->entry_speed = min(vmax_junction, v_allowable); @@ -733,48 +778,52 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa // block nominal speed limits both the current and next maximum junction speeds. Hence, in both // the reverse and forward planners, the corresponding block junction speed will always be at the // the maximum junction speed and may always be ignored for any speed reduction checks. - if (block->nominal_speed <= v_allowable) { block->nominal_length_flag = true; } - else { block->nominal_length_flag = false; } + if (block->nominal_speed <= v_allowable) { + block->nominal_length_flag = true; + } + else { + block->nominal_length_flag = false; + } block->recalculate_flag = true; // Always calculate trapezoid for new block - + // Update previous path unit_vector and nominal speed memcpy(previous_speed, current_speed, sizeof(previous_speed)); // previous_speed[] = current_speed[] previous_nominal_speed = block->nominal_speed; - - #ifdef ADVANCE - // Calculate advance rate - if((block->steps_e == 0) || (block->steps_x == 0 && block->steps_y == 0 && block->steps_z == 0)) { + +#ifdef ADVANCE + // Calculate advance rate + if((block->steps_e == 0) || (block->steps_x == 0 && block->steps_y == 0 && block->steps_z == 0)) { + block->advance_rate = 0; + block->advance = 0; + } + else { + long acc_dist = estimate_acceleration_distance(0, block->nominal_rate, block->acceleration_st); + float advance = (STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K) * + (current_speed[E_AXIS] * current_speed[E_AXIS] * EXTRUTION_AREA * EXTRUTION_AREA)*256; + block->advance = advance; + if(acc_dist == 0) { block->advance_rate = 0; - block->advance = 0; - } + } else { - long acc_dist = estimate_acceleration_distance(0, block->nominal_rate, block->acceleration_st); - float advance = (STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K) * - (current_speed[E_AXIS] * current_speed[E_AXIS] * EXTRUTION_AREA * EXTRUTION_AREA)*256; - block->advance = advance; - if(acc_dist == 0) { - block->advance_rate = 0; - } - else { - block->advance_rate = advance / (float)acc_dist; - } + block->advance_rate = advance / (float)acc_dist; } - /* + } + /* SERIAL_ECHO_START; - SERIAL_ECHOPGM("advance :"); - SERIAL_ECHO(block->advance/256.0); - SERIAL_ECHOPGM("advance rate :"); - SERIAL_ECHOLN(block->advance_rate/256.0); - */ - #endif // ADVANCE + SERIAL_ECHOPGM("advance :"); + SERIAL_ECHO(block->advance/256.0); + SERIAL_ECHOPGM("advance rate :"); + SERIAL_ECHOLN(block->advance_rate/256.0); + */ +#endif // ADVANCE calculate_trapezoid_for_block(block, block->entry_speed/block->nominal_speed, - MINIMUM_PLANNER_SPEED/block->nominal_speed); - + safe_speed/block->nominal_speed); + // Move buffer head block_buffer_head = next_buffer_head; - + // Update position memcpy(position, target, sizeof(target)); // position[] = target[] @@ -805,12 +854,13 @@ void plan_set_e_position(const float &e) uint8_t movesplanned() { - return (block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1); + return (block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1); } void allow_cold_extrudes(bool allow) { - #ifdef PREVENT_DANGEROUS_EXTRUDE - allow_cold_extrude=allow; - #endif +#ifdef PREVENT_DANGEROUS_EXTRUDE + allow_cold_extrude=allow; +#endif } + diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 13f18bc36831..aba44e8e157a 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -214,6 +214,12 @@ void st_wake_up() { ENABLE_STEPPER_DRIVER_INTERRUPT(); } +void step_wait(){ + for(int8_t i=0; i < 6; i++){ + } +} + + FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) { unsigned short timer; if(step_rate > MAX_STEP_FREQUENCY) step_rate = MAX_STEP_FREQUENCY; @@ -261,12 +267,10 @@ FORCE_INLINE void trapezoid_generator_reset() { #endif deceleration_time = 0; // step_rate to timer interval + OCR1A_nominal = calc_timer(current_block->nominal_rate); acc_step_rate = current_block->initial_rate; acceleration_time = calc_timer(acc_step_rate); OCR1A = acceleration_time; - OCR1A_nominal = calc_timer(current_block->nominal_rate); - - // SERIAL_ECHO_START; // SERIAL_ECHOPGM("advance :"); @@ -319,8 +323,10 @@ ISR(TIMER1_COMPA_vect) out_bits = current_block->direction_bits; // Set direction en check limit switches - if ((out_bits & (1<steps_x >= current_block->steps_y)&&((out_bits & (1<steps_x >= current_block->steps_y)&&((out_bits & (1<steps_y > current_block->steps_x)&&((out_bits & (1<steps_y > current_block->steps_x)&&((out_bits & (1<steps_x; - if (counter_x > 0) { - WRITE(X_STEP_PIN, HIGH); - counter_x -= current_block->step_event_count; - WRITE(X_STEP_PIN, LOW); - count_position[X_AXIS]+=count_direction[X_AXIS]; - } - - counter_y += current_block->steps_y; - if (counter_y > 0) { - WRITE(Y_STEP_PIN, HIGH); - counter_y -= current_block->step_event_count; - WRITE(Y_STEP_PIN, LOW); - count_position[Y_AXIS]+=count_direction[Y_AXIS]; - } + #if !defined COREXY + counter_x += current_block->steps_x; + if (counter_x > 0) { + WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN); + counter_x -= current_block->step_event_count; + count_position[X_AXIS]+=count_direction[X_AXIS]; + WRITE(X_STEP_PIN, INVERT_X_STEP_PIN); + } + + counter_y += current_block->steps_y; + if (counter_y > 0) { + WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN); + counter_y -= current_block->step_event_count; + count_position[Y_AXIS]+=count_direction[Y_AXIS]; + WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN); + } + #endif + + #ifdef COREXY + counter_x += current_block->steps_x; + counter_y += current_block->steps_y; + + if ((counter_x > 0)&&!(counter_y>0)){ //X step only + WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN); + WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN); + counter_x -= current_block->step_event_count; + count_position[X_AXIS]+=count_direction[X_AXIS]; + WRITE(X_STEP_PIN, INVERT_X_STEP_PIN); + WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN); + } + + if (!(counter_x > 0)&&(counter_y>0)){ //Y step only + WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN); + WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN); + counter_y -= current_block->step_event_count; + count_position[Y_AXIS]+=count_direction[Y_AXIS]; + WRITE(X_STEP_PIN, INVERT_X_STEP_PIN); + WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN); + } + + if ((counter_x > 0)&&(counter_y>0)){ //step in both axes + if (((out_bits & (1<step_event_count; + WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN); + step_wait(); + count_position[X_AXIS]+=count_direction[X_AXIS]; + count_position[Y_AXIS]+=count_direction[Y_AXIS]; + WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN); + counter_y -= current_block->step_event_count; + WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN); + } + else{ //X and Y in same direction + WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN); + counter_x -= current_block->step_event_count; + WRITE(X_STEP_PIN, INVERT_X_STEP_PIN) ; + step_wait(); + count_position[X_AXIS]+=count_direction[X_AXIS]; + count_position[Y_AXIS]+=count_direction[Y_AXIS]; + WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN); + counter_y -= current_block->step_event_count; + WRITE(X_STEP_PIN, INVERT_X_STEP_PIN); + } + } + #endif //corexy + counter_z += current_block->steps_z; if (counter_z > 0) { - WRITE(Z_STEP_PIN, HIGH); + WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN); counter_z -= current_block->step_event_count; - WRITE(Z_STEP_PIN, LOW); count_position[Z_AXIS]+=count_direction[Z_AXIS]; + WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN); } #ifndef ADVANCE counter_e += current_block->steps_e; if (counter_e > 0) { - WRITE_E_STEP(HIGH); + WRITE_E_STEP(!INVERT_E_STEP_PIN); counter_e -= current_block->step_event_count; - WRITE_E_STEP(LOW); count_position[E_AXIS]+=count_direction[E_AXIS]; + WRITE_E_STEP(INVERT_E_STEP_PIN); } #endif //!ADVANCE step_events_completed += 1; @@ -563,45 +647,45 @@ ISR(TIMER1_COMPA_vect) // Set E direction (Depends on E direction + advance) for(unsigned char i=0; i<4;i++) { if (e_steps[0] != 0) { - WRITE(E0_STEP_PIN, LOW); + WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN); if (e_steps[0] < 0) { WRITE(E0_DIR_PIN, INVERT_E0_DIR); e_steps[0]++; - WRITE(E0_STEP_PIN, HIGH); + WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN); } else if (e_steps[0] > 0) { WRITE(E0_DIR_PIN, !INVERT_E0_DIR); e_steps[0]--; - WRITE(E0_STEP_PIN, HIGH); + WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN); } } #if EXTRUDERS > 1 if (e_steps[1] != 0) { - WRITE(E1_STEP_PIN, LOW); + WRITE(E1_STEP_PIN, INVERT_E_STEP_PIN); if (e_steps[1] < 0) { WRITE(E1_DIR_PIN, INVERT_E1_DIR); e_steps[1]++; - WRITE(E1_STEP_PIN, HIGH); + WRITE(E1_STEP_PIN, !INVERT_E_STEP_PIN); } else if (e_steps[1] > 0) { WRITE(E1_DIR_PIN, !INVERT_E1_DIR); e_steps[1]--; - WRITE(E1_STEP_PIN, HIGH); + WRITE(E1_STEP_PIN, !INVERT_E_STEP_PIN); } } #endif #if EXTRUDERS > 2 if (e_steps[2] != 0) { - WRITE(E2_STEP_PIN, LOW); + WRITE(E2_STEP_PIN, INVERT_E_STEP_PIN); if (e_steps[2] < 0) { WRITE(E2_DIR_PIN, INVERT_E2_DIR); e_steps[2]++; - WRITE(E2_STEP_PIN, HIGH); + WRITE(E2_STEP_PIN, !INVERT_E_STEP_PIN); } else if (e_steps[2] > 0) { WRITE(E2_DIR_PIN, !INVERT_E2_DIR); e_steps[2]--; - WRITE(E2_STEP_PIN, HIGH); + WRITE(E2_STEP_PIN, !INVERT_E_STEP_PIN); } } #endif @@ -659,76 +743,79 @@ void st_init() #endif //endstops and pullups - #ifdef ENDSTOPPULLUPS - #if X_MIN_PIN > -1 - SET_INPUT(X_MIN_PIN); + + #if X_MIN_PIN > -1 + SET_INPUT(X_MIN_PIN); + #ifdef ENDSTOPPULLUP_XMIN WRITE(X_MIN_PIN,HIGH); #endif - #if X_MAX_PIN > -1 - SET_INPUT(X_MAX_PIN); - WRITE(X_MAX_PIN,HIGH); - #endif - #if Y_MIN_PIN > -1 - SET_INPUT(Y_MIN_PIN); + #endif + + #if Y_MIN_PIN > -1 + SET_INPUT(Y_MIN_PIN); + #ifdef ENDSTOPPULLUP_YMIN WRITE(Y_MIN_PIN,HIGH); #endif - #if Y_MAX_PIN > -1 - SET_INPUT(Y_MAX_PIN); - WRITE(Y_MAX_PIN,HIGH); - #endif - #if Z_MIN_PIN > -1 - SET_INPUT(Z_MIN_PIN); + #endif + + #if Z_MIN_PIN > -1 + SET_INPUT(Z_MIN_PIN); + #ifdef ENDSTOPPULLUP_ZMIN WRITE(Z_MIN_PIN,HIGH); #endif - #if Z_MAX_PIN > -1 - SET_INPUT(Z_MAX_PIN); - WRITE(Z_MAX_PIN,HIGH); - #endif - #else //ENDSTOPPULLUPS - #if X_MIN_PIN > -1 - SET_INPUT(X_MIN_PIN); - #endif - #if X_MAX_PIN > -1 - SET_INPUT(X_MAX_PIN); - #endif - #if Y_MIN_PIN > -1 - SET_INPUT(Y_MIN_PIN); - #endif - #if Y_MAX_PIN > -1 - SET_INPUT(Y_MAX_PIN); + #endif + + #if X_MAX_PIN > -1 + SET_INPUT(X_MAX_PIN); + #ifdef ENDSTOPPULLUP_XMAX + WRITE(X_MAX_PIN,HIGH); #endif - #if Z_MIN_PIN > -1 - SET_INPUT(Z_MIN_PIN); + #endif + + #if Y_MAX_PIN > -1 + SET_INPUT(Y_MAX_PIN); + #ifdef ENDSTOPPULLUP_YMAX + WRITE(Y_MAX_PIN,HIGH); #endif - #if Z_MAX_PIN > -1 - SET_INPUT(Z_MAX_PIN); + #endif + + #if Z_MAX_PIN > -1 + SET_INPUT(Z_MAX_PIN); + #ifdef ENDSTOPPULLUP_ZMAX + WRITE(Z_MAX_PIN,HIGH); #endif - #endif //ENDSTOPPULLUPS + #endif //Initialize Step Pins #if (X_STEP_PIN > -1) SET_OUTPUT(X_STEP_PIN); + WRITE(X_STEP_PIN,INVERT_X_STEP_PIN); if(!X_ENABLE_ON) WRITE(X_ENABLE_PIN,HIGH); #endif #if (Y_STEP_PIN > -1) SET_OUTPUT(Y_STEP_PIN); + WRITE(Y_STEP_PIN,INVERT_Y_STEP_PIN); if(!Y_ENABLE_ON) WRITE(Y_ENABLE_PIN,HIGH); #endif #if (Z_STEP_PIN > -1) SET_OUTPUT(Z_STEP_PIN); + WRITE(Z_STEP_PIN,INVERT_Z_STEP_PIN); if(!Z_ENABLE_ON) WRITE(Z_ENABLE_PIN,HIGH); #endif #if (E0_STEP_PIN > -1) SET_OUTPUT(E0_STEP_PIN); + WRITE(E0_STEP_PIN,INVERT_E_STEP_PIN); if(!E_ENABLE_ON) WRITE(E0_ENABLE_PIN,HIGH); #endif #if defined(E1_STEP_PIN) && (E1_STEP_PIN > -1) SET_OUTPUT(E1_STEP_PIN); + WRITE(E1_STEP_PIN,INVERT_E_STEP_PIN); if(!E_ENABLE_ON) WRITE(E1_ENABLE_PIN,HIGH); #endif #if defined(E2_STEP_PIN) && (E2_STEP_PIN > -1) SET_OUTPUT(E2_STEP_PIN); + WRITE(E2_STEP_PIN,INVERT_E_STEP_PIN); if(!E_ENABLE_ON) WRITE(E2_ENABLE_PIN,HIGH); #endif diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index 72df26d1e030..dc44d1cda9ca 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -1,5 +1,5 @@ -#ifndef __ULTRALCDH -#define __ULTRALCDH +#ifndef ULTRALCD_H +#define ULTRALCD_H #include "Marlin.h" #ifdef ULTRA_LCD #include @@ -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 d1b93ddb3256..7c495cae221f 100644 --- a/Marlin/ultralcd.pde +++ b/Marlin/ultralcd.pde @@ -957,7 +957,7 @@ enum { #if EXTRUDERS > 2 ItemCT_nozzle2, #endif -#if defined BED_USES_THERMISTOR || BED_USES_AD595 +#if defined BED_USES_THERMISTOR || defined BED_USES_AD595 ItemCT_bed, #endif ItemCT_fan, @@ -1212,7 +1212,7 @@ void MainMenu::showControlTemp() }break; #endif //autotemp - #if defined BED_USES_THERMISTOR || BED_USES_AD595 + #if defined BED_USES_THERMISTOR || defined BED_USES_AD595 case ItemCT_bed: { if(force_lcd_update) @@ -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(); diff --git a/Marlin/watchdog.h b/Marlin/watchdog.h index ff6af60afdc5..937379b69676 100644 --- a/Marlin/watchdog.h +++ b/Marlin/watchdog.h @@ -1,5 +1,5 @@ -#ifndef __WATCHDOGH -#define __WATCHDOGH +#ifndef WATCHDOG_H +#define WATCHDOG_H #include "Marlin.h" #ifdef USE_WATCHDOG diff --git a/README.md b/README.md index f95ce6ce6fb5..86dd93de952d 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ Features: * Updated sdcardlib * Heater power reporting. Useful for PID monitoring. * PID tuning +* CoreXY kinematics (www.corexy.com/theory.html) The default baudrate is 250000. This baudrate has less jitter and hence errors than the usual 115200 baud, but is less supported by drivers and host-environments. @@ -103,7 +104,7 @@ Also, backup copies of various operating systems are hidden, as well as files no *SD card folders:* -If you place a file auto<0-9>.g into the root of the sd card, it will be automatically executed if you boot the printer. The same file will be executed by selecting "Autostart" from the menu. +If you place a file auto[0-9].g into the root of the sd card, it will be automatically executed if you boot the printer. The same file will be executed by selecting "Autostart" from the menu. First *0 will be performed, than *1 and so on. That way, you can heat up or even print automatically without user interaction. *Endstop trigger reporting:*