From 9157cbd8f340579958901c2e77dbcfba687d54d7 Mon Sep 17 00:00:00 2001 From: alexborro Date: Wed, 11 Mar 2015 13:19:02 -0300 Subject: [PATCH] Add Travel Acceleration and change the M204 options Added option to set Travel Acceleration (non printing moves). The M204 options was a non sense (S for printing moves and T for retract moves). It has been changed to: P = Printing moves R = Retract only (no X, Y, Z) moves T = Travel (non printing) moves I will add this info o G-Code wiki in reprap.org. I also advise to put this info in Marlin next version changelog. --- Marlin/Configuration.h | 5 ++-- Marlin/ConfigurationStore.cpp | 15 ++++++---- Marlin/Marlin_main.cpp | 28 +++++++++++++++---- .../Hephestos/Configuration.h | 7 +++-- .../K8200/Configuration.h | 6 ++-- .../SCARA/Configuration.h | 7 +++-- .../WITBOX/Configuration.h | 5 ++-- .../delta/Configuration.h | 6 ++-- .../makibox/Configuration.h | 5 ++-- .../tvrrug/Round2/Configuration.h | 6 ++-- Marlin/language_en.h | 3 ++ Marlin/planner.cpp | 7 ++++- Marlin/planner.h | 1 + Marlin/ultralcd.cpp | 1 + 14 files changed, 75 insertions(+), 27 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 890a87dd20..f279ef0328 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -484,8 +484,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define DEFAULT_MAX_FEEDRATE {300, 300, 5, 25} // (mm/sec) #define DEFAULT_MAX_ACCELERATION {3000,3000,100,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot. -#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves -#define DEFAULT_RETRACT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for retracts +#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration in mm/s^2 for printing moves +#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration in mm/s^2 for retracts +#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). diff --git a/Marlin/ConfigurationStore.cpp b/Marlin/ConfigurationStore.cpp index b80aa038da..0dee05ba78 100644 --- a/Marlin/ConfigurationStore.cpp +++ b/Marlin/ConfigurationStore.cpp @@ -3,7 +3,7 @@ * * Configuration and EEPROM storage * - * V15 EEPROM Layout: + * V16 EEPROM Layout: * * ver * axis_steps_per_unit (x4) @@ -11,6 +11,7 @@ * max_acceleration_units_per_sq_second (x4) * acceleration * retract_acceleration + * travel_aceeleration * minimumfeedrate * mintravelfeedrate * minsegmenttime @@ -104,7 +105,7 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) { // wrong data being written to the variables. // ALSO: always make sure the variables in the Store and retrieve sections are in the same order. -#define EEPROM_VERSION "V15" +#define EEPROM_VERSION "V16" #ifdef EEPROM_SETTINGS @@ -118,6 +119,7 @@ void Config_StoreSettings() { EEPROM_WRITE_VAR(i, max_acceleration_units_per_sq_second); EEPROM_WRITE_VAR(i, acceleration); EEPROM_WRITE_VAR(i, retract_acceleration); + EEPROM_WRITE_VAR(i, travel_acceleration); EEPROM_WRITE_VAR(i, minimumfeedrate); EEPROM_WRITE_VAR(i, mintravelfeedrate); EEPROM_WRITE_VAR(i, minsegmenttime); @@ -253,6 +255,7 @@ void Config_RetrieveSettings() { EEPROM_READ_VAR(i, acceleration); EEPROM_READ_VAR(i, retract_acceleration); + EEPROM_READ_VAR(i, travel_acceleration); EEPROM_READ_VAR(i, minimumfeedrate); EEPROM_READ_VAR(i, mintravelfeedrate); EEPROM_READ_VAR(i, minsegmenttime); @@ -380,6 +383,7 @@ void Config_ResetDefault() { acceleration = DEFAULT_ACCELERATION; retract_acceleration = DEFAULT_RETRACT_ACCELERATION; + travel_acceleration = DEFAULT_TRAVEL_ACCELERATION; minimumfeedrate = DEFAULT_MINIMUMFEEDRATE; minsegmenttime = DEFAULT_MINSEGMENTTIME; mintravelfeedrate = DEFAULT_MINTRAVELFEEDRATE; @@ -516,11 +520,12 @@ void Config_PrintSettings(bool forReplay) { SERIAL_EOL; SERIAL_ECHO_START; if (!forReplay) { - SERIAL_ECHOLNPGM("Acceleration: S=acceleration, T=retract acceleration"); + SERIAL_ECHOLNPGM("Accelerations: P=printing, R=retract and T=travel"); SERIAL_ECHO_START; } - SERIAL_ECHOPAIR(" M204 S", acceleration ); - SERIAL_ECHOPAIR(" T", retract_acceleration); + SERIAL_ECHOPAIR(" M204 P", acceleration ); + SERIAL_ECHOPAIR(" R", retract_acceleration); + SERIAL_ECHOPAIR(" T", travel_acceleration); SERIAL_EOL; SERIAL_ECHO_START; diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 13ebb43cb6..6fd2999ddf 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3263,16 +3263,34 @@ inline void gcode_M203() { } /** - * M204: Set Default Acceleration and/or Default Filament Acceleration in mm/sec^2 (M204 S3000 T7000) + * M204: Set Accelerations in mm/sec^2 (M204 P1200 R3000 T3000) * - * S = normal moves - * T = filament only moves + * P = Printing moves + * R = Retract only (no X, Y, Z) moves + * T = Travel (non printing) moves * * Also sets minimum segment time in ms (B20000) to prevent buffer under-runs and M20 minimum feedrate */ inline void gcode_M204() { - if (code_seen('S')) acceleration = code_value(); - if (code_seen('T')) retract_acceleration = code_value(); + if (code_seen('P')) + { + acceleration = code_value(); + SERIAL_ECHOPAIR("Setting Printing Acceleration: ", acceleration ); + SERIAL_EOL; + } + if (code_seen('R')) + { + retract_acceleration = code_value(); + SERIAL_ECHOPAIR("Setting Retract Acceleration: ", retract_acceleration ); + SERIAL_EOL; + } + if (code_seen('T')) + { + travel_acceleration = code_value(); + SERIAL_ECHOPAIR("Setting Travel Acceleration: ", travel_acceleration ); + SERIAL_EOL; + } + } /** diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index cf2199d944..a5d3c8eb5a 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -500,8 +500,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DEFAULT_MAX_FEEDRATE {250, 250, 3.3, 25} // (mm/sec) #define DEFAULT_MAX_ACCELERATION {3000,3000,100,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot. -#define DEFAULT_ACCELERATION 1000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves -#define DEFAULT_RETRACT_ACCELERATION 1000 // X, Y, Z and E max acceleration in mm/s^2 for retracts +#define DEFAULT_ACCELERATION 1000 // X, Y, Z and E acceleration in mm/s^2 for printing moves +#define DEFAULT_RETRACT_ACCELERATION 1000 // E acceleration in mm/s^2 for retracts +#define DEFAULT_TRAVEL_ACCELERATION 1000 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves + + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index 112c228bdf..1aee050c73 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -505,8 +505,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DEFAULT_MAX_FEEDRATE {500, 500, 5, 500} // (mm/sec) #define DEFAULT_MAX_ACCELERATION {9000,9000,100,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot. -#define DEFAULT_ACCELERATION 1000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves -#define DEFAULT_RETRACT_ACCELERATION 1000 // X, Y, Z and E max acceleration in mm/s^2 for retracts +#define DEFAULT_ACCELERATION 1000 // X, Y, Z and E acceleration in mm/s^2 for printing moves +#define DEFAULT_RETRACT_ACCELERATION 1000 // E acceleration in mm/s^2 for retracts +#define DEFAULT_TRAVEL_ACCELERATION 1000 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index c74ea6a99f..6655171947 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -530,8 +530,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DEFAULT_MAX_FEEDRATE {300, 300, 30, 25} // (mm/sec) #define DEFAULT_MAX_ACCELERATION {300,300,20,1000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot. -#define DEFAULT_ACCELERATION 400 // X, Y, Z and E max acceleration in mm/s^2 for printing moves -#define DEFAULT_RETRACT_ACCELERATION 2000 // X, Y, Z and E max acceleration in mm/s^2 for retracts +#define DEFAULT_ACCELERATION 400 // X, Y, Z and E acceleration in mm/s^2 for printing moves +#define DEFAULT_RETRACT_ACCELERATION 2000 // E acceleration in mm/s^2 for retracts +#define DEFAULT_TRAVEL_ACCELERATION 400 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves + + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index b45e90796b..2e99c82273 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -499,8 +499,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DEFAULT_MAX_FEEDRATE {350, 350, 7.2, 80} // (mm/sec) #define DEFAULT_MAX_ACCELERATION {1000,1000,10,1000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot. -#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves -#define DEFAULT_RETRACT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for retracts +#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration in mm/s^2 for printing moves +#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration in mm/s^2 for retracts +#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). diff --git a/Marlin/example_configurations/delta/Configuration.h b/Marlin/example_configurations/delta/Configuration.h index e44d3c7868..696bd47261 100644 --- a/Marlin/example_configurations/delta/Configuration.h +++ b/Marlin/example_configurations/delta/Configuration.h @@ -440,8 +440,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DEFAULT_MAX_FEEDRATE {500, 500, 500, 25} // (mm/sec) #define DEFAULT_MAX_ACCELERATION {9000,9000,9000,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot. -#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves -#define DEFAULT_RETRACT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for retracts +#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration in mm/s^2 for printing moves +#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration in mm/s^2 for retracts +#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index 78e736e4db..1f64893281 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -497,8 +497,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DEFAULT_MAX_FEEDRATE {60, 60, 20, 45} // (mm/sec) #define DEFAULT_MAX_ACCELERATION {2000,2000,30,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot. -#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves -#define DEFAULT_RETRACT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for retracts +#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration in mm/s^2 for printing moves +#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration in mm/s^2 for retracts +#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index 88ad8b8690..ee326c182f 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -503,8 +503,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define DEFAULT_MAX_ACCELERATION {9000,9000,100,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot. /* MICHEL: This has an impact on the "ripples" in print walls */ -#define DEFAULT_ACCELERATION 500 // X, Y, Z and E max acceleration in mm/s^2 for printing moves -#define DEFAULT_RETRACT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for retracts +#define DEFAULT_ACCELERATION 500 // X, Y, Z and E acceleration in mm/s^2 for printing moves +#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration in mm/s^2 for retracts +#define DEFAULT_TRAVEL_ACCELERATION 500 // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves + // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing). // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder). diff --git a/Marlin/language_en.h b/Marlin/language_en.h index 1ba950af9b..636d622aba 100644 --- a/Marlin/language_en.h +++ b/Marlin/language_en.h @@ -233,6 +233,9 @@ #ifndef MSG_A_RETRACT #define MSG_A_RETRACT "A-retract" #endif +#ifndef MSG_A_TRAVEL +#define MSG_A_TRAVEL "A-travel" +#endif #ifndef MSG_XSTEPS #define MSG_XSTEPS "Xsteps/mm" #endif diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index cee1981bc0..be1574e422 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -67,8 +67,9 @@ float max_feedrate[NUM_AXIS]; // set the max speeds float axis_steps_per_unit[NUM_AXIS]; unsigned long max_acceleration_units_per_sq_second[NUM_AXIS]; // Use M201 to override by software float minimumfeedrate; -float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX +float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all printing moves. M204 SXXXX float retract_acceleration; // mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX +float travel_acceleration; // Travel acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all NON printing moves. M204 MXXXX float max_xy_jerk; //speed than can be stopped at once, if i understand correctly. float max_z_jerk; float max_e_jerk; @@ -907,6 +908,10 @@ Having the real displacement of the head, we can calculate the total movement le { block->acceleration_st = ceil(retract_acceleration * steps_per_mm); // convert to: acceleration steps/sec^2 } + else if(block->steps_e == 0) + { + block->acceleration_st = ceil(travel_acceleration * steps_per_mm); // convert to: acceleration steps/sec^2 + } else { block->acceleration_st = ceil(acceleration * steps_per_mm); // convert to: acceleration steps/sec^2 diff --git a/Marlin/planner.h b/Marlin/planner.h index 0952b9dd34..a64a0f0d3c 100644 --- a/Marlin/planner.h +++ b/Marlin/planner.h @@ -112,6 +112,7 @@ extern unsigned long max_acceleration_units_per_sq_second[NUM_AXIS]; // Use M201 extern float minimumfeedrate; extern float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX extern float retract_acceleration; // mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX +extern float travel_acceleration; // Travel acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all NON printing moves. M204 MXXXX extern float max_xy_jerk; //speed than can be stopped at once, if i understand correctly. extern float max_z_jerk; extern float max_e_jerk; diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 2f83afe2d1..39b0923443 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -903,6 +903,7 @@ static void lcd_control_motion_menu() { MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Z, &max_acceleration_units_per_sq_second[Z_AXIS], 100, 99000, reset_acceleration_rates); MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &max_acceleration_units_per_sq_second[E_AXIS], 100, 99000, reset_acceleration_rates); MENU_ITEM_EDIT(float5, MSG_A_RETRACT, &retract_acceleration, 100, 99000); + MENU_ITEM_EDIT(float5, MSG_A_TRAVEL, &travel_acceleration, 100, 99000); MENU_ITEM_EDIT(float52, MSG_XSTEPS, &axis_steps_per_unit[X_AXIS], 5, 9999); MENU_ITEM_EDIT(float52, MSG_YSTEPS, &axis_steps_per_unit[Y_AXIS], 5, 9999); MENU_ITEM_EDIT(float51, MSG_ZSTEPS, &axis_steps_per_unit[Z_AXIS], 5, 9999);