|
@@ -145,135 +145,7 @@
|
|
|
#define FILAMENT_DEFAULT 0
|
|
|
#define FILAMENT_FLEX 1
|
|
|
#define FILAMENT_PVA 2
|
|
|
-
|
|
|
-// look here for descriptions of G-codes: http://linuxcnc.org/handbook/gcode/g-code.html
|
|
|
-// http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes
|
|
|
-
|
|
|
-//Implemented Codes
|
|
|
-//-------------------
|
|
|
-
|
|
|
-// PRUSA CODES
|
|
|
-// P F - Returns FW versions
|
|
|
-// P R - Returns revision of printer
|
|
|
-
|
|
|
-// G0 -> G1
|
|
|
-// G1 - Coordinated Movement X Y Z E
|
|
|
-// G2 - CW ARC
|
|
|
-// G3 - CCW ARC
|
|
|
-// G4 - Dwell S<seconds> or P<milliseconds>
|
|
|
-// G10 - retract filament according to settings of M207
|
|
|
-// G11 - retract recover filament according to settings of M208
|
|
|
-// G28 - Home all Axis
|
|
|
-// G29 - Detailed Z-Probe, probes the bed at 3 or more points. Will fail if you haven't homed yet.
|
|
|
-// G30 - Single Z Probe, probes bed at current XY location.
|
|
|
-// G31 - Dock sled (Z_PROBE_SLED only)
|
|
|
-// G32 - Undock sled (Z_PROBE_SLED only)
|
|
|
-// G80 - Automatic mesh bed leveling
|
|
|
-// G81 - Print bed profile
|
|
|
-// G90 - Use Absolute Coordinates
|
|
|
-// G91 - Use Relative Coordinates
|
|
|
-// G92 - Set current position to coordinates given
|
|
|
-
|
|
|
-// M Codes
|
|
|
-// M0 - Unconditional stop - Wait for user to press a button on the LCD
|
|
|
-// M1 - Same as M0
|
|
|
-// M17 - Enable/Power all stepper motors
|
|
|
-// M18 - Disable all stepper motors; same as M84
|
|
|
-// M20 - List SD card
|
|
|
-// M21 - Init SD card
|
|
|
-// M22 - Release SD card
|
|
|
-// M23 - Select SD file (M23 filename.g)
|
|
|
-// M24 - Start/resume SD print
|
|
|
-// M25 - Pause SD print
|
|
|
-// M26 - Set SD position in bytes (M26 S12345)
|
|
|
-// M27 - Report SD print status
|
|
|
-// M28 - Start SD write (M28 filename.g)
|
|
|
-// M29 - Stop SD write
|
|
|
-// M30 - Delete file from SD (M30 filename.g)
|
|
|
-// M31 - Output time since last M109 or SD card start to serial
|
|
|
-// M32 - Select file and start SD print (Can be used _while_ printing from SD card files):
|
|
|
-// syntax "M32 /path/filename#", or "M32 S<startpos bytes> !filename#"
|
|
|
-// Call gcode file : "M32 P !filename#" and return to caller file after finishing (similar to #include).
|
|
|
-// The '#' is necessary when calling from within sd files, as it stops buffer prereading
|
|
|
-// M42 - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
|
|
|
-// M73 - Show percent done and print time remaining
|
|
|
-// M80 - Turn on Power Supply
|
|
|
-// M81 - Turn off Power Supply
|
|
|
-// M82 - Set E codes absolute (default)
|
|
|
-// M83 - Set E codes relative while in Absolute Coordinates (G90) mode
|
|
|
-// M84 - Disable steppers until next move,
|
|
|
-// or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout.
|
|
|
-// M85 - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
|
|
|
-// M86 - Set safety timer expiration time with parameter S<seconds>; M86 S0 will disable safety timer
|
|
|
-// M92 - Set axis_steps_per_unit - same syntax as G92
|
|
|
-// M104 - Set extruder target temp
|
|
|
-// M105 - Read current temp
|
|
|
-// M106 - Fan on
|
|
|
-// M107 - Fan off
|
|
|
-// M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
|
|
|
-// Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
|
|
|
-// IF AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F
|
|
|
-// M112 - Emergency stop
|
|
|
-// M113 - Get or set the timeout interval for Host Keepalive "busy" messages
|
|
|
-// M114 - Output current position to serial port
|
|
|
-// M115 - Capabilities string
|
|
|
-// M117 - display message
|
|
|
-// M119 - Output Endstop status to serial port
|
|
|
-// M126 - Solenoid Air Valve Open (BariCUDA support by jmil)
|
|
|
-// M127 - Solenoid Air Valve Closed (BariCUDA vent to atmospheric pressure by jmil)
|
|
|
-// M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil)
|
|
|
-// M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil)
|
|
|
-// M140 - Set bed target temp
|
|
|
-// M150 - Set BlinkM Color Output R: Red<0-255> U(!): Green<0-255> B: Blue<0-255> over i2c, G for green does not work.
|
|
|
-// M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating
|
|
|
-// Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
|
|
|
-// M200 D<millimeters>- set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters).
|
|
|
-// M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000)
|
|
|
-// M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
|
|
|
-// M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
|
|
|
-// M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) in mm/sec^2 also sets minimum segment time in ms (B20000) to prevent buffer under-runs 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 homing offset
|
|
|
-// M207 - set retract length S[positive mm] F[feedrate mm/min] Z[additional zlift/hop], stays in mm regardless of M200 setting
|
|
|
-// 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.
|
|
|
-// M218 - set hotend offset (in mm): T<extruder_number> X<offset_on_X> Y<offset_on_Y>
|
|
|
-// M220 S<factor in percent>- set speed factor override percentage
|
|
|
-// M221 S<factor in percent>- set extrude factor override percentage
|
|
|
-// M226 P<pin number> S<pin state>- Wait until the specified pin reaches the state required
|
|
|
-// M240 - Trigger a camera to take a photograph
|
|
|
-// M250 - Set LCD contrast C<contrast value> (value 0..63)
|
|
|
-// M280 - set servo position absolute. P: servo index, S: angle or microseconds
|
|
|
-// M300 - Play beep sound S<frequency Hz> P<duration ms>
|
|
|
-// M301 - Set PID parameters P I and D
|
|
|
-// M302 - Allow cold extrudes, or set the minimum extrude S<temperature>.
|
|
|
-// M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
|
|
|
-// M304 - Set bed PID parameters P I and D
|
|
|
-// M400 - Finish all moves
|
|
|
-// M401 - Lower z-probe if present
|
|
|
-// M402 - Raise z-probe if present
|
|
|
-// M404 - N<dia in mm> Enter the nominal filament width (3mm, 1.75mm ) or will display nominal filament width without parameters
|
|
|
-// M405 - Turn on Filament Sensor extrusion control. Optional D<delay in cm> to set delay in centimeters between sensor and extruder
|
|
|
-// M406 - Turn off Filament Sensor extrusion control
|
|
|
-// M407 - Displays measured filament diameter
|
|
|
-// M500 - stores parameters in EEPROM
|
|
|
-// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
|
|
|
-// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
|
|
|
-// M503 - print the current settings (from memory not from EEPROM)
|
|
|
-// M509 - force language selection on next restart
|
|
|
-// M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
|
|
-// M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
|
|
|
-// M605 - Set dual x-carriage movement mode: S<mode> [ X<duplication x-offset> R<duplication temp offset> ]
|
|
|
-// M860 - Wait for PINDA thermistor to reach target temperature.
|
|
|
-// M861 - Set / Read PINDA temperature compensation offsets
|
|
|
-// M900 - Set LIN_ADVANCE options, if enabled. See Configuration_adv.h for details.
|
|
|
-// M907 - Set digital trimpot motor current using axis codes.
|
|
|
-// M908 - Control digital trimpot directly.
|
|
|
-// M350 - Set microstepping mode.
|
|
|
-// M351 - Toggle MS1 MS2 pins directly.
|
|
|
-
|
|
|
-// M928 - Start SD logging (M928 filename.g) - ended by M29
|
|
|
-// M999 - Restart after being stopped by error
|
|
|
+#define FILAMENT_UNDEFINED 255
|
|
|
|
|
|
//Stepper Movement Variables
|
|
|
|
|
@@ -305,7 +177,6 @@ float homing_feedrate[] = HOMING_FEEDRATE;
|
|
|
// Other axes are always absolute or relative based on the common relative_mode flag.
|
|
|
bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
|
|
|
int feedmultiply=100; //100->1 200->2
|
|
|
-int saved_feedmultiply;
|
|
|
int extrudemultiply=100; //100->1 200->2
|
|
|
int extruder_multiply[EXTRUDERS] = {100
|
|
|
#if EXTRUDERS > 1
|
|
@@ -329,10 +200,6 @@ unsigned int usb_printing_counter;
|
|
|
|
|
|
int8_t lcd_change_fil_state = 0;
|
|
|
|
|
|
-int feedmultiplyBckp = 100;
|
|
|
-float HotendTempBckp = 0;
|
|
|
-int fanSpeedBckp = 0;
|
|
|
-float pause_lastpos[4];
|
|
|
unsigned long pause_time = 0;
|
|
|
unsigned long start_pause_print = millis();
|
|
|
unsigned long t_fan_rising_edge = millis();
|
|
@@ -450,8 +317,6 @@ bool no_response = false;
|
|
|
uint8_t important_status;
|
|
|
uint8_t saved_filament_type;
|
|
|
|
|
|
-// save/restore printing
|
|
|
-bool saved_printing = false;
|
|
|
|
|
|
// save/restore printing in case that mmu was not responding
|
|
|
bool mmu_print_saved = false;
|
|
@@ -512,15 +377,20 @@ unsigned long chdkHigh = 0;
|
|
|
boolean chdkActive = false;
|
|
|
#endif
|
|
|
|
|
|
-// save/restore printing
|
|
|
-static uint32_t saved_sdpos = 0;
|
|
|
+//! @name RAM save/restore printing
|
|
|
+//! @{
|
|
|
+bool saved_printing = false; //!< Print is paused and saved in RAM
|
|
|
+static uint32_t saved_sdpos = 0; //!< SD card position, or line number in case of USB printing
|
|
|
static uint8_t saved_printing_type = PRINTING_TYPE_SD;
|
|
|
static float saved_pos[4] = { 0, 0, 0, 0 };
|
|
|
-// Feedrate hopefully derived from an active block of the planner at the time the print has been canceled, in mm/min.
|
|
|
+//! Feedrate hopefully derived from an active block of the planner at the time the print has been canceled, in mm/min.
|
|
|
static float saved_feedrate2 = 0;
|
|
|
static uint8_t saved_active_extruder = 0;
|
|
|
+static float saved_extruder_temperature = 0.0; //!< Active extruder temperature
|
|
|
static bool saved_extruder_under_pressure = false;
|
|
|
static bool saved_extruder_relative_mode = false;
|
|
|
+static int saved_fanSpeed = 0; //!< Print fan speed
|
|
|
+//! @}
|
|
|
|
|
|
//===========================================================================
|
|
|
//=============================Routines======================================
|
|
@@ -632,9 +502,6 @@ void servo_init()
|
|
|
}
|
|
|
|
|
|
|
|
|
-void stop_and_save_print_to_ram(float z_move, float e_move);
|
|
|
-void restore_print_from_ram_and_continue(float e_move);
|
|
|
-
|
|
|
bool fans_check_enabled = true;
|
|
|
|
|
|
|
|
@@ -730,16 +597,11 @@ void crashdet_detected(uint8_t mask)
|
|
|
if (automatic_recovery_after_crash) {
|
|
|
enquecommand_P(PSTR("CRASH_RECOVER"));
|
|
|
}else{
|
|
|
- HotendTempBckp = degTargetHotend(active_extruder);
|
|
|
setTargetHotend(0, active_extruder);
|
|
|
bool yesno = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Crash detected. Resume print?"), false);
|
|
|
lcd_update_enable(true);
|
|
|
if (yesno)
|
|
|
{
|
|
|
- char cmd1[10];
|
|
|
- strcpy(cmd1, "M109 S");
|
|
|
- strcat(cmd1, ftostr3(HotendTempBckp));
|
|
|
- enquecommand(cmd1);
|
|
|
enquecommand_P(PSTR("CRASH_RECOVER"));
|
|
|
}
|
|
|
else
|
|
@@ -786,9 +648,8 @@ void failstats_reset_print()
|
|
|
// Factory reset function
|
|
|
// This function is used to erase parts or whole EEPROM memory which is used for storing calibration and and so on.
|
|
|
// Level input parameter sets depth of reset
|
|
|
-// Quiet parameter masks all waitings for user interact.
|
|
|
int er_progress = 0;
|
|
|
-void factory_reset(char level, bool quiet)
|
|
|
+static void factory_reset(char level)
|
|
|
{
|
|
|
lcd_clear();
|
|
|
switch (level) {
|
|
@@ -877,7 +738,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
|
|
|
// Erase EEPROM
|
|
|
for (int i = 0; i < 4096; i++) {
|
|
|
- eeprom_write_byte((uint8_t*)i, 0xFF);
|
|
|
+ eeprom_update_byte((uint8_t*)i, 0xFF);
|
|
|
|
|
|
if (i % 41 == 0) {
|
|
|
er_progress++;
|
|
@@ -903,9 +764,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
|
|
|
|
|
|
-FILE _uartout = {0};
|
|
|
+FILE _uartout; //= {0}; Global variable is always zero initialized. No need to explicitly state this.
|
|
|
|
|
|
-int uart_putchar(char c, FILE *stream)
|
|
|
+int uart_putchar(char c, FILE *)
|
|
|
{
|
|
|
MYSERIAL.write(c);
|
|
|
return 0;
|
|
@@ -950,7 +811,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
_delay_ms(2000);
|
|
|
|
|
|
char level = reset_menu();
|
|
|
- factory_reset(level, false);
|
|
|
+ factory_reset(level);
|
|
|
|
|
|
switch (level) {
|
|
|
case 0: _delay_ms(0); break;
|
|
@@ -1627,7 +1488,7 @@ void setup()
|
|
|
erase_eeprom_section(EEPROM_OFFSET, 156); //erase M500 part of eeprom
|
|
|
}
|
|
|
if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) {
|
|
|
- lcd_wizard(0);
|
|
|
+ lcd_wizard(WizState::Run);
|
|
|
}
|
|
|
if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 0) { //dont show calibration status messages if wizard is currently active
|
|
|
if (calibration_status() == CALIBRATION_STATUS_ASSEMBLED ||
|
|
@@ -2001,23 +1862,25 @@ static void axis_is_at_home(int axis) {
|
|
|
inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
|
|
|
inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); }
|
|
|
|
|
|
-
|
|
|
-static void setup_for_endstop_move(bool enable_endstops_now = true) {
|
|
|
+//! @return original feedmultiply
|
|
|
+static int setup_for_endstop_move(bool enable_endstops_now = true) {
|
|
|
saved_feedrate = feedrate;
|
|
|
- saved_feedmultiply = feedmultiply;
|
|
|
+ int l_feedmultiply = feedmultiply;
|
|
|
feedmultiply = 100;
|
|
|
previous_millis_cmd = millis();
|
|
|
|
|
|
enable_endstops(enable_endstops_now);
|
|
|
+ return l_feedmultiply;
|
|
|
}
|
|
|
|
|
|
-static void clean_up_after_endstop_move() {
|
|
|
+//! @param original_feedmultiply feedmultiply to restore
|
|
|
+static void clean_up_after_endstop_move(int original_feedmultiply) {
|
|
|
#ifdef ENDSTOPS_ONLY_FOR_HOMING
|
|
|
enable_endstops(false);
|
|
|
#endif
|
|
|
|
|
|
feedrate = saved_feedrate;
|
|
|
- feedmultiply = saved_feedmultiply;
|
|
|
+ feedmultiply = original_feedmultiply;
|
|
|
previous_millis_cmd = millis();
|
|
|
}
|
|
|
|
|
@@ -2250,43 +2113,43 @@ void homeaxis(int axis, uint8_t cnt, uint8_t* pstep)
|
|
|
#endif //TMC2130
|
|
|
|
|
|
|
|
|
- // Move right a bit, so that the print head does not touch the left end position,
|
|
|
- // and the following left movement has a chance to achieve the required velocity
|
|
|
+ // Move away a bit, so that the print head does not touch the end position,
|
|
|
+ // and the following movement to endstop has a chance to achieve the required velocity
|
|
|
// for the stall guard to work.
|
|
|
current_position[axis] = 0;
|
|
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
set_destination_to_current();
|
|
|
// destination[axis] = 11.f;
|
|
|
- destination[axis] = 3.f;
|
|
|
+ destination[axis] = -3.f * axis_home_dir;
|
|
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
|
st_synchronize();
|
|
|
- // Move left away from the possible collision with the collision detection disabled.
|
|
|
+ // Move away from the possible collision with opposite endstop with the collision detection disabled.
|
|
|
endstops_hit_on_purpose();
|
|
|
enable_endstops(false);
|
|
|
current_position[axis] = 0;
|
|
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
- destination[axis] = - 1.;
|
|
|
+ destination[axis] = 1. * axis_home_dir;
|
|
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
|
st_synchronize();
|
|
|
// Now continue to move up to the left end stop with the collision detection enabled.
|
|
|
enable_endstops(true);
|
|
|
- destination[axis] = - 1.1 * max_length(axis);
|
|
|
+ destination[axis] = 1.1 * axis_home_dir * max_length(axis);
|
|
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
|
st_synchronize();
|
|
|
for (uint8_t i = 0; i < cnt; i++)
|
|
|
{
|
|
|
- // Move right from the collision to a known distance from the left end stop with the collision detection disabled.
|
|
|
+ // Move away from the collision to a known distance from the left end stop with the collision detection disabled.
|
|
|
endstops_hit_on_purpose();
|
|
|
enable_endstops(false);
|
|
|
current_position[axis] = 0;
|
|
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
- destination[axis] = 10.f;
|
|
|
+ destination[axis] = -10.f * axis_home_dir;
|
|
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
|
st_synchronize();
|
|
|
endstops_hit_on_purpose();
|
|
|
// Now move left up to the collision, this time with a repeatable velocity.
|
|
|
enable_endstops(true);
|
|
|
- destination[axis] = - 11.f;
|
|
|
+ destination[axis] = 11.f * axis_home_dir;
|
|
|
#ifdef TMC2130
|
|
|
feedrate = homing_feedrate[axis];
|
|
|
#else //TMC2130
|
|
@@ -2310,10 +2173,10 @@ void homeaxis(int axis, uint8_t cnt, uint8_t* pstep)
|
|
|
{
|
|
|
tmc2130_goto_step(axis, orig, 2, 1000, tmc2130_get_res(axis));
|
|
|
if (back > 0)
|
|
|
- tmc2130_do_steps(axis, back, 1, 1000);
|
|
|
+ tmc2130_do_steps(axis, back, -axis_home_dir, 1000);
|
|
|
}
|
|
|
else
|
|
|
- tmc2130_do_steps(axis, 8, 2, 1000);
|
|
|
+ tmc2130_do_steps(axis, 8, -axis_home_dir, 1000);
|
|
|
tmc2130_home_exit();
|
|
|
#endif //TMC2130
|
|
|
|
|
@@ -2321,9 +2184,9 @@ void homeaxis(int axis, uint8_t cnt, uint8_t* pstep)
|
|
|
axis_known_position[axis] = true;
|
|
|
// Move from minimum
|
|
|
#ifdef TMC2130
|
|
|
- float dist = 0.01f * tmc2130_home_fsteps[axis];
|
|
|
+ float dist = - axis_home_dir * 0.01f * tmc2130_home_fsteps[axis];
|
|
|
#else //TMC2130
|
|
|
- float dist = 0.01f * 64;
|
|
|
+ float dist = - axis_home_dir * 0.01f * 64;
|
|
|
#endif //TMC2130
|
|
|
current_position[axis] -= dist;
|
|
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
@@ -2602,7 +2465,7 @@ void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_
|
|
|
babystep_undo();
|
|
|
|
|
|
saved_feedrate = feedrate;
|
|
|
- saved_feedmultiply = feedmultiply;
|
|
|
+ int l_feedmultiply = feedmultiply;
|
|
|
feedmultiply = 100;
|
|
|
previous_millis_cmd = millis();
|
|
|
|
|
@@ -2788,7 +2651,7 @@ void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_
|
|
|
#endif
|
|
|
|
|
|
feedrate = saved_feedrate;
|
|
|
- feedmultiply = saved_feedmultiply;
|
|
|
+ feedmultiply = l_feedmultiply;
|
|
|
previous_millis_cmd = millis();
|
|
|
endstops_hit_on_purpose();
|
|
|
#ifndef MESH_BED_LEVELING
|
|
@@ -2839,6 +2702,11 @@ void adjust_bed_reset()
|
|
|
eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_REAR, 0);
|
|
|
}
|
|
|
|
|
|
+//! @brief Calibrate XYZ
|
|
|
+//! @param onlyZ if true, calibrate only Z axis
|
|
|
+//! @param verbosity_level
|
|
|
+//! @retval true Succeeded
|
|
|
+//! @retval false Failed
|
|
|
bool gcode_M45(bool onlyZ, int8_t verbosity_level)
|
|
|
{
|
|
|
bool final_result = false;
|
|
@@ -2868,7 +2736,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
|
|
|
|
|
|
// Home in the XY plane.
|
|
|
//set_destination_to_current();
|
|
|
- setup_for_endstop_move();
|
|
|
+ int l_feedmultiply = setup_for_endstop_move();
|
|
|
lcd_display_message_fullscreen_P(_T(MSG_AUTO_HOME));
|
|
|
home_xy();
|
|
|
|
|
@@ -2926,18 +2794,9 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
|
|
|
|
|
|
if (st_get_position_mm(Z_AXIS) == MESH_HOME_Z_SEARCH)
|
|
|
{
|
|
|
-
|
|
|
- int8_t verbosity_level = 0;
|
|
|
- if (code_seen('V'))
|
|
|
- {
|
|
|
- // Just 'V' without a number counts as V1.
|
|
|
- char c = strchr_pointer[1];
|
|
|
- verbosity_level = (c == ' ' || c == '\t' || c == 0) ? 1 : code_value_short();
|
|
|
- }
|
|
|
-
|
|
|
if (onlyZ)
|
|
|
{
|
|
|
- clean_up_after_endstop_move();
|
|
|
+ clean_up_after_endstop_move(l_feedmultiply);
|
|
|
// Z only calibration.
|
|
|
// Load the machine correction matrix
|
|
|
world2machine_initialize();
|
|
@@ -2962,7 +2821,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
|
|
|
// Complete XYZ calibration.
|
|
|
uint8_t point_too_far_mask = 0;
|
|
|
BedSkewOffsetDetectionResultType result = find_bed_offset_and_skew(verbosity_level, point_too_far_mask);
|
|
|
- clean_up_after_endstop_move();
|
|
|
+ clean_up_after_endstop_move(l_feedmultiply);
|
|
|
// Print head up.
|
|
|
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder);
|
|
@@ -2979,10 +2838,10 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
|
|
|
mbl.reset();
|
|
|
world2machine_reset();
|
|
|
// Home in the XY plane.
|
|
|
- setup_for_endstop_move();
|
|
|
+ int l_feedmultiply = setup_for_endstop_move();
|
|
|
home_xy();
|
|
|
result = improve_bed_offset_and_skew(1, verbosity_level, point_too_far_mask);
|
|
|
- clean_up_after_endstop_move();
|
|
|
+ clean_up_after_endstop_move(l_feedmultiply);
|
|
|
// Print head up.
|
|
|
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder);
|
|
@@ -3047,117 +2906,124 @@ void gcode_M114()
|
|
|
SERIAL_PROTOCOLLN("");
|
|
|
}
|
|
|
|
|
|
-void gcode_M600(bool automatic, float x_position, float y_position, float z_shift, float e_shift, float e_shift_late) {
|
|
|
- st_synchronize();
|
|
|
- float lastpos[4];
|
|
|
+static void gcode_M600(bool automatic, float x_position, float y_position, float z_shift, float e_shift, float /*e_shift_late*/)
|
|
|
+{
|
|
|
+ st_synchronize();
|
|
|
+ float lastpos[4];
|
|
|
|
|
|
- if (farm_mode)
|
|
|
- {
|
|
|
- prusa_statistics(22);
|
|
|
- }
|
|
|
+ if (farm_mode)
|
|
|
+ {
|
|
|
+ prusa_statistics(22);
|
|
|
+ }
|
|
|
|
|
|
- //First backup current position and settings
|
|
|
- feedmultiplyBckp=feedmultiply;
|
|
|
- HotendTempBckp = degTargetHotend(active_extruder);
|
|
|
- fanSpeedBckp = fanSpeed;
|
|
|
+ //First backup current position and settings
|
|
|
+ int feedmultiplyBckp = feedmultiply;
|
|
|
+ float HotendTempBckp = degTargetHotend(active_extruder);
|
|
|
+ int fanSpeedBckp = fanSpeed;
|
|
|
|
|
|
- lastpos[X_AXIS]=current_position[X_AXIS];
|
|
|
- lastpos[Y_AXIS]=current_position[Y_AXIS];
|
|
|
- lastpos[Z_AXIS]=current_position[Z_AXIS];
|
|
|
- lastpos[E_AXIS]=current_position[E_AXIS];
|
|
|
+ lastpos[X_AXIS] = current_position[X_AXIS];
|
|
|
+ lastpos[Y_AXIS] = current_position[Y_AXIS];
|
|
|
+ lastpos[Z_AXIS] = current_position[Z_AXIS];
|
|
|
+ lastpos[E_AXIS] = current_position[E_AXIS];
|
|
|
|
|
|
- //Retract E
|
|
|
- current_position[E_AXIS]+= e_shift;
|
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_RFEED, active_extruder);
|
|
|
- st_synchronize();
|
|
|
+ //Retract E
|
|
|
+ current_position[E_AXIS] += e_shift;
|
|
|
+ plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
|
|
|
+ current_position[E_AXIS], FILAMENTCHANGE_RFEED, active_extruder);
|
|
|
+ st_synchronize();
|
|
|
|
|
|
- //Lift Z
|
|
|
- current_position[Z_AXIS]+= z_shift;
|
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_ZFEED, active_extruder);
|
|
|
- st_synchronize();
|
|
|
-
|
|
|
- //Move XY to side
|
|
|
- current_position[X_AXIS]= x_position;
|
|
|
- current_position[Y_AXIS]= y_position;
|
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_XYFEED, active_extruder);
|
|
|
- st_synchronize();
|
|
|
-
|
|
|
- //Beep, manage nozzle heater and wait for user to start unload filament
|
|
|
- if(!mmu_enabled) M600_wait_for_user();
|
|
|
-
|
|
|
- lcd_change_fil_state = 0;
|
|
|
-
|
|
|
- // Unload filament
|
|
|
- if (mmu_enabled)
|
|
|
- extr_unload(); //unload just current filament for multimaterial printers (used also in M702)
|
|
|
- else
|
|
|
- unload_filament(); //unload filament for single material (used also in M702)
|
|
|
- //finish moves
|
|
|
- st_synchronize();
|
|
|
+ //Lift Z
|
|
|
+ current_position[Z_AXIS] += z_shift;
|
|
|
+ plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
|
|
|
+ current_position[E_AXIS], FILAMENTCHANGE_ZFEED, active_extruder);
|
|
|
+ st_synchronize();
|
|
|
|
|
|
- if (!mmu_enabled)
|
|
|
- {
|
|
|
- KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
|
- lcd_change_fil_state = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Was filament unload successful?"), false, true);////MSG_UNLOAD_SUCCESSFUL c=20 r=2
|
|
|
- if (lcd_change_fil_state == 0) lcd_show_fullscreen_message_and_wait_P(_i("Please open idler and remove filament manually."));////MSG_CHECK_IDLER c=20 r=4
|
|
|
- lcd_update_enable(true);
|
|
|
- }
|
|
|
+ //Move XY to side
|
|
|
+ current_position[X_AXIS] = x_position;
|
|
|
+ current_position[Y_AXIS] = y_position;
|
|
|
+ plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
|
|
|
+ current_position[E_AXIS], FILAMENTCHANGE_XYFEED, active_extruder);
|
|
|
+ st_synchronize();
|
|
|
|
|
|
- if (mmu_enabled)
|
|
|
- {
|
|
|
- if (!automatic) {
|
|
|
- if (saved_printing) mmu_eject_filament(mmu_extruder, false); //if M600 was invoked by filament senzor (FINDA) eject filament so user can easily remove it
|
|
|
- mmu_M600_wait_and_beep();
|
|
|
- if (saved_printing) {
|
|
|
+ //Beep, manage nozzle heater and wait for user to start unload filament
|
|
|
+ if(!mmu_enabled) M600_wait_for_user(HotendTempBckp);
|
|
|
|
|
|
- lcd_clear();
|
|
|
- lcd_set_cursor(0, 2);
|
|
|
- lcd_puts_P(_T(MSG_PLEASE_WAIT));
|
|
|
+ lcd_change_fil_state = 0;
|
|
|
|
|
|
- mmu_command(MMU_CMD_R0);
|
|
|
- manage_response(false, false);
|
|
|
- }
|
|
|
- }
|
|
|
- mmu_M600_load_filament(automatic);
|
|
|
- }
|
|
|
- else
|
|
|
- M600_load_filament();
|
|
|
+ // Unload filament
|
|
|
+ if (mmu_enabled) extr_unload(); //unload just current filament for multimaterial printers (used also in M702)
|
|
|
+ else unload_filament(); //unload filament for single material (used also in M702)
|
|
|
+ //finish moves
|
|
|
+ st_synchronize();
|
|
|
+
|
|
|
+ if (!mmu_enabled)
|
|
|
+ {
|
|
|
+ KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
|
+ lcd_change_fil_state = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Was filament unload successful?"),
|
|
|
+ false, true); ////MSG_UNLOAD_SUCCESSFUL c=20 r=2
|
|
|
+ if (lcd_change_fil_state == 0)
|
|
|
+ lcd_show_fullscreen_message_and_wait_P(_i("Please open idler and remove filament manually."));////MSG_CHECK_IDLER c=20 r=4
|
|
|
+ lcd_update_enable(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (mmu_enabled)
|
|
|
+ {
|
|
|
+ if (!automatic) {
|
|
|
+ if (saved_printing) mmu_eject_filament(mmu_extruder, false); //if M600 was invoked by filament senzor (FINDA) eject filament so user can easily remove it
|
|
|
+ mmu_M600_wait_and_beep();
|
|
|
+ if (saved_printing) {
|
|
|
+
|
|
|
+ lcd_clear();
|
|
|
+ lcd_set_cursor(0, 2);
|
|
|
+ lcd_puts_P(_T(MSG_PLEASE_WAIT));
|
|
|
+
|
|
|
+ mmu_command(MMU_CMD_R0);
|
|
|
+ manage_response(false, false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mmu_M600_load_filament(automatic);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ M600_load_filament();
|
|
|
|
|
|
- if(!automatic) M600_check_state();
|
|
|
+ if (!automatic) M600_check_state();
|
|
|
|
|
|
lcd_update_enable(true);
|
|
|
|
|
|
- //Not let's go back to print
|
|
|
- fanSpeed = fanSpeedBckp;
|
|
|
+ //Not let's go back to print
|
|
|
+ fanSpeed = fanSpeedBckp;
|
|
|
|
|
|
- //Feed a little of filament to stabilize pressure
|
|
|
- if (!automatic) {
|
|
|
- current_position[E_AXIS] += FILAMENTCHANGE_RECFEED;
|
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_EXFEED, active_extruder);
|
|
|
- }
|
|
|
-
|
|
|
- //Move XY back
|
|
|
- plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_XYFEED, active_extruder);
|
|
|
- st_synchronize();
|
|
|
- //Move Z back
|
|
|
- plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_ZFEED, active_extruder);
|
|
|
- st_synchronize();
|
|
|
+ //Feed a little of filament to stabilize pressure
|
|
|
+ if (!automatic)
|
|
|
+ {
|
|
|
+ current_position[E_AXIS] += FILAMENTCHANGE_RECFEED;
|
|
|
+ plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
|
|
|
+ current_position[E_AXIS], FILAMENTCHANGE_EXFEED, active_extruder);
|
|
|
+ }
|
|
|
|
|
|
- //Set E position to original
|
|
|
- plan_set_e_position(lastpos[E_AXIS]);
|
|
|
+ //Move XY back
|
|
|
+ plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS],
|
|
|
+ FILAMENTCHANGE_XYFEED, active_extruder);
|
|
|
+ st_synchronize();
|
|
|
+ //Move Z back
|
|
|
+ plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], current_position[E_AXIS],
|
|
|
+ FILAMENTCHANGE_ZFEED, active_extruder);
|
|
|
+ st_synchronize();
|
|
|
|
|
|
- memcpy(current_position, lastpos, sizeof(lastpos));
|
|
|
- memcpy(destination, current_position, sizeof(current_position));
|
|
|
-
|
|
|
- //Recover feed rate
|
|
|
- feedmultiply=feedmultiplyBckp;
|
|
|
- char cmd[9];
|
|
|
- sprintf_P(cmd, PSTR("M220 S%i"), feedmultiplyBckp);
|
|
|
- enquecommand(cmd);
|
|
|
-
|
|
|
- lcd_setstatuspgm(_T(WELCOME_MSG));
|
|
|
- custom_message_type = CUSTOM_MSG_TYPE_STATUS;
|
|
|
-
|
|
|
+ //Set E position to original
|
|
|
+ plan_set_e_position(lastpos[E_AXIS]);
|
|
|
+
|
|
|
+ memcpy(current_position, lastpos, sizeof(lastpos));
|
|
|
+ memcpy(destination, current_position, sizeof(current_position));
|
|
|
+
|
|
|
+ //Recover feed rate
|
|
|
+ feedmultiply = feedmultiplyBckp;
|
|
|
+ char cmd[9];
|
|
|
+ sprintf_P(cmd, PSTR("M220 S%i"), feedmultiplyBckp);
|
|
|
+ enquecommand(cmd);
|
|
|
+
|
|
|
+ lcd_setstatuspgm(_T(WELCOME_MSG));
|
|
|
+ custom_message_type = CUSTOM_MSG_TYPE_STATUS;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -3289,7 +3155,136 @@ extern uint8_t st_backlash_x;
|
|
|
extern uint8_t st_backlash_y;
|
|
|
#endif //BACKLASH_Y
|
|
|
|
|
|
-
|
|
|
+//! @brief Parse and process commands
|
|
|
+//!
|
|
|
+//! look here for descriptions of G-codes: http://linuxcnc.org/handbook/gcode/g-code.html
|
|
|
+//! http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes
|
|
|
+//!
|
|
|
+//! Implemented Codes
|
|
|
+//! -------------------
|
|
|
+//!
|
|
|
+//!@n PRUSA CODES
|
|
|
+//!@n P F - Returns FW versions
|
|
|
+//!@n P R - Returns revision of printer
|
|
|
+//!
|
|
|
+//!@n G0 -> G1
|
|
|
+//!@n G1 - Coordinated Movement X Y Z E
|
|
|
+//!@n G2 - CW ARC
|
|
|
+//!@n G3 - CCW ARC
|
|
|
+//!@n G4 - Dwell S<seconds> or P<milliseconds>
|
|
|
+//!@n G10 - retract filament according to settings of M207
|
|
|
+//!@n G11 - retract recover filament according to settings of M208
|
|
|
+//!@n G28 - Home all Axis
|
|
|
+//!@n G29 - Detailed Z-Probe, probes the bed at 3 or more points. Will fail if you haven't homed yet.
|
|
|
+//!@n G30 - Single Z Probe, probes bed at current XY location.
|
|
|
+//!@n G31 - Dock sled (Z_PROBE_SLED only)
|
|
|
+//!@n G32 - Undock sled (Z_PROBE_SLED only)
|
|
|
+//!@n G80 - Automatic mesh bed leveling
|
|
|
+//!@n G81 - Print bed profile
|
|
|
+//!@n G90 - Use Absolute Coordinates
|
|
|
+//!@n G91 - Use Relative Coordinates
|
|
|
+//!@n G92 - Set current position to coordinates given
|
|
|
+//!
|
|
|
+//!@n M Codes
|
|
|
+//!@n M0 - Unconditional stop - Wait for user to press a button on the LCD
|
|
|
+//!@n M1 - Same as M0
|
|
|
+//!@n M17 - Enable/Power all stepper motors
|
|
|
+//!@n M18 - Disable all stepper motors; same as M84
|
|
|
+//!@n M20 - List SD card
|
|
|
+//!@n M21 - Init SD card
|
|
|
+//!@n M22 - Release SD card
|
|
|
+//!@n M23 - Select SD file (M23 filename.g)
|
|
|
+//!@n M24 - Start/resume SD print
|
|
|
+//!@n M25 - Pause SD print
|
|
|
+//!@n M26 - Set SD position in bytes (M26 S12345)
|
|
|
+//!@n M27 - Report SD print status
|
|
|
+//!@n M28 - Start SD write (M28 filename.g)
|
|
|
+//!@n M29 - Stop SD write
|
|
|
+//!@n M30 - Delete file from SD (M30 filename.g)
|
|
|
+//!@n M31 - Output time since last M109 or SD card start to serial
|
|
|
+//!@n M32 - Select file and start SD print (Can be used _while_ printing from SD card files):
|
|
|
+//! syntax "M32 /path/filename#", or "M32 S<startpos bytes> !filename#"
|
|
|
+//! Call gcode file : "M32 P !filename#" and return to caller file after finishing (similar to #include).
|
|
|
+//! The '#' is necessary when calling from within sd files, as it stops buffer prereading
|
|
|
+//!@n M42 - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
|
|
|
+//!@n M73 - Show percent done and print time remaining
|
|
|
+//!@n M80 - Turn on Power Supply
|
|
|
+//!@n M81 - Turn off Power Supply
|
|
|
+//!@n M82 - Set E codes absolute (default)
|
|
|
+//!@n M83 - Set E codes relative while in Absolute Coordinates (G90) mode
|
|
|
+//!@n M84 - Disable steppers until next move,
|
|
|
+//! or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout.
|
|
|
+//!@n M85 - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
|
|
|
+//!@n M86 - Set safety timer expiration time with parameter S<seconds>; M86 S0 will disable safety timer
|
|
|
+//!@n M92 - Set axis_steps_per_unit - same syntax as G92
|
|
|
+//!@n M104 - Set extruder target temp
|
|
|
+//!@n M105 - Read current temp
|
|
|
+//!@n M106 - Fan on
|
|
|
+//!@n M107 - Fan off
|
|
|
+//!@n M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
|
|
|
+//! Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
|
|
|
+//! IF AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F
|
|
|
+//!@n M112 - Emergency stop
|
|
|
+//!@n M113 - Get or set the timeout interval for Host Keepalive "busy" messages
|
|
|
+//!@n M114 - Output current position to serial port
|
|
|
+//!@n M115 - Capabilities string
|
|
|
+//!@n M117 - display message
|
|
|
+//!@n M119 - Output Endstop status to serial port
|
|
|
+//!@n M126 - Solenoid Air Valve Open (BariCUDA support by jmil)
|
|
|
+//!@n M127 - Solenoid Air Valve Closed (BariCUDA vent to atmospheric pressure by jmil)
|
|
|
+//!@n M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil)
|
|
|
+//!@n M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil)
|
|
|
+//!@n M140 - Set bed target temp
|
|
|
+//!@n M150 - Set BlinkM Color Output R: Red<0-255> U(!): Green<0-255> B: Blue<0-255> over i2c, G for green does not work.
|
|
|
+//!@n M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating
|
|
|
+//! Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
|
|
|
+//!@n M200 D<millimeters>- set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters).
|
|
|
+//!@n M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000)
|
|
|
+//!@n M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
|
|
|
+//!@n M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
|
|
|
+//!@n M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) in mm/sec^2 also sets minimum segment time in ms (B20000) to prevent buffer under-runs and M20 minimum feedrate
|
|
|
+//!@n 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
|
|
|
+//!@n M206 - set additional homing offset
|
|
|
+//!@n M207 - set retract length S[positive mm] F[feedrate mm/min] Z[additional zlift/hop], stays in mm regardless of M200 setting
|
|
|
+//!@n M208 - set recover=unretract length S[positive mm surplus to the M207 S*] F[feedrate mm/sec]
|
|
|
+//!@n 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.
|
|
|
+//!@n M218 - set hotend offset (in mm): T<extruder_number> X<offset_on_X> Y<offset_on_Y>
|
|
|
+//!@n M220 S<factor in percent>- set speed factor override percentage
|
|
|
+//!@n M221 S<factor in percent>- set extrude factor override percentage
|
|
|
+//!@n M226 P<pin number> S<pin state>- Wait until the specified pin reaches the state required
|
|
|
+//!@n M240 - Trigger a camera to take a photograph
|
|
|
+//!@n M250 - Set LCD contrast C<contrast value> (value 0..63)
|
|
|
+//!@n M280 - set servo position absolute. P: servo index, S: angle or microseconds
|
|
|
+//!@n M300 - Play beep sound S<frequency Hz> P<duration ms>
|
|
|
+//!@n M301 - Set PID parameters P I and D
|
|
|
+//!@n M302 - Allow cold extrudes, or set the minimum extrude S<temperature>.
|
|
|
+//!@n M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
|
|
|
+//!@n M304 - Set bed PID parameters P I and D
|
|
|
+//!@n M400 - Finish all moves
|
|
|
+//!@n M401 - Lower z-probe if present
|
|
|
+//!@n M402 - Raise z-probe if present
|
|
|
+//!@n M404 - N<dia in mm> Enter the nominal filament width (3mm, 1.75mm ) or will display nominal filament width without parameters
|
|
|
+//!@n M405 - Turn on Filament Sensor extrusion control. Optional D<delay in cm> to set delay in centimeters between sensor and extruder
|
|
|
+//!@n M406 - Turn off Filament Sensor extrusion control
|
|
|
+//!@n M407 - Displays measured filament diameter
|
|
|
+//!@n M500 - stores parameters in EEPROM
|
|
|
+//!@n M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
|
|
|
+//!@n M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
|
|
|
+//!@n M503 - print the current settings (from memory not from EEPROM)
|
|
|
+//!@n M509 - force language selection on next restart
|
|
|
+//!@n M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
|
|
+//!@n M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
|
|
|
+//!@n M605 - Set dual x-carriage movement mode: S<mode> [ X<duplication x-offset> R<duplication temp offset> ]
|
|
|
+//!@n M860 - Wait for PINDA thermistor to reach target temperature.
|
|
|
+//!@n M861 - Set / Read PINDA temperature compensation offsets
|
|
|
+//!@n M900 - Set LIN_ADVANCE options, if enabled. See Configuration_adv.h for details.
|
|
|
+//!@n M907 - Set digital trimpot motor current using axis codes.
|
|
|
+//!@n M908 - Control digital trimpot directly.
|
|
|
+//!@n M350 - Set microstepping mode.
|
|
|
+//!@n M351 - Toggle MS1 MS2 pins directly.
|
|
|
+//!
|
|
|
+//!@n M928 - Start SD logging (M928 filename.g) - ended by M29
|
|
|
+//!@n M999 - Restart after being stopped by error
|
|
|
void process_commands()
|
|
|
{
|
|
|
if (!buflen) return; //empty command
|
|
@@ -3331,21 +3326,21 @@ void process_commands()
|
|
|
#ifdef TMC2130
|
|
|
else if (strncmp_P(CMDBUFFER_CURRENT_STRING, PSTR("CRASH_"), 6) == 0)
|
|
|
{
|
|
|
- if(code_seen("CRASH_DETECTED"))
|
|
|
+ if(code_seen("CRASH_DETECTED")) //! CRASH_DETECTED
|
|
|
{
|
|
|
uint8_t mask = 0;
|
|
|
if (code_seen('X')) mask |= X_AXIS_MASK;
|
|
|
if (code_seen('Y')) mask |= Y_AXIS_MASK;
|
|
|
crashdet_detected(mask);
|
|
|
}
|
|
|
- else if(code_seen("CRASH_RECOVER"))
|
|
|
+ else if(code_seen("CRASH_RECOVER")) //! CRASH_RECOVER
|
|
|
crashdet_recover();
|
|
|
- else if(code_seen("CRASH_CANCEL"))
|
|
|
+ else if(code_seen("CRASH_CANCEL")) //! CRASH_CANCEL
|
|
|
crashdet_cancel();
|
|
|
}
|
|
|
else if (strncmp_P(CMDBUFFER_CURRENT_STRING, PSTR("TMC_"), 4) == 0)
|
|
|
{
|
|
|
- if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_WAVE_"), 9) == 0)
|
|
|
+ if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_WAVE_"), 9) == 0) //! TMC_SET_WAVE_
|
|
|
{
|
|
|
uint8_t axis = *(CMDBUFFER_CURRENT_STRING + 13);
|
|
|
axis = (axis == 'E')?3:(axis - 'X');
|
|
@@ -3355,7 +3350,7 @@ void process_commands()
|
|
|
tmc2130_set_wave(axis, 247, fac);
|
|
|
}
|
|
|
}
|
|
|
- else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_STEP_"), 9) == 0)
|
|
|
+ else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_STEP_"), 9) == 0) //! TMC_SET_STEP_
|
|
|
{
|
|
|
uint8_t axis = *(CMDBUFFER_CURRENT_STRING + 13);
|
|
|
axis = (axis == 'E')?3:(axis - 'X');
|
|
@@ -3366,7 +3361,7 @@ void process_commands()
|
|
|
tmc2130_goto_step(axis, step & (4*res - 1), 2, 1000, res);
|
|
|
}
|
|
|
}
|
|
|
- else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_CHOP_"), 9) == 0)
|
|
|
+ else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_CHOP_"), 9) == 0) //! TMC_SET_CHOP_
|
|
|
{
|
|
|
uint8_t axis = *(CMDBUFFER_CURRENT_STRING + 13);
|
|
|
axis = (axis == 'E')?3:(axis - 'X');
|
|
@@ -3417,22 +3412,22 @@ void process_commands()
|
|
|
}
|
|
|
#endif //BACKLASH_Y
|
|
|
#endif //TMC2130
|
|
|
- else if (code_seen("FSENSOR_RECOVER")) {
|
|
|
+ else if (code_seen("FSENSOR_RECOVER")) { //! FSENSOR_RECOVER
|
|
|
fsensor_restore_print_and_continue();
|
|
|
}
|
|
|
else if(code_seen("PRUSA")){
|
|
|
- if (code_seen("Ping")) { //PRUSA Ping
|
|
|
+ if (code_seen("Ping")) { //! PRUSA Ping
|
|
|
if (farm_mode) {
|
|
|
PingTime = millis();
|
|
|
//MYSERIAL.print(farm_no); MYSERIAL.println(": OK");
|
|
|
}
|
|
|
}
|
|
|
- else if (code_seen("PRN")) {
|
|
|
+ else if (code_seen("PRN")) { //! PRUSA PRN
|
|
|
printf_P(_N("%d"), status_number);
|
|
|
|
|
|
- }else if (code_seen("FAN")) {
|
|
|
+ }else if (code_seen("FAN")) { //! PRUSA FAN
|
|
|
printf_P(_N("E0:%d RPM\nPRN0:%d RPM\n"), 60*fan_speed[0], 60*fan_speed[1]);
|
|
|
- }else if (code_seen("fn")) {
|
|
|
+ }else if (code_seen("fn")) { //! PRUSA fn
|
|
|
if (farm_mode) {
|
|
|
printf_P(_N("%d"), farm_no);
|
|
|
}
|
|
@@ -3441,20 +3436,20 @@ void process_commands()
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- else if (code_seen("thx"))
|
|
|
+ else if (code_seen("thx")) //! PRUSA thx
|
|
|
{
|
|
|
no_response = false;
|
|
|
}
|
|
|
- else if (code_seen("uvlo"))
|
|
|
+ else if (code_seen("uvlo")) //! PRUSA uvlo
|
|
|
{
|
|
|
eeprom_update_byte((uint8_t*)EEPROM_UVLO,0);
|
|
|
enquecommand_P(PSTR("M24"));
|
|
|
}
|
|
|
- else if (code_seen("MMURES"))
|
|
|
+ else if (code_seen("MMURES")) //! PRUSA MMURES
|
|
|
{
|
|
|
mmu_reset();
|
|
|
}
|
|
|
- else if (code_seen("RESET")) {
|
|
|
+ else if (code_seen("RESET")) { //! PRUSA RESET
|
|
|
// careful!
|
|
|
if (farm_mode) {
|
|
|
#ifdef WATCHDOG
|
|
@@ -3470,7 +3465,7 @@ void process_commands()
|
|
|
else {
|
|
|
MYSERIAL.println("Not in farm mode.");
|
|
|
}
|
|
|
- }else if (code_seen("fv")) {
|
|
|
+ }else if (code_seen("fv")) { //! PRUSA fv
|
|
|
// get file version
|
|
|
#ifdef SDSUPPORT
|
|
|
card.openFile(strchr_pointer + 3,true);
|
|
@@ -3485,35 +3480,35 @@ void process_commands()
|
|
|
|
|
|
#endif // SDSUPPORT
|
|
|
|
|
|
- } else if (code_seen("M28")) {
|
|
|
+ } else if (code_seen("M28")) { //! PRUSA M28
|
|
|
trace();
|
|
|
prusa_sd_card_upload = true;
|
|
|
card.openFile(strchr_pointer+4,false);
|
|
|
|
|
|
- } else if (code_seen("SN")) {
|
|
|
+ } else if (code_seen("SN")) { //! PRUSA SN
|
|
|
gcode_PRUSA_SN();
|
|
|
|
|
|
- } else if(code_seen("Fir")){
|
|
|
+ } else if(code_seen("Fir")){ //! PRUSA Fir
|
|
|
|
|
|
SERIAL_PROTOCOLLN(FW_VERSION_FULL);
|
|
|
|
|
|
- } else if(code_seen("Rev")){
|
|
|
+ } else if(code_seen("Rev")){ //! PRUSA Rev
|
|
|
|
|
|
SERIAL_PROTOCOLLN(FILAMENT_SIZE "-" ELECTRONICS "-" NOZZLE_TYPE );
|
|
|
|
|
|
- } else if(code_seen("Lang")) {
|
|
|
+ } else if(code_seen("Lang")) { //! PRUSA Lang
|
|
|
lang_reset();
|
|
|
|
|
|
- } else if(code_seen("Lz")) {
|
|
|
+ } else if(code_seen("Lz")) { //! PRUSA Lz
|
|
|
EEPROM_save_B(EEPROM_BABYSTEP_Z,0);
|
|
|
|
|
|
- } else if(code_seen("Beat")) {
|
|
|
+ } else if(code_seen("Beat")) { //! PRUSA Beat
|
|
|
// Kick farm link timer
|
|
|
kicktime = millis();
|
|
|
|
|
|
- } else if(code_seen("FR")) {
|
|
|
+ } else if(code_seen("FR")) { //! PRUSA FR
|
|
|
// Factory full reset
|
|
|
- factory_reset(0,true);
|
|
|
+ factory_reset(0);
|
|
|
}
|
|
|
//else if (code_seen('Cal')) {
|
|
|
// lcd_calibration();
|
|
@@ -3536,7 +3531,7 @@ void process_commands()
|
|
|
|
|
|
if(READ(FR_SENS)){
|
|
|
|
|
|
- feedmultiplyBckp=feedmultiply;
|
|
|
+ int feedmultiplyBckp=feedmultiply;
|
|
|
float target[4];
|
|
|
float lastpos[4];
|
|
|
target[X_AXIS]=current_position[X_AXIS];
|
|
@@ -3818,7 +3813,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
current_position[Y_AXIS] = uncorrected_position.y;
|
|
|
current_position[Z_AXIS] = uncorrected_position.z;
|
|
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
- setup_for_endstop_move();
|
|
|
+ int l_feedmultiply = setup_for_endstop_move();
|
|
|
|
|
|
feedrate = homing_feedrate[Z_AXIS];
|
|
|
#ifdef AUTO_BED_LEVELING_GRID
|
|
@@ -3884,7 +3879,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
xProbe += xInc;
|
|
|
}
|
|
|
}
|
|
|
- clean_up_after_endstop_move();
|
|
|
+ clean_up_after_endstop_move(l_feedmultiply);
|
|
|
|
|
|
// solve lsq problem
|
|
|
double *plane_equation_coefficients = qr_solve(AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS, 3, eqnAMatrix, eqnBVector);
|
|
@@ -3913,7 +3908,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
// probe 3
|
|
|
float z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
|
|
|
|
|
|
- clean_up_after_endstop_move();
|
|
|
+ clean_up_after_endstop_move(l_feedmultiply);
|
|
|
|
|
|
set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
|
|
|
|
|
@@ -3939,7 +3934,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
{
|
|
|
st_synchronize();
|
|
|
// TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly
|
|
|
- setup_for_endstop_move();
|
|
|
+ int l_feedmultiply = setup_for_endstop_move();
|
|
|
|
|
|
feedrate = homing_feedrate[Z_AXIS];
|
|
|
|
|
@@ -3953,7 +3948,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
SERIAL_PROTOCOL(current_position[Z_AXIS]);
|
|
|
SERIAL_PROTOCOLPGM("\n");
|
|
|
|
|
|
- clean_up_after_endstop_move();
|
|
|
+ clean_up_after_endstop_move(l_feedmultiply);
|
|
|
}
|
|
|
break;
|
|
|
#else
|
|
@@ -3971,7 +3966,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
{
|
|
|
st_synchronize();
|
|
|
// TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly
|
|
|
- setup_for_endstop_move();
|
|
|
+ int l_feedmultiply = setup_for_endstop_move();
|
|
|
|
|
|
feedrate = homing_feedrate[Z_AXIS];
|
|
|
|
|
@@ -3979,7 +3974,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
|
|
|
printf_P(_N("%S X: %.5f Y: %.5f Z: %.5f\n"), _T(MSG_BED), _x, _y, _z);
|
|
|
|
|
|
- clean_up_after_endstop_move();
|
|
|
+ clean_up_after_endstop_move(l_feedmultiply);
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -3991,7 +3986,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 76: //PINDA probe temperature calibration
|
|
|
+ case 76: //! G76 - PINDA probe temperature calibration
|
|
|
{
|
|
|
#ifdef PINDA_THERMISTOR
|
|
|
if (true)
|
|
@@ -4250,12 +4245,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
#ifdef DIS
|
|
|
case 77:
|
|
|
{
|
|
|
- //G77 X200 Y150 XP100 YP15 XO10 Y015
|
|
|
-
|
|
|
- //for 9 point mesh bed leveling G77 X203 Y196 XP3 YP3 XO0 YO0
|
|
|
-
|
|
|
-
|
|
|
- //G77 X232 Y218 XP116 YP109 XO-11 YO0
|
|
|
+ //! G77 X200 Y150 XP100 YP15 XO10 Y015
|
|
|
+ //! for 9 point mesh bed leveling G77 X203 Y196 XP3 YP3 XO0 YO0
|
|
|
+ //! G77 X232 Y218 XP116 YP109 XO-11 YO0
|
|
|
|
|
|
float dimension_x = 40;
|
|
|
float dimension_y = 40;
|
|
@@ -4294,12 +4286,12 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
* mesh to compensate for variable bed height
|
|
|
*
|
|
|
* The S0 report the points as below
|
|
|
- *
|
|
|
+ * @code{.unparsed}
|
|
|
* +----> X-axis
|
|
|
* |
|
|
|
* |
|
|
|
* v Y-axis
|
|
|
- *
|
|
|
+ * @endcode
|
|
|
*/
|
|
|
|
|
|
case 80:
|
|
@@ -4404,7 +4396,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
has_z ? SERIAL_PROTOCOLPGM("Z jitter data from Z cal. valid.\n") : SERIAL_PROTOCOLPGM("Z jitter data from Z cal. not valid.\n");
|
|
|
}
|
|
|
#endif // SUPPORT_VERBOSITY
|
|
|
- setup_for_endstop_move(false); //save feedrate and feedmultiply, sets feedmultiply to 100
|
|
|
+ int l_feedmultiply = setup_for_endstop_move(false); //save feedrate and feedmultiply, sets feedmultiply to 100
|
|
|
const char *kill_message = NULL;
|
|
|
while (mesh_point != MESH_MEAS_NUM_X_POINTS * MESH_MEAS_NUM_Y_POINTS) {
|
|
|
// Get coords of a measuring point.
|
|
@@ -4511,7 +4503,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
kill(kill_message);
|
|
|
SERIAL_ECHOLNPGM("killed");
|
|
|
}
|
|
|
- clean_up_after_endstop_move();
|
|
|
+ clean_up_after_endstop_move(l_feedmultiply);
|
|
|
// SERIAL_ECHOLNPGM("clean up finished ");
|
|
|
|
|
|
bool apply_temp_comp = true;
|
|
@@ -4635,9 +4627,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
*/
|
|
|
case 82:
|
|
|
SERIAL_PROTOCOLLNPGM("Finding bed ");
|
|
|
- setup_for_endstop_move();
|
|
|
+ int l_feedmultiply = setup_for_endstop_move();
|
|
|
find_bed_induction_sensor_point_z();
|
|
|
- clean_up_after_endstop_move();
|
|
|
+ clean_up_after_endstop_move(l_feedmultiply);
|
|
|
SERIAL_PROTOCOLPGM("Bed found at: ");
|
|
|
SERIAL_PROTOCOL_F(current_position[Z_AXIS], 5);
|
|
|
SERIAL_PROTOCOLPGM("\n");
|
|
@@ -4732,7 +4724,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 98: // G98 (activate farm mode)
|
|
|
+ case 98: //! G98 (activate farm mode)
|
|
|
farm_mode = 1;
|
|
|
PingTime = millis();
|
|
|
eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
|
|
@@ -4741,7 +4733,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu);
|
|
|
break;
|
|
|
|
|
|
- case 99: // G99 (deactivate farm mode)
|
|
|
+ case 99: //! G99 (deactivate farm mode)
|
|
|
farm_mode = 0;
|
|
|
lcd_printer_connected();
|
|
|
eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
|
|
@@ -4987,7 +4979,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
- case 44: // M44: Prusa3D: Reset the bed skew and offset calibration.
|
|
|
+ case 44: //! M44: Prusa3D: Reset the bed skew and offset calibration.
|
|
|
|
|
|
// Reset the baby step value and the baby step applied flag.
|
|
|
calibration_status_store(CALIBRATION_STATUS_ASSEMBLED);
|
|
@@ -5001,7 +4993,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
world2machine_revert_to_uncorrected();
|
|
|
break;
|
|
|
|
|
|
- case 45: // M45: Prusa3D: bed skew and offset with manual Z up
|
|
|
+ case 45: //! M45: Prusa3D: bed skew and offset with manual Z up
|
|
|
{
|
|
|
int8_t verbosity_level = 0;
|
|
|
bool only_Z = code_seen('Z');
|
|
@@ -5041,14 +5033,14 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
*/
|
|
|
|
|
|
case 47:
|
|
|
- // M47: Prusa3D: Show end stops dialog on the display.
|
|
|
+ //! M47: Prusa3D: Show end stops dialog on the display.
|
|
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
|
lcd_diag_show_end_stops();
|
|
|
KEEPALIVE_STATE(IN_HANDLER);
|
|
|
break;
|
|
|
|
|
|
#if 0
|
|
|
- case 48: // M48: scan the bed induction sensor points, print the sensor trigger coordinates to the serial line for visualization on the PC.
|
|
|
+ case 48: //! M48: scan the bed induction sensor points, print the sensor trigger coordinates to the serial line for visualization on the PC.
|
|
|
{
|
|
|
// Disable the default update procedure of the display. We will do a modal dialog.
|
|
|
lcd_update_enable(false);
|
|
@@ -5064,7 +5056,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
st_synchronize();
|
|
|
// Home in the XY plane.
|
|
|
set_destination_to_current();
|
|
|
- setup_for_endstop_move();
|
|
|
+ int l_feedmultiply = setup_for_endstop_move();
|
|
|
home_xy();
|
|
|
int8_t verbosity_level = 0;
|
|
|
if (code_seen('V')) {
|
|
@@ -5073,7 +5065,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
verbosity_level = (c == ' ' || c == '\t' || c == 0) ? 1 : code_value_short();
|
|
|
}
|
|
|
bool success = scan_bed_induction_points(verbosity_level);
|
|
|
- clean_up_after_endstop_move();
|
|
|
+ clean_up_after_endstop_move(l_feedmultiply);
|
|
|
// Print head up.
|
|
|
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
|
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS],current_position[Z_AXIS] , current_position[E_AXIS], homing_feedrate[Z_AXIS]/40, active_extruder);
|
|
@@ -5083,23 +5075,22 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
-// M48 Z-Probe repeatability measurement function.
|
|
|
-//
|
|
|
-// Usage: M48 <n #_samples> <X X_position_for_samples> <Y Y_position_for_samples> <V Verbose_Level> <L legs_of_movement_prior_to_doing_probe>
|
|
|
-//
|
|
|
-// This function assumes the bed has been homed. Specificaly, that a G28 command
|
|
|
-// as been issued prior to invoking the M48 Z-Probe repeatability measurement function.
|
|
|
-// Any information generated by a prior G29 Bed leveling command will be lost and need to be
|
|
|
-// regenerated.
|
|
|
-//
|
|
|
-// The number of samples will default to 10 if not specified. You can use upper or lower case
|
|
|
-// letters for any of the options EXCEPT n. n must be in lower case because Marlin uses a capital
|
|
|
-// N for its communication protocol and will get horribly confused if you send it a capital N.
|
|
|
-//
|
|
|
|
|
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
|
|
#ifdef Z_PROBE_REPEATABILITY_TEST
|
|
|
-
|
|
|
+ //! M48 Z-Probe repeatability measurement function.
|
|
|
+ //!
|
|
|
+ //! Usage: M48 <n #_samples> <X X_position_for_samples> <Y Y_position_for_samples> <V Verbose_Level> <L legs_of_movement_prior_to_doing_probe>
|
|
|
+ //!
|
|
|
+ //! This function assumes the bed has been homed. Specificaly, that a G28 command
|
|
|
+ //! as been issued prior to invoking the M48 Z-Probe repeatability measurement function.
|
|
|
+ //! Any information generated by a prior G29 Bed leveling command will be lost and need to be
|
|
|
+ //! regenerated.
|
|
|
+ //!
|
|
|
+ //! The number of samples will default to 10 if not specified. You can use upper or lower case
|
|
|
+ //! letters for any of the options EXCEPT n. n must be in lower case because Marlin uses a capital
|
|
|
+ //! N for its communication protocol and will get horribly confused if you send it a capital N.
|
|
|
+ //!
|
|
|
case 48: // M48 Z-Probe repeatability
|
|
|
{
|
|
|
#if Z_MIN_PIN == -1
|
|
@@ -5203,7 +5194,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
// Then retrace the right amount and use that in subsequent probes
|
|
|
//
|
|
|
|
|
|
- setup_for_endstop_move();
|
|
|
+ int l_feedmultiply = setup_for_endstop_move();
|
|
|
run_z_probe();
|
|
|
|
|
|
current_position[Z_AXIS] = Z_current = st_get_position_mm(Z_AXIS);
|
|
@@ -5267,7 +5258,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
do_blocking_move_to( X_probe_location, Y_probe_location, Z_start_location); // Go back to the probe location
|
|
|
}
|
|
|
|
|
|
- setup_for_endstop_move();
|
|
|
+ int l_feedmultiply = setup_for_endstop_move();
|
|
|
run_z_probe();
|
|
|
|
|
|
sample_set[n] = current_position[Z_AXIS];
|
|
@@ -5318,9 +5309,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
|
|
|
delay(1000);
|
|
|
|
|
|
- clean_up_after_endstop_move();
|
|
|
+ clean_up_after_endstop_move(l_feedmultiply);
|
|
|
|
|
|
-// enable_endstops(true);
|
|
|
+// enable_endstops(true);
|
|
|
|
|
|
if (verbose_level > 0) {
|
|
|
SERIAL_PROTOCOLPGM("Mean: ");
|
|
@@ -5565,7 +5556,7 @@ Sigma_Exit:
|
|
|
break;
|
|
|
|
|
|
#if defined(FAN_PIN) && FAN_PIN > -1
|
|
|
- case 106: //M106 Fan On
|
|
|
+ case 106: //!M106 Sxxx Fan On S<speed> 0 .. 255
|
|
|
if (code_seen('S')){
|
|
|
fanSpeed=constrain(code_value(),0,255);
|
|
|
}
|
|
@@ -5694,7 +5685,7 @@ Sigma_Exit:
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
- case 110: // M110 - reset line pos
|
|
|
+ case 110: //! M110 N<line number> - reset line pos
|
|
|
if (code_seen('N'))
|
|
|
gcode_LastN = code_value_long();
|
|
|
break;
|
|
@@ -5741,10 +5732,10 @@ Sigma_Exit:
|
|
|
case 114: // M114
|
|
|
gcode_M114();
|
|
|
break;
|
|
|
- case 120: // M120
|
|
|
+ case 120: //! M120 - Disable endstops
|
|
|
enable_endstops(false) ;
|
|
|
break;
|
|
|
- case 121: // M121
|
|
|
+ case 121: //! M121 - Enable endstops
|
|
|
enable_endstops(true) ;
|
|
|
break;
|
|
|
case 119: // M119
|
|
@@ -5915,9 +5906,9 @@ Sigma_Exit:
|
|
|
}
|
|
|
break;
|
|
|
case 204:
|
|
|
- // M204 acclereration settings.
|
|
|
- // Supporting old format: M204 S[normal moves] T[filmanent only moves]
|
|
|
- // and new format: M204 P[printing moves] R[filmanent only moves] T[travel moves] (as of now T is ignored)
|
|
|
+ //! M204 acclereration settings.
|
|
|
+ //!@n Supporting old format: M204 S[normal moves] T[filmanent only moves]
|
|
|
+ //!@n and new format: M204 P[printing moves] R[filmanent only moves] T[travel moves] (as of now T is ignored)
|
|
|
{
|
|
|
if(code_seen('S')) {
|
|
|
// Legacy acceleration format. This format is used by the legacy Marlin, MK2 or MK3 firmware,
|
|
@@ -6301,15 +6292,15 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 403: //M403 set filament type (material) for particular extruder and send this information to mmu
|
|
|
+ case 403: //! M403 set filament type (material) for particular extruder and send this information to mmu
|
|
|
{
|
|
|
- //currently three different materials are needed (default, flex and PVA)
|
|
|
- //add storing this information for different load/unload profiles etc. in the future
|
|
|
- //firmware does not wait for "ok" from mmu
|
|
|
+ //! currently three different materials are needed (default, flex and PVA)
|
|
|
+ //! add storing this information for different load/unload profiles etc. in the future
|
|
|
+ //!firmware does not wait for "ok" from mmu
|
|
|
if (mmu_enabled)
|
|
|
{
|
|
|
- uint8_t extruder;
|
|
|
- uint8_t filament;
|
|
|
+ uint8_t extruder = 255;
|
|
|
+ uint8_t filament = FILAMENT_UNDEFINED;
|
|
|
if(code_seen('E')) extruder = code_value();
|
|
|
if(code_seen('F')) filament = code_value();
|
|
|
mmu_set_filament_type(extruder, filament);
|
|
@@ -6466,13 +6457,14 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
#endif //FILAMENTCHANGEENABLE
|
|
|
- case 601: {
|
|
|
- if(lcd_commands_type == 0) lcd_commands_type = LCD_COMMAND_LONG_PAUSE;
|
|
|
+ case 601: //! M601 - Pause print
|
|
|
+ {
|
|
|
+ lcd_pause_print();
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 602: {
|
|
|
- if(lcd_commands_type == 0) lcd_commands_type = LCD_COMMAND_LONG_PAUSE_RESUME;
|
|
|
+ case 602: { //! M602 - Resume print
|
|
|
+ lcd_resume_print();
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -6564,8 +6556,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
else if (code_seen('S')) { // Sxxx Iyyy - Set compensation ustep value S for compensation table index I
|
|
|
int16_t usteps = code_value();
|
|
|
if (code_seen('I')) {
|
|
|
- byte index = code_value();
|
|
|
- if ((index >= 0) && (index < 5)) {
|
|
|
+ uint8_t index = code_value();
|
|
|
+ if (index < 5) {
|
|
|
EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + index * 2, &usteps);
|
|
|
SERIAL_PROTOCOLLN("OK");
|
|
|
SERIAL_PROTOCOLLN("index, temp, ustep, um");
|
|
@@ -6630,13 +6622,13 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
|
|
|
#ifdef TMC2130
|
|
|
|
|
|
- case 910: // M910 TMC2130 init
|
|
|
+ case 910: //! M910 - TMC2130 init
|
|
|
{
|
|
|
tmc2130_init();
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 911: // M911 Set TMC2130 holding currents
|
|
|
+ case 911: //! M911 - Set TMC2130 holding currents
|
|
|
{
|
|
|
if (code_seen('X')) tmc2130_set_current_h(0, code_value());
|
|
|
if (code_seen('Y')) tmc2130_set_current_h(1, code_value());
|
|
@@ -6645,7 +6637,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 912: // M912 Set TMC2130 running currents
|
|
|
+ case 912: //! M912 - Set TMC2130 running currents
|
|
|
{
|
|
|
if (code_seen('X')) tmc2130_set_current_r(0, code_value());
|
|
|
if (code_seen('Y')) tmc2130_set_current_r(1, code_value());
|
|
@@ -6654,13 +6646,13 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 913: // M913 Print TMC2130 currents
|
|
|
+ case 913: //! M913 - Print TMC2130 currents
|
|
|
{
|
|
|
tmc2130_print_currents();
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 914: // M914 Set normal mode
|
|
|
+ case 914: //! M914 - Set normal mode
|
|
|
{
|
|
|
tmc2130_mode = TMC2130_MODE_NORMAL;
|
|
|
update_mode_profile();
|
|
@@ -6668,7 +6660,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 915: // M915 Set silent mode
|
|
|
+ case 915: //! M915 - Set silent mode
|
|
|
{
|
|
|
tmc2130_mode = TMC2130_MODE_SILENT;
|
|
|
update_mode_profile();
|
|
@@ -6676,7 +6668,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 916: // M916 Set sg_thrs
|
|
|
+ case 916: //! M916 - Set sg_thrs
|
|
|
{
|
|
|
if (code_seen('X')) tmc2130_sg_thr[X_AXIS] = code_value();
|
|
|
if (code_seen('Y')) tmc2130_sg_thr[Y_AXIS] = code_value();
|
|
@@ -6687,7 +6679,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 917: // M917 Set TMC2130 pwm_ampl
|
|
|
+ case 917: //! M917 - Set TMC2130 pwm_ampl
|
|
|
{
|
|
|
if (code_seen('X')) tmc2130_set_pwm_ampl(0, code_value());
|
|
|
if (code_seen('Y')) tmc2130_set_pwm_ampl(1, code_value());
|
|
@@ -6696,7 +6688,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 918: // M918 Set TMC2130 pwm_grad
|
|
|
+ case 918: //! M918 - Set TMC2130 pwm_grad
|
|
|
{
|
|
|
if (code_seen('X')) tmc2130_set_pwm_grad(0, code_value());
|
|
|
if (code_seen('Y')) tmc2130_set_pwm_grad(1, code_value());
|
|
@@ -6707,7 +6699,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
|
|
|
#endif //TMC2130
|
|
|
|
|
|
- case 350: // M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
|
|
|
+ case 350: //! M350 - Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
|
|
|
{
|
|
|
#ifdef TMC2130
|
|
|
if(code_seen('E'))
|
|
@@ -6743,7 +6735,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
#endif //TMC2130
|
|
|
}
|
|
|
break;
|
|
|
- case 351: // M351 Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low.
|
|
|
+ case 351: //! M351 - Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low.
|
|
|
{
|
|
|
#if defined(X_MS1_PIN) && X_MS1_PIN > -1
|
|
|
if(code_seen('S')) switch((int)code_value())
|
|
@@ -6761,23 +6753,23 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
#endif
|
|
|
}
|
|
|
break;
|
|
|
- case 701: //M701: load filament
|
|
|
+ case 701: //! M701 - load filament
|
|
|
{
|
|
|
if (mmu_enabled && code_seen('E'))
|
|
|
tmp_extruder = code_value();
|
|
|
gcode_M701();
|
|
|
}
|
|
|
break;
|
|
|
- case 702:
|
|
|
+ case 702: //! M702 [U C] -
|
|
|
{
|
|
|
if (mmu_enabled)
|
|
|
{
|
|
|
if (code_seen('U'))
|
|
|
- extr_unload_used(); //unload all filaments which were used in current print
|
|
|
+ extr_unload_used(); //! if "U" unload all filaments which were used in current print
|
|
|
else if (code_seen('C'))
|
|
|
- extr_unload(); //unload just current filament
|
|
|
+ extr_unload(); //! if "C" unload just current filament
|
|
|
else
|
|
|
- extr_unload_all(); //unload all filaments
|
|
|
+ extr_unload_all(); //! otherwise unload all filaments
|
|
|
}
|
|
|
else
|
|
|
unload_filament();
|
|
@@ -6797,7 +6789,13 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
mcode_in_progress = 0;
|
|
|
}
|
|
|
} // end if(code_seen('M')) (end of M codes)
|
|
|
-
|
|
|
+ //! T<extruder nr.> - select extruder in case of multi extruder printer
|
|
|
+ //! select filament in case of MMU_V2
|
|
|
+ //! if extruder is "?", open menu to let the user select extruder/filament
|
|
|
+ //!
|
|
|
+ //! For MMU_V2:
|
|
|
+ //! @n T<n> Gcode to extrude must follow immediately to load to extruder wheels
|
|
|
+ //! @n T? Gcode to extrude doesn't have to follow, load to extruder wheels is done automatically
|
|
|
else if(code_seen('T'))
|
|
|
{
|
|
|
int index;
|
|
@@ -6808,8 +6806,15 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
SERIAL_ECHOLNPGM("Invalid T code.");
|
|
|
}
|
|
|
else {
|
|
|
- if (*(strchr_pointer + index) == '?') {
|
|
|
- tmp_extruder = choose_extruder_menu();
|
|
|
+ if (*(strchr_pointer + index) == '?')
|
|
|
+ {
|
|
|
+ if(mmu_enabled)
|
|
|
+ {
|
|
|
+ tmp_extruder = choose_menu_P(_T(MSG_CHOOSE_FILAMENT), _T(MSG_FILAMENT));
|
|
|
+ } else
|
|
|
+ {
|
|
|
+ tmp_extruder = choose_menu_P(_T(MSG_CHOOSE_EXTRUDER), _T(MSG_EXTRUDER));
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
tmp_extruder = code_value();
|
|
@@ -6933,45 +6938,45 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
switch((int)code_value())
|
|
|
{
|
|
|
#ifdef DEBUG_DCODES
|
|
|
- case -1: // D-1 - Endless loop
|
|
|
+ case -1: //! D-1 - Endless loop
|
|
|
dcode__1(); break;
|
|
|
- case 0: // D0 - Reset
|
|
|
+ case 0: //! D0 - Reset
|
|
|
dcode_0(); break;
|
|
|
- case 1: // D1 - Clear EEPROM
|
|
|
+ case 1: //! D1 - Clear EEPROM
|
|
|
dcode_1(); break;
|
|
|
- case 2: // D2 - Read/Write RAM
|
|
|
+ case 2: //! D2 - Read/Write RAM
|
|
|
dcode_2(); break;
|
|
|
#endif //DEBUG_DCODES
|
|
|
#ifdef DEBUG_DCODE3
|
|
|
- case 3: // D3 - Read/Write EEPROM
|
|
|
+ case 3: //! D3 - Read/Write EEPROM
|
|
|
dcode_3(); break;
|
|
|
#endif //DEBUG_DCODE3
|
|
|
#ifdef DEBUG_DCODES
|
|
|
- case 4: // D4 - Read/Write PIN
|
|
|
+ case 4: //! D4 - Read/Write PIN
|
|
|
dcode_4(); break;
|
|
|
- case 5: // D5 - Read/Write FLASH
|
|
|
+ case 5: //! D5 - Read/Write FLASH
|
|
|
// dcode_5(); break;
|
|
|
break;
|
|
|
- case 6: // D6 - Read/Write external FLASH
|
|
|
+ case 6: //! D6 - Read/Write external FLASH
|
|
|
dcode_6(); break;
|
|
|
- case 7: // D7 - Read/Write Bootloader
|
|
|
+ case 7: //! D7 - Read/Write Bootloader
|
|
|
dcode_7(); break;
|
|
|
- case 8: // D8 - Read/Write PINDA
|
|
|
+ case 8: //! D8 - Read/Write PINDA
|
|
|
dcode_8(); break;
|
|
|
- case 9: // D9 - Read/Write ADC
|
|
|
+ case 9: //! D9 - Read/Write ADC
|
|
|
dcode_9(); break;
|
|
|
|
|
|
- case 10: // D10 - XYZ calibration = OK
|
|
|
+ case 10: //! D10 - XYZ calibration = OK
|
|
|
dcode_10(); break;
|
|
|
|
|
|
|
|
|
#ifdef TMC2130
|
|
|
- case 2130: // D9125 - TMC2130
|
|
|
+ case 2130: //! D2130 - TMC2130
|
|
|
dcode_2130(); break;
|
|
|
#endif //TMC2130
|
|
|
|
|
|
#ifdef FILAMENT_SENSOR
|
|
|
- case 9125: // D9125 - FILAMENT_SENSOR
|
|
|
+ case 9125: //! D9125 - FILAMENT_SENSOR
|
|
|
dcode_9125(); break;
|
|
|
#endif //FILAMENT_SENSOR
|
|
|
|
|
@@ -7843,7 +7848,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_
|
|
|
int XY_AXIS_FEEDRATE = homing_feedrate[X_AXIS] / 20;
|
|
|
int Z_LIFT_FEEDRATE = homing_feedrate[Z_AXIS] / 40;
|
|
|
|
|
|
- setup_for_endstop_move(false);
|
|
|
+ int l_feedmultiply = setup_for_endstop_move(false);
|
|
|
|
|
|
SERIAL_PROTOCOLPGM("Num X,Y: ");
|
|
|
SERIAL_PROTOCOL(x_points_num);
|
|
@@ -7972,7 +7977,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_
|
|
|
|
|
|
}
|
|
|
card.closefile();
|
|
|
-
|
|
|
+ clean_up_after_endstop_move(l_feedmultiply);
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -8106,18 +8111,7 @@ void long_pause() //long pause print
|
|
|
{
|
|
|
st_synchronize();
|
|
|
|
|
|
- //save currently set parameters to global variables
|
|
|
- saved_feedmultiply = feedmultiply;
|
|
|
- HotendTempBckp = degTargetHotend(active_extruder);
|
|
|
- fanSpeedBckp = fanSpeed;
|
|
|
start_pause_print = millis();
|
|
|
-
|
|
|
-
|
|
|
- //save position
|
|
|
- pause_lastpos[X_AXIS] = current_position[X_AXIS];
|
|
|
- pause_lastpos[Y_AXIS] = current_position[Y_AXIS];
|
|
|
- pause_lastpos[Z_AXIS] = current_position[Z_AXIS];
|
|
|
- pause_lastpos[E_AXIS] = current_position[E_AXIS];
|
|
|
|
|
|
//retract
|
|
|
current_position[E_AXIS] -= default_retraction;
|
|
@@ -8128,9 +8122,6 @@ void long_pause() //long pause print
|
|
|
if (current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
|
|
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 15, active_extruder);
|
|
|
|
|
|
- //set nozzle target temperature to 0
|
|
|
- setAllTargetHotends(0);
|
|
|
-
|
|
|
//Move XY to side
|
|
|
current_position[X_AXIS] = X_PAUSE_POS;
|
|
|
current_position[Y_AXIS] = Y_PAUSE_POS;
|
|
@@ -8593,9 +8584,14 @@ void restore_print_from_eeprom() {
|
|
|
#endif //UVLO_SUPPORT
|
|
|
|
|
|
|
|
|
-////////////////////////////////////////////////////////////////////////////////
|
|
|
-// save/restore printing
|
|
|
-
|
|
|
+//! @brief Immediately stop print moves
|
|
|
+//!
|
|
|
+//! Immediately stop print moves, save current extruder temperature and position to RAM.
|
|
|
+//! If printing from sd card, position in file is saved.
|
|
|
+//! If printing from USB, line number is saved.
|
|
|
+//!
|
|
|
+//! @param z_move
|
|
|
+//! @param e_move
|
|
|
void stop_and_save_print_to_ram(float z_move, float e_move)
|
|
|
{
|
|
|
if (saved_printing) return;
|
|
@@ -8731,9 +8727,11 @@ void stop_and_save_print_to_ram(float z_move, float e_move)
|
|
|
planner_abort_hard(); //abort printing
|
|
|
memcpy(saved_pos, current_position, sizeof(saved_pos));
|
|
|
saved_active_extruder = active_extruder; //save active_extruder
|
|
|
+ saved_extruder_temperature = degTargetHotend(active_extruder);
|
|
|
|
|
|
saved_extruder_under_pressure = extruder_under_pressure; //extruder under pressure flag - currently unused
|
|
|
saved_extruder_relative_mode = axis_relative_modes[E_AXIS];
|
|
|
+ saved_fanSpeed = fanSpeed;
|
|
|
cmdqueue_reset(); //empty cmdqueue
|
|
|
card.sdprinting = false;
|
|
|
// card.closefile();
|
|
@@ -8778,14 +8776,27 @@ void stop_and_save_print_to_ram(float z_move, float e_move)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//! @brief Restore print from ram
|
|
|
+//!
|
|
|
+//! Restore print saved by stop_and_save_print_to_ram(). Is blocking,
|
|
|
+//! waits for extruder temperature restore, then restores position and continues
|
|
|
+//! print moves.
|
|
|
+//! Internaly lcd_update() is called by wait_for_heater().
|
|
|
+//!
|
|
|
+//! @param e_move
|
|
|
void restore_print_from_ram_and_continue(float e_move)
|
|
|
{
|
|
|
if (!saved_printing) return;
|
|
|
// for (int axis = X_AXIS; axis <= E_AXIS; axis++)
|
|
|
// current_position[axis] = st_get_position_mm(axis);
|
|
|
active_extruder = saved_active_extruder; //restore active_extruder
|
|
|
+ setTargetHotendSafe(saved_extruder_temperature,saved_active_extruder);
|
|
|
+ heating_status = 1;
|
|
|
+ wait_for_heater(millis(),saved_active_extruder);
|
|
|
+ heating_status = 2;
|
|
|
feedrate = saved_feedrate2; //restore feedrate
|
|
|
axis_relative_modes[E_AXIS] = saved_extruder_relative_mode;
|
|
|
+ fanSpeed = saved_fanSpeed;
|
|
|
float e = saved_pos[E_AXIS] - e_move;
|
|
|
plan_set_e_position(e);
|
|
|
//first move print head in XY to the saved position:
|
|
@@ -8881,7 +8892,6 @@ static void print_time_remaining_init()
|
|
|
print_percent_done_silent = PRINT_PERCENT_DONE_INIT;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
void M600_check_state()
|
|
|
{
|
|
|
//Wait for user to check the state
|
|
@@ -8915,8 +8925,13 @@ void M600_check_state()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void M600_wait_for_user() {
|
|
|
- //Beep, manage nozzle heater and wait for user to start unload filament
|
|
|
+//! @brief Wait for user action
|
|
|
+//!
|
|
|
+//! Beep, manage nozzle heater and wait for user to start unload filament
|
|
|
+//! If times out, active extruder temperature is set to 0.
|
|
|
+//!
|
|
|
+//! @param HotendTempBckp Temperature to be restored for active extruder, after user resolves MMU problem.
|
|
|
+void M600_wait_for_user(float HotendTempBckp) {
|
|
|
|
|
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
|
|
|
@@ -8956,9 +8971,7 @@ void M600_wait_for_user() {
|
|
|
if (millis() > waiting_start_time + (unsigned long)M600_TIMEOUT * 1000) {
|
|
|
lcd_display_message_fullscreen_P(_i("Press knob to preheat nozzle and continue."));////MSG_PRESS_TO_PREHEAT c=20 r=4
|
|
|
wait_for_user_state = 1;
|
|
|
- setTargetHotend(0, 0);
|
|
|
- setTargetHotend(0, 1);
|
|
|
- setTargetHotend(0, 2);
|
|
|
+ setAllTargetHotends(0);
|
|
|
st_synchronize();
|
|
|
disable_e0();
|
|
|
disable_e1();
|