From ca234a11edae5ad134eea5c93237bcf7aa79ced2 Mon Sep 17 00:00:00 2001
From: 3d-gussner <3d.gussner@gmail.com>
Date: Tue, 5 Nov 2019 12:40:51 +0100
Subject: [PATCH] M-Commands to M240
---
Firmware/Marlin_main.cpp | 201 +++++++++++++++++++++++++++++----------
1 file changed, 152 insertions(+), 49 deletions(-)
diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp
index 11e734c2..870d724a 100755
--- a/Firmware/Marlin_main.cpp
+++ b/Firmware/Marlin_main.cpp
@@ -5598,7 +5598,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
/*!
- ### M44 - Reset the bed skew and offset calibration (Prusa specific) M44: Reset the bed skew and offset calibration
+ ### M44 - Reset the bed skew and offset calibrationM44: Reset the bed skew and offset calibration
*/ --------------------------------------------------------------------
case 44: // M44: Prusa3D: Reset the bed skew and offset calibration.
@@ -5615,7 +5615,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
break;
/*!
- ### M45 - Bed skew and offset with manual Z up (Prusa specific) M45: Bed skew and offset with manual Z up
+ ### M45 - Bed skew and offset with manual Z upM45: Bed skew and offset with manual Z up
G80 [ V ]
- `V` - Verbosity level 1, 10 and 20 (low, mid, high). Only when SUPPORT_VERBOSITY is defined.
@@ -6559,7 +6559,7 @@ Sigma_Exit:
break;*/
/*!
- ### M120 - Enable endstops M120: Enable endstop detection
*/ ----------------------------------------
case 120:
enable_endstops(false) ;
@@ -6704,8 +6704,9 @@ Sigma_Exit:
}
break;
- //! ### M201 - Set Print Max Acceleration G32: Undock Z Probe sled
- // -------------------------------------------
+ /*!
+ ### M201 - Set Print Max Acceleration M201: Set max printing acceleration
+ */ -------------------------------------------
case 201:
for (int8_t i = 0; i < NUM_AXIS; i++)
{
@@ -6739,8 +6740,9 @@ Sigma_Exit:
break;
#endif
- //! ### M203 - Set Max Feedrate G32: Undock Z Probe sled
- // ---------------------------------------
+ /*!
+ ### M203 - Set Max Feedrate M203: Set maximum feedrate
+ */ ---------------------------------------
case 203: // M203 max feedrate mm/sec
for (int8_t i = 0; i < NUM_AXIS; i++)
{
@@ -6765,15 +6767,22 @@ Sigma_Exit:
}
break;
- //! ### M204 - Acceleration settings G32: Undock Z Probe sled
- // ------------------------------------------
- //! 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 - Acceleration settings M204: Set default acceleration
+ */ ------------------------------------------
+ /*! Supporting old format:
+
+ M204 [ S | T ]
+ - `S` - normal moves
+ - `T` - filmanent only moves
+
+ and new format:
+
+ M204 [ P | R | T ]
+ - `P` - printing moves
+ - `R` - filmanent only moves
+ - `T` - travel moves (as of now T is ignored)
+ */
case 204:
{
if(code_seen('S')) {
@@ -6799,16 +6808,20 @@ Sigma_Exit:
}
break;
- //! ### M205 - Set advanced settings G32: Undock Z Probe sled
- // ---------------------------------------------
- //! Set some advanced settings related to movement.
- //!
- //! M205 [S] [T] [B] [X] [Y] [Z] [E]
- /**
+ /*!
+ ### M205 - Set advanced settings M205: Advanced settings
+ */ ---------------------------------------------
+ /*! Set some advanced settings related to movement.
+
+ M205 [ S | T | B | X | Y | Z | E ]
+
- `S` - Minimum feedrate for print moves (unit/s)
- `T` - Minimum feedrate for travel moves (units/s)
- `B` - Minimum segment time (us)
- - `X` - Maximum X jerk (units/s), similarly for other axes
+ - `X` - Maximum X jerk (units/s)
+ - `Y` - Maximum Y jerk (units/s)
+ - `Z` - Maximum Z jerk (units/s)
+ - `E` - Maximum E jerk (units/s)
*/
case 205:
{
@@ -6824,8 +6837,15 @@ Sigma_Exit:
}
break;
- //! ### M206 - Set additional homing offsets G32: Undock Z Probe sled
- // ----------------------------------------------
+ /*!
+ ### M206 - Set additional homing offsets M206: Offset axes
+
+ M206 [ X | Y | Z]
+
+ - `X` - X axis offset
+ - `Y` - Y axis offset
+ - `Z` - Z axis offset
+ */ ----------------------------------------------
case 206:
for(int8_t i=0; i < 3; i++)
{
@@ -6834,8 +6854,15 @@ Sigma_Exit:
break;
#ifdef FWRETRACT
- //! ### M207 - Set firmware retraction G32: Undock Z Probe sled
- // --------------------------------------------------
+ /*!
+ ### M207 - Set firmware retraction M207: Set retract length
+
+ M207 [ S | F | Z]
+
+ - `S` - positive length to retract, in mm
+ - `F` - retraction feedrate, in mm/min
+ - `Z` - additional zlift/hop
+ */ --------------------------------------------------
case 207: //M207 - set retract length S[positive mm] F[feedrate mm/min] Z[additional zlift/hop]
{
if(code_seen('S'))
@@ -6852,8 +6879,14 @@ Sigma_Exit:
}
}break;
- //! ### M208 - Set retract recover length G32: Undock Z Probe sled
- // --------------------------------------------
+ /*!
+ ### M208 - Set retract recover length M208: Set unretract length
+
+ M208 [ S | F ]
+
+ - `S` - positive length surplus to the M207 Snnn, in mm
+ - `F` - feedrate, in mm/sec
+ */ --------------------------------------------
case 208: // M208 - set retract recover length S[positive mm surplus to the M207 S*] F[feedrate mm/min]
{
if(code_seen('S'))
@@ -6866,8 +6899,15 @@ Sigma_Exit:
}
}break;
- //! ### M209 - Enable/disable automatict retract G32: Undock Z Probe sled
- // ---------------------------------------------
+ /*!
+ ### M209 - Enable/disable automatict retract M209: Enable automatic retract
+
+ M209 [ S ]
+
+ - `S` - 1=true or 0=false
+
+ This boolean value S 1=true or 0=false enables automatic retract detect if the slicer did not support G10/G11: every normal extrude-only move will be classified as retract depending on the direction.
+ */ ---------------------------------------------
case 209: // M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction.
{
if(code_seen('S'))
@@ -6909,8 +6949,10 @@ Sigma_Exit:
#endif // FWRETRACT
#if EXTRUDERS > 1
- // ### M218 - Set hotend offset
- // ----------------------------------------
+ /*!
+ ### M218 - Set hotend offset M218: Set Hotend Offset
+ In Prusa Firmware this G-code is only active if `EXTRUDERS` is higher then 1 in the source code. On Original i3 Prusa MK2/s MK2.5/s MK3/s it is not active.
+ */ ----------------------------------------
case 218: // M218 - set hotend offset (in mm), T X Y
{
uint8_t extruder;
@@ -6938,8 +6980,16 @@ Sigma_Exit:
}break;
#endif
- //! ### M220 Set feedrate percentage G32: Undock Z Probe sled
- // -----------------------------------------------
+ /*!
+ ### M220 Set feedrate percentage M220: Set speed factor override percentage
+
+ M220 [ B | S | R ]
+
+ - `B` - Backup current speed factor
+ - `S` - Speed factor override percentage (0..100 or higher)
+ - `R` - Restore previous speed factor
+
+ */ -----------------------------------------------
case 220: // M220 S- set speed factor override percentage
{
if (code_seen('B')) //backup current speed factor
@@ -6956,8 +7006,15 @@ Sigma_Exit:
}
break;
- //! ### M221 - Set extrude factor override percentage G32: Undock Z Probe sled
- // ----------------------------------------------------
+ /*!
+ ### M221 - Set extrude factor override percentage M221: Set extrude factor override percentage
+
+ M221 [ S | T ]
+
+ - `S` - Extrude factor override percentage (0..100 or higher), default 100%
+ - `T` - Extruder drive number (Prusa Firmware only), default 0 if not set.
+
+ */ ----------------------------------------------------
case 221: // M221 S- set extrude factor override percentage
{
if(code_seen('S'))
@@ -6980,8 +7037,16 @@ Sigma_Exit:
}
break;
- //! ### M226 - Wait for Pin state G32: Undock Z Probe sled
- // ------------------------------------------
+ /*!
+ ### M226 - Wait for Pin state M226: Wait for pin state
+
+ M226 [ P | S ]
+
+ - `P` - pin number
+ - `S` - pin state
+
+ Wait until the specified pin reaches the state required
+ */ ------------------------------------------
case 226: // M226 P S- Wait until the specified pin reaches the state required
{
if(code_seen('P')){
@@ -7036,8 +7101,10 @@ Sigma_Exit:
#if NUM_SERVOS > 0
- //! ### M280 - Set/Get servo position G32: Undock Z Probe sled
- // --------------------------------------------
+ /*!
+ ### M280 - Set/Get servo position M280: Set servo position
+ In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.
+ */ --------------------------------------------
case 280: // M280 - set servo position absolute. P: servo index, S: angle or microseconds
{
int servo_index = -1;
@@ -7077,8 +7144,16 @@ Sigma_Exit:
#if (LARGE_FLASH == true && ( BEEPER > 0 || defined(ULTRALCD) || defined(LCD_USE_I2C_BUZZER)))
- //! ### M300 - Play tone G32: Undock Z Probe sled
- // -----------------------
+ /*!
+ ### M300 - Play tone M300: Play beep sound
+
+ M300 [ S | P ]
+
+ - `S` - frequency in Hz
+ - `P` - duration in milliseconds
+
+ In Prusa Firmware the defaults are `100Hz` and `1000ms`, so that `M300` without parameters will beep for a second.
+ */ -----------------------
case 300: // M300
{
int beepS = code_seen('S') ? code_value() : 110;
@@ -7099,8 +7174,20 @@ Sigma_Exit:
#ifdef PIDTEMP
- //! ### M301 - Set hotend PID G32: Undock Z Probe sled
- // ---------------------------------------
+ /*!
+ ### M301 - Set hotend PID M301: Set PID parameters
+
+ M301 [ P | I | D | C ]
+
+ - `P` - proportional (Kp)
+ - `I` - integral (Ki)
+ - `D` - derivative (Kd)
+ - `C` - heating power=Kc*(e_speed0)
+
+ Sets Proportional (P), Integral (I) and Derivative (D) values for hot end.
+
+ See also PID Tuning.
+ */ ---------------------------------------
case 301:
{
if(code_seen('P')) cs.Kp = code_value();
@@ -7130,8 +7217,19 @@ Sigma_Exit:
#endif //PIDTEMP
#ifdef PIDTEMPBED
- //! ### M304 - Set bed PID G32: Undock Z Probe sled
- // --------------------------------------
+ /*!
+ ### M304 - Set bed PID M304: Set PID parameters - Bed
+
+ M304 [ P | I | D ]
+
+ - `P` - proportional (Kp)
+ - `I` - integral (Ki)
+ - `D` - derivative (Kd)
+
+ Sets Proportional (P), Integral (I) and Derivative (D) values for bed.
+
+ See also PID Tuning.
+ */ --------------------------------------
case 304:
{
if(code_seen('P')) cs.bedKp = code_value();
@@ -7151,8 +7249,13 @@ Sigma_Exit:
break;
#endif //PIDTEMP
- //! ### M240 - Trigger camera G32: Undock Z Probe sled
- // --------------------------------------------
+ /*!
+ ### M240 - Trigger camera M240: Trigger camera
+
+ In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.
+
+ You need to define `CHDK` and assign a `PHOTOGRAPH_PIN` to bea ble to use it.
+ */ --------------------------------------------
case 240: // M240 Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/
{
#ifdef CHDK