My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

gcode.h 42KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /**
  24. * -----------------
  25. * G-Codes in Marlin
  26. * -----------------
  27. *
  28. * Helpful G-code references:
  29. * - https://marlinfw.org/meta/gcode
  30. * - https://reprap.org/wiki/G-code
  31. * - https://linuxcnc.org/docs/html/gcode.html
  32. *
  33. * Help to document Marlin's G-codes online:
  34. * - https://github.com/MarlinFirmware/MarlinDocumentation
  35. *
  36. * -----------------
  37. *
  38. * "G" Codes
  39. *
  40. * G0 -> G1
  41. * G1 - Coordinated Movement X Y Z E
  42. * G2 - CW ARC
  43. * G3 - CCW ARC
  44. * G4 - Dwell S<seconds> or P<milliseconds>
  45. * G5 - Cubic B-spline with XYZE destination and IJPQ offsets
  46. * G10 - Retract filament according to settings of M207 (Requires FWRETRACT)
  47. * G11 - Retract recover filament according to settings of M208 (Requires FWRETRACT)
  48. * G12 - Clean tool (Requires NOZZLE_CLEAN_FEATURE)
  49. * G17 - Select Plane XY (Requires CNC_WORKSPACE_PLANES)
  50. * G18 - Select Plane ZX (Requires CNC_WORKSPACE_PLANES)
  51. * G19 - Select Plane YZ (Requires CNC_WORKSPACE_PLANES)
  52. * G20 - Set input units to inches (Requires INCH_MODE_SUPPORT)
  53. * G21 - Set input units to millimeters (Requires INCH_MODE_SUPPORT)
  54. * G26 - Mesh Validation Pattern (Requires G26_MESH_VALIDATION)
  55. * G27 - Park Nozzle (Requires NOZZLE_PARK_FEATURE)
  56. * G28 - Home one or more axes
  57. * G29 - Start or continue the bed leveling probe procedure (Requires bed leveling)
  58. * G30 - Single Z probe, probes bed at X Y location (defaults to current XY location)
  59. * G31 - Dock sled (Z_PROBE_SLED only)
  60. * G32 - Undock sled (Z_PROBE_SLED only)
  61. * G33 - Delta Auto-Calibration (Requires DELTA_AUTO_CALIBRATION)
  62. * G34 - Z Stepper automatic alignment using probe: I<iterations> T<accuracy> A<amplification> (Requires Z_STEPPER_AUTO_ALIGN)
  63. * G35 - Read bed corners to help adjust bed screws: T<screw_thread> (Requires ASSISTED_TRAMMING)
  64. * G38 - Probe in any direction using the Z_MIN_PROBE (Requires G38_PROBE_TARGET)
  65. * G42 - Coordinated move to a mesh point (Requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BLINEAR, or AUTO_BED_LEVELING_UBL)
  66. * G60 - Save current position. (Requires SAVED_POSITIONS)
  67. * G61 - Apply/restore saved coordinates. (Requires SAVED_POSITIONS)
  68. * G76 - Calibrate first layer temperature offsets. (Requires PTC_PROBE and PTC_BED)
  69. * G80 - Cancel current motion mode (Requires GCODE_MOTION_MODES)
  70. * G90 - Use Absolute Coordinates
  71. * G91 - Use Relative Coordinates
  72. * G92 - Set current position to coordinates given
  73. *
  74. * "M" Codes
  75. *
  76. * M0 - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
  77. * M1 -> M0
  78. * M3 - Turn ON Laser | Spindle (clockwise), set Power | Speed. (Requires SPINDLE_FEATURE or LASER_FEATURE)
  79. * M4 - Turn ON Laser | Spindle (counter-clockwise), set Power | Speed. (Requires SPINDLE_FEATURE or LASER_FEATURE)
  80. * M5 - Turn OFF Laser | Spindle. (Requires SPINDLE_FEATURE or LASER_FEATURE)
  81. * M7 - Turn mist coolant ON. (Requires COOLANT_CONTROL)
  82. * M8 - Turn flood coolant ON. (Requires COOLANT_CONTROL)
  83. * M9 - Turn coolant OFF. (Requires COOLANT_CONTROL)
  84. * M10 - Turn Vacuum or Blower motor ON (Requires AIR_EVACUATION)
  85. * M11 - Turn Vacuum or Blower motor OFF (Requires AIR_EVACUATION)
  86. * M12 - Set up closed loop control system. (Requires EXTERNAL_CLOSED_LOOP_CONTROLLER)
  87. * M16 - Expected printer check. (Requires EXPECTED_PRINTER_CHECK)
  88. * M17 - Enable/Power all stepper motors
  89. * M18 - Disable all stepper motors; same as M84
  90. *
  91. *** Print from Media (SDSUPPORT) ***
  92. * M20 - List SD card. (Requires SDSUPPORT)
  93. * M21 - Init SD card. (Requires SDSUPPORT) With MULTI_VOLUME select a drive with `M21 Pn` / 'M21 S' / 'M21 U'.
  94. * M22 - Release SD card. (Requires SDSUPPORT)
  95. * M23 - Select SD file: "M23 /path/file.gco". (Requires SDSUPPORT)
  96. * M24 - Start/resume SD print. (Requires SDSUPPORT)
  97. * M25 - Pause SD print. (Requires SDSUPPORT)
  98. * M26 - Set SD position in bytes: "M26 S12345". (Requires SDSUPPORT)
  99. * M27 - Report SD print status. (Requires SDSUPPORT)
  100. * OR, with 'S<seconds>' set the SD status auto-report interval. (Requires AUTO_REPORT_SD_STATUS)
  101. * OR, with 'C' get the current filename.
  102. * M28 - Start SD write: "M28 /path/file.gco". (Requires SDSUPPORT)
  103. * M29 - Stop SD write. (Requires SDSUPPORT)
  104. * M30 - Delete file from SD: "M30 /path/file.gco" (Requires SDSUPPORT)
  105. * M31 - Report time since last M109 or SD card start to serial.
  106. * M32 - Select file and start SD print: "M32 [S<bytepos>] !/path/file.gco#". (Requires SDSUPPORT)
  107. * Use P to run other files as sub-programs: "M32 P !filename#"
  108. * The '#' is necessary when calling from within sd files, as it stops buffer prereading
  109. * M33 - Get the longname version of a path. (Requires LONG_FILENAME_HOST_SUPPORT)
  110. * M34 - Set SD Card sorting options. (Requires SDCARD_SORT_ALPHA)
  111. *
  112. * M42 - Change pin status via G-code: M42 P<pin> S<value>. LED pin assumed if P is omitted. (Requires DIRECT_PIN_CONTROL)
  113. * M43 - Display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins (Requires PINS_DEBUGGING)
  114. * M48 - Measure Z Probe repeatability: M48 P<points> X<pos> Y<pos> V<level> E<engage> L<legs> S<chizoid>. (Requires Z_MIN_PROBE_REPEATABILITY_TEST)
  115. *
  116. * M73 - Set the progress percentage. (Requires SET_PROGRESS_MANUALLY)
  117. * M75 - Start the print job timer.
  118. * M76 - Pause the print job timer.
  119. * M77 - Stop the print job timer.
  120. * M78 - Show statistical information about the print jobs. (Requires PRINTCOUNTER)
  121. *
  122. * M80 - Turn on Power Supply. (Requires PSU_CONTROL)
  123. * M81 - Turn off Power Supply. (Requires PSU_CONTROL)
  124. *
  125. * M82 - Set E codes absolute (default).
  126. * M83 - Set E codes relative while in Absolute (G90) mode.
  127. * M84 - Disable steppers until next move, or use S<seconds> to specify an idle
  128. * duration after which steppers should turn off. S0 disables the timeout.
  129. * M85 - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
  130. * M92 - Set planner.settings.axis_steps_per_mm for one or more axes.
  131. *
  132. * M100 - Watch Free Memory (for debugging) (Requires M100_FREE_MEMORY_WATCHER)
  133. *
  134. * M102 - Configure Bed Distance Sensor. (Requires BD_SENSOR)
  135. *
  136. * M104 - Set extruder target temp.
  137. * M105 - Report current temperatures.
  138. * M106 - Set print fan speed.
  139. * M107 - Print fan off.
  140. * M108 - Break out of heating loops (M109, M190, M303). With no controller, breaks out of M0/M1. (Requires EMERGENCY_PARSER)
  141. * M109 - S<temp> Wait for extruder current temp to reach target temp. ** Wait only when heating! **
  142. * R<temp> Wait for extruder current temp to reach target temp. ** Wait for heating or cooling. **
  143. * If AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F
  144. *
  145. * M110 - Set the current line number. (Used by host printing)
  146. * M111 - Set debug flags: "M111 S<flagbits>". See flag bits defined in enum.h.
  147. * M112 - Full Shutdown.
  148. *
  149. * M113 - Get or set the timeout interval for Host Keepalive "busy" messages. (Requires HOST_KEEPALIVE_FEATURE)
  150. * M114 - Report current position.
  151. * M115 - Report capabilities. (Extended capabilities requires EXTENDED_CAPABILITIES_REPORT)
  152. * M117 - Display a message on the controller screen. (Requires an LCD)
  153. * M118 - Display a message in the host console.
  154. *
  155. * M119 - Report endstops status.
  156. * M120 - Enable endstops detection.
  157. * M121 - Disable endstops detection.
  158. *
  159. * M122 - Debug stepper (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660)
  160. * M123 - Report fan tachometers. (Requires En_FAN_TACHO_PIN) Optionally set auto-report interval. (Requires AUTO_REPORT_FANS)
  161. * M125 - Save current position and move to filament change position. (Requires PARK_HEAD_ON_PAUSE)
  162. *
  163. * M126 - Solenoid Air Valve Open. (Requires BARICUDA)
  164. * M127 - Solenoid Air Valve Closed. (Requires BARICUDA)
  165. * M128 - EtoP Open. (Requires BARICUDA)
  166. * M129 - EtoP Closed. (Requires BARICUDA)
  167. *
  168. * M140 - Set bed target temp. S<temp>
  169. * M141 - Set heated chamber target temp. S<temp> (Requires a chamber heater)
  170. * M143 - Set cooler target temp. S<temp> (Requires a laser cooling device)
  171. * M145 - Set heatup values for materials on the LCD. H<hotend> B<bed> F<fan speed> for S<material> (0=PLA, 1=ABS)
  172. * M149 - Set temperature units. (Requires TEMPERATURE_UNITS_SUPPORT)
  173. * M150 - Set Status LED Color as R<red> U<green> B<blue> W<white> P<bright>. Values 0-255. (Requires BLINKM, RGB_LED, RGBW_LED, NEOPIXEL_LED, PCA9533, or PCA9632).
  174. * M154 - Auto-report position with interval of S<seconds>. (Requires AUTO_REPORT_POSITION)
  175. * M155 - Auto-report temperatures with interval of S<seconds>. (Requires AUTO_REPORT_TEMPERATURES)
  176. * M163 - Set a single proportion for a mixing extruder. (Requires MIXING_EXTRUDER)
  177. * M164 - Commit the mix and save to a virtual tool (current, or as specified by 'S'). (Requires MIXING_EXTRUDER)
  178. * M165 - Set the mix for the mixing extruder (and current virtual tool) with parameters ABCDHI. (Requires MIXING_EXTRUDER and DIRECT_MIXING_IN_G1)
  179. * M166 - Set the Gradient Mix for the mixing extruder. (Requires GRADIENT_MIX)
  180. * M190 - Set bed target temperature and wait. R<temp> Set target temperature and wait. S<temp> Set, but only wait when heating. (Requires TEMP_SENSOR_BED)
  181. * M192 - Wait for probe to reach target temperature. (Requires TEMP_SENSOR_PROBE)
  182. * M193 - R<temp> Wait for cooler to reach target temp. ** Wait for cooling. **
  183. * M200 - Set filament diameter, D<diameter>, setting E axis units to cubic. (Use S0 to revert to linear units.)
  184. * M201 - Set max acceleration in units/s^2 for print moves: "M201 X<accel> Y<accel> Z<accel> E<accel>"
  185. * M202 - Set max acceleration in units/s^2 for travel moves: "M202 X<accel> Y<accel> Z<accel> E<accel>" ** UNUSED IN MARLIN! **
  186. * M203 - Set maximum feedrate: "M203 X<fr> Y<fr> Z<fr> E<fr>" in units/sec.
  187. * M204 - Set default acceleration in units/sec^2: P<printing> R<extruder_only> T<travel>
  188. * M205 - Set advanced settings. Current units apply:
  189. S<print> T<travel> minimum speeds
  190. B<minimum segment time>
  191. X<max X jerk>, Y<max Y jerk>, Z<max Z jerk>, E<max E jerk>
  192. * M206 - Set additional homing offset. (Disabled by NO_WORKSPACE_OFFSETS or DELTA)
  193. * M207 - Set Retract Length: S<length>, Feedrate: F<units/min>, and Z lift: Z<distance>. (Requires FWRETRACT)
  194. * M208 - Set Recover (unretract) Additional (!) Length: S<length> and Feedrate: F<units/min>. (Requires FWRETRACT)
  195. * M209 - Turn Automatic Retract Detection on/off: S<0|1> (For slicers that don't support G10/11). (Requires FWRETRACT_AUTORETRACT)
  196. Every normal extrude-only move will be classified as retract depending on the direction.
  197. * M211 - Enable, Disable, and/or Report software endstops: S<0|1> (Requires MIN_SOFTWARE_ENDSTOPS or MAX_SOFTWARE_ENDSTOPS)
  198. * M217 - Set filament swap parameters: "M217 S<length> P<feedrate> R<feedrate>". (Requires SINGLENOZZLE)
  199. * M218 - Set/get a tool offset: "M218 T<index> X<offset> Y<offset>". (Requires 2 or more extruders)
  200. * M220 - Set Feedrate Percentage: "M220 S<percent>" (i.e., "FR" on the LCD)
  201. * Use "M220 B" to back up the Feedrate Percentage and "M220 R" to restore it. (Requires an MMU_MODEL version 2 or 2S)
  202. * M221 - Set Flow Percentage: "M221 S<percent>" (Requires an extruder)
  203. * M226 - Wait until a pin is in a given state: "M226 P<pin> S<state>" (Requires DIRECT_PIN_CONTROL)
  204. * M240 - Trigger a camera to take a photograph. (Requires PHOTO_GCODE)
  205. * M250 - Set LCD contrast: "M250 C<contrast>" (0-63). (Requires LCD support)
  206. * M255 - Set LCD sleep time: "M255 S<minutes>" (0-99). (Requires an LCD with brightness or sleep/wake)
  207. * M256 - Set LCD brightness: "M256 B<brightness>" (0-255). (Requires an LCD with brightness control)
  208. * M260 - i2c Send Data (Requires EXPERIMENTAL_I2CBUS)
  209. * M261 - i2c Request Data (Requires EXPERIMENTAL_I2CBUS)
  210. * M280 - Set servo position absolute: "M280 P<index> S<angle|µs>". (Requires servos)
  211. * M281 - Set servo min|max position: "M281 P<index> L<min> U<max>". (Requires EDITABLE_SERVO_ANGLES)
  212. * M282 - Detach servo: "M282 P<index>". (Requires SERVO_DETACH_GCODE)
  213. * M290 - Babystepping (Requires BABYSTEPPING)
  214. * M300 - Play beep sound S<frequency Hz> P<duration ms>
  215. * M301 - Set PID parameters P I and D. (Requires PIDTEMP)
  216. * M302 - Allow cold extrudes, or set the minimum extrude S<temperature>. (Requires PREVENT_COLD_EXTRUSION)
  217. * M303 - PID relay autotune S<temperature> sets the target temperature. Default 150C. (Requires PIDTEMP)
  218. * M304 - Set bed PID parameters P I and D. (Requires PIDTEMPBED)
  219. * M305 - Set user thermistor parameters R T and P. (Requires TEMP_SENSOR_x 1000)
  220. * M306 - MPC autotune. (Requires MPCTEMP)
  221. * M309 - Set chamber PID parameters P I and D. (Requires PIDTEMPCHAMBER)
  222. * M350 - Set microstepping mode. (Requires digital microstepping pins.)
  223. * M351 - Toggle MS1 MS2 pins directly. (Requires digital microstepping pins.)
  224. * M355 - Set Case Light on/off and set brightness. (Requires CASE_LIGHT_PIN)
  225. * M380 - Activate solenoid on active tool (Requires EXT_SOLENOID) or the tool specified by 'S' (Requires MANUAL_SOLENOID_CONTROL).
  226. * M381 - Disable solenoids on all tools (Requires EXT_SOLENOID) or the tool specified by 'S' (Requires MANUAL_SOLENOID_CONTROL).
  227. * M400 - Finish all moves.
  228. * M401 - Deploy and activate Z probe. (Requires a probe)
  229. * M402 - Deactivate and stow Z probe. (Requires a probe)
  230. * M403 - Set filament type for PRUSA MMU2
  231. * M404 - Display or set the Nominal Filament Width: "W<diameter>". (Requires FILAMENT_WIDTH_SENSOR)
  232. * M405 - Enable Filament Sensor flow control. "M405 D<delay_cm>". (Requires FILAMENT_WIDTH_SENSOR)
  233. * M406 - Disable Filament Sensor flow control. (Requires FILAMENT_WIDTH_SENSOR)
  234. * M407 - Display measured filament diameter in millimeters. (Requires FILAMENT_WIDTH_SENSOR)
  235. * M410 - Quickstop. Abort all planned moves.
  236. * M412 - Enable / Disable Filament Runout Detection. (Requires FILAMENT_RUNOUT_SENSOR)
  237. * M413 - Enable / Disable Power-Loss Recovery. (Requires POWER_LOSS_RECOVERY)
  238. * M414 - Set language by index. (Requires LCD_LANGUAGE_2...)
  239. * M420 - Enable/Disable Leveling (with current values) S1=enable S0=disable (Requires MESH_BED_LEVELING or ABL)
  240. * M421 - Set a single Z coordinate in the Mesh Leveling grid. X<units> Y<units> Z<units> (Requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, or AUTO_BED_LEVELING_UBL)
  241. * M422 - Set Z Stepper automatic alignment position using probe. X<units> Y<units> A<axis> (Requires Z_STEPPER_AUTO_ALIGN)
  242. * M425 - Enable/Disable and tune backlash correction. (Requires BACKLASH_COMPENSATION and BACKLASH_GCODE)
  243. * M428 - Set the home_offset based on the current_position. Nearest edge applies. (Disabled by NO_WORKSPACE_OFFSETS or DELTA)
  244. * M430 - Read the system current, voltage, and power (Requires POWER_MONITOR_CURRENT, POWER_MONITOR_VOLTAGE, or POWER_MONITOR_FIXED_VOLTAGE)
  245. * M486 - Identify and cancel objects. (Requires CANCEL_OBJECTS)
  246. * M500 - Store parameters in EEPROM. (Requires EEPROM_SETTINGS)
  247. * M501 - Restore parameters from EEPROM. (Requires EEPROM_SETTINGS)
  248. * M502 - Revert to the default "factory settings". ** Does not write them to EEPROM! **
  249. * M503 - Print the current settings (in memory): "M503 S<verbose>". S0 specifies compact output.
  250. * M504 - Validate EEPROM contents. (Requires EEPROM_SETTINGS)
  251. * M510 - Lock Printer (Requires PASSWORD_FEATURE)
  252. * M511 - Unlock Printer (Requires PASSWORD_UNLOCK_GCODE)
  253. * M512 - Set/Change/Remove Password (Requires PASSWORD_CHANGE_GCODE)
  254. * M524 - Abort the current SD print job started with M24. (Requires SDSUPPORT)
  255. * M540 - Enable/disable SD card abort on endstop hit: "M540 S<state>". (Requires SD_ABORT_ON_ENDSTOP_HIT)
  256. * M552 - Get or set IP address. Enable/disable network interface. (Requires enabled Ethernet port)
  257. * M553 - Get or set IP netmask. (Requires enabled Ethernet port)
  258. * M554 - Get or set IP gateway. (Requires enabled Ethernet port)
  259. * M569 - Enable stealthChop on an axis. (Requires at least one _DRIVER_TYPE to be TMC2130/2160/2208/2209/5130/5160)
  260. * M575 - Change the serial baud rate. (Requires BAUD_RATE_GCODE)
  261. * M600 - Pause for filament change: "M600 X<pos> Y<pos> Z<raise> E<first_retract> L<later_retract>". (Requires ADVANCED_PAUSE_FEATURE)
  262. * M603 - Configure filament change: "M603 T<tool> U<unload_length> L<load_length>". (Requires ADVANCED_PAUSE_FEATURE)
  263. * M605 - Set Dual X-Carriage movement mode: "M605 S<mode> [X<x_offset>] [R<temp_offset>]". (Requires DUAL_X_CARRIAGE)
  264. * M665 - Set delta configurations: "M665 H<delta height> L<diagonal rod> R<delta radius> S<segments/s> B<calibration radius> X<Alpha angle trim> Y<Beta angle trim> Z<Gamma angle trim> (Requires DELTA)
  265. * Set SCARA configurations: "M665 S<segments-per-second> P<theta-psi-offset> T<theta-offset> Z<z-offset> (Requires MORGAN_SCARA or MP_SCARA)
  266. * Set Polargraph draw area and belt length: "M665 S<segments-per-second> L<draw-area-left> R<draw-area-right> T<draw-area-top> B<draw-area-bottom> H<max-belt-length>"
  267. * M666 - Set/get offsets for delta (Requires DELTA) or dual endstops. (Requires [XYZ]_DUAL_ENDSTOPS)
  268. * M672 - Set/Reset Duet Smart Effector's sensitivity. (Requires DUET_SMART_EFFECTOR and SMART_EFFECTOR_MOD_PIN)
  269. * M701 - Load filament (Requires FILAMENT_LOAD_UNLOAD_GCODES)
  270. * M702 - Unload filament (Requires FILAMENT_LOAD_UNLOAD_GCODES)
  271. * M808 - Set or Goto a Repeat Marker (Requires GCODE_REPEAT_MARKERS)
  272. * M810-M819 - Define/execute a G-code macro (Requires GCODE_MACROS)
  273. * M851 - Set Z probe's XYZ offsets in current units. (Negative values: X=left, Y=front, Z=below)
  274. * M852 - Set skew factors: "M852 [I<xy>] [J<xz>] [K<yz>]". (Requires SKEW_CORRECTION_GCODE, plus SKEW_CORRECTION_FOR_Z for IJ)
  275. *
  276. *** I2C_POSITION_ENCODERS ***
  277. * M860 - Report the position of position encoder modules.
  278. * M861 - Report the status of position encoder modules.
  279. * M862 - Perform an axis continuity test for position encoder modules.
  280. * M863 - Perform steps-per-mm calibration for position encoder modules.
  281. * M864 - Change position encoder module I2C address.
  282. * M865 - Check position encoder module firmware version.
  283. * M866 - Report or reset position encoder module error count.
  284. * M867 - Enable/disable or toggle error correction for position encoder modules.
  285. * M868 - Report or set position encoder module error correction threshold.
  286. * M869 - Report position encoder module error.
  287. *
  288. * M871 - Print/reset/clear first layer temperature offset values. (Requires PTC_PROBE, PTC_BED, or PTC_HOTEND)
  289. * M876 - Handle Prompt Response. (Requires HOST_PROMPT_SUPPORT and not EMERGENCY_PARSER)
  290. * M900 - Get or Set Linear Advance K-factor. (Requires LIN_ADVANCE)
  291. * M906 - Set or get motor current in milliamps using axis codes XYZE, etc. Report values if no axis codes given. (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660)
  292. * M907 - Set digital trimpot motor current using axis codes. (Requires a board with digital trimpots)
  293. * M908 - Control digital trimpot directly. (Requires HAS_MOTOR_CURRENT_DAC or DIGIPOTSS_PIN)
  294. * M909 - Print digipot/DAC current value. (Requires HAS_MOTOR_CURRENT_DAC)
  295. * M910 - Commit digipot/DAC value to external EEPROM via I2C. (Requires HAS_MOTOR_CURRENT_DAC)
  296. * M911 - Report stepper driver overtemperature pre-warn condition. (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660)
  297. * M912 - Clear stepper driver overtemperature pre-warn condition flag. (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660)
  298. * M913 - Set HYBRID_THRESHOLD speed. (Requires HYBRID_THRESHOLD)
  299. * M914 - Set StallGuard sensitivity. (Requires SENSORLESS_HOMING or SENSORLESS_PROBING)
  300. * M919 - Get or Set motor Chopper Times (time_off, hysteresis_end, hysteresis_start) using axis codes XYZE, etc. If no parameters are given, report. (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660)
  301. * M951 - Set Magnetic Parking Extruder parameters. (Requires MAGNETIC_PARKING_EXTRUDER)
  302. * M3426 - Read MCP3426 ADC over I2C. (Requires HAS_MCP3426_ADC)
  303. * M7219 - Control Max7219 Matrix LEDs. (Requires MAX7219_GCODE)
  304. *
  305. *** SCARA ***
  306. * M360 - SCARA calibration: Move to cal-position ThetaA (0 deg calibration)
  307. * M361 - SCARA calibration: Move to cal-position ThetaB (90 deg calibration - steps per degree)
  308. * M362 - SCARA calibration: Move to cal-position PsiA (0 deg calibration)
  309. * M363 - SCARA calibration: Move to cal-position PsiB (90 deg calibration - steps per degree)
  310. * M364 - SCARA calibration: Move to cal-position PSIC (90 deg to Theta calibration position)
  311. *
  312. *** Custom codes (can be changed to suit future G-code standards) ***
  313. * G425 - Calibrate using a conductive object. (Requires CALIBRATION_GCODE)
  314. * M928 - Start SD logging: "M928 filename.gco". Stop with M29. (Requires SDSUPPORT)
  315. * M993 - Backup SPI Flash to SD
  316. * M994 - Load a Backup from SD to SPI Flash
  317. * M995 - Touch screen calibration for TFT display
  318. * M997 - Perform in-application firmware update
  319. * M999 - Restart after being stopped by error
  320. *
  321. * D... - Custom Development G-code. Add hooks to 'gcode_D.cpp' for developers to test features. (Requires MARLIN_DEV_MODE)
  322. * D576 - Set buffer monitoring options. (Requires BUFFER_MONITORING)
  323. *
  324. *** "T" Codes ***
  325. *
  326. * T0-T3 - Select an extruder (tool) by index: "T<n> F<units/min>"
  327. */
  328. #include "../inc/MarlinConfig.h"
  329. #include "parser.h"
  330. #if ENABLED(I2C_POSITION_ENCODERS)
  331. #include "../feature/encoder_i2c.h"
  332. #endif
  333. #if IS_SCARA || defined(G0_FEEDRATE)
  334. #define HAS_FAST_MOVES 1
  335. #endif
  336. enum AxisRelative : uint8_t {
  337. LOGICAL_AXIS_LIST(REL_E, REL_X, REL_Y, REL_Z, REL_I, REL_J, REL_K, REL_U, REL_V, REL_W)
  338. #if HAS_EXTRUDERS
  339. , E_MODE_ABS, E_MODE_REL
  340. #endif
  341. };
  342. extern const char G28_STR[];
  343. class GcodeSuite {
  344. public:
  345. static axis_bits_t axis_relative;
  346. static bool axis_is_relative(const AxisEnum a) {
  347. #if HAS_EXTRUDERS
  348. if (a == E_AXIS) {
  349. if (TEST(axis_relative, E_MODE_REL)) return true;
  350. if (TEST(axis_relative, E_MODE_ABS)) return false;
  351. }
  352. #endif
  353. return TEST(axis_relative, a);
  354. }
  355. static void set_relative_mode(const bool rel) {
  356. axis_relative = rel ? (0 LOGICAL_AXIS_GANG(
  357. | _BV(REL_E),
  358. | _BV(REL_X), | _BV(REL_Y), | _BV(REL_Z),
  359. | _BV(REL_I), | _BV(REL_J), | _BV(REL_K),
  360. | _BV(REL_U), | _BV(REL_V), | _BV(REL_W)
  361. )) : 0;
  362. }
  363. #if HAS_EXTRUDERS
  364. static void set_e_relative() {
  365. CBI(axis_relative, E_MODE_ABS);
  366. SBI(axis_relative, E_MODE_REL);
  367. }
  368. static void set_e_absolute() {
  369. CBI(axis_relative, E_MODE_REL);
  370. SBI(axis_relative, E_MODE_ABS);
  371. }
  372. #endif
  373. #if ENABLED(CNC_WORKSPACE_PLANES)
  374. /**
  375. * Workspace planes only apply to G2/G3 moves
  376. * (and "canned cycles" - not a current feature)
  377. */
  378. enum WorkspacePlane : char { PLANE_XY, PLANE_ZX, PLANE_YZ };
  379. static WorkspacePlane workspace_plane;
  380. #endif
  381. #define MAX_COORDINATE_SYSTEMS 9
  382. #if ENABLED(CNC_COORDINATE_SYSTEMS)
  383. static int8_t active_coordinate_system;
  384. static xyz_pos_t coordinate_system[MAX_COORDINATE_SYSTEMS];
  385. static bool select_coordinate_system(const int8_t _new);
  386. #endif
  387. static millis_t previous_move_ms, max_inactive_time;
  388. FORCE_INLINE static bool stepper_max_timed_out(const millis_t ms=millis()) {
  389. return max_inactive_time && ELAPSED(ms, previous_move_ms + max_inactive_time);
  390. }
  391. FORCE_INLINE static void reset_stepper_timeout(const millis_t ms=millis()) { previous_move_ms = ms; }
  392. #if HAS_DISABLE_INACTIVE_AXIS
  393. static millis_t stepper_inactive_time;
  394. FORCE_INLINE static bool stepper_inactive_timeout(const millis_t ms=millis()) {
  395. return ELAPSED(ms, previous_move_ms + stepper_inactive_time);
  396. }
  397. #else
  398. static bool stepper_inactive_timeout(const millis_t) { return false; }
  399. #endif
  400. static void report_echo_start(const bool forReplay);
  401. static void report_heading(const bool forReplay, FSTR_P const fstr, const bool eol=true);
  402. static void report_heading_etc(const bool forReplay, FSTR_P const fstr, const bool eol=true) {
  403. report_heading(forReplay, fstr, eol);
  404. report_echo_start(forReplay);
  405. }
  406. static void say_units();
  407. static int8_t get_target_extruder_from_command();
  408. static int8_t get_target_e_stepper_from_command(const int8_t dval=-1);
  409. static void get_destination_from_command();
  410. static void process_parsed_command(const bool no_ok=false);
  411. static void process_next_command();
  412. // Execute G-code in-place, preserving current G-code parameters
  413. static void process_subcommands_now(FSTR_P fgcode);
  414. static void process_subcommands_now(char * gcode);
  415. static void home_all_axes(const bool keep_leveling=false) {
  416. process_subcommands_now(keep_leveling ? FPSTR(G28_STR) : TERN(CAN_SET_LEVELING_AFTER_G28, F("G28L0"), FPSTR(G28_STR)));
  417. }
  418. #if EITHER(HAS_AUTO_REPORTING, HOST_KEEPALIVE_FEATURE)
  419. static bool autoreport_paused;
  420. static bool set_autoreport_paused(const bool p) {
  421. const bool was = autoreport_paused;
  422. autoreport_paused = p;
  423. return was;
  424. }
  425. #else
  426. static constexpr bool autoreport_paused = false;
  427. static bool set_autoreport_paused(const bool) { return false; }
  428. #endif
  429. #if ENABLED(HOST_KEEPALIVE_FEATURE)
  430. /**
  431. * States for managing Marlin and host communication
  432. * Marlin sends messages if blocked or busy
  433. */
  434. enum MarlinBusyState : char {
  435. NOT_BUSY, // Not in a handler
  436. IN_HANDLER, // Processing a GCode
  437. IN_PROCESS, // Known to be blocking command input (as in G29)
  438. PAUSED_FOR_USER, // Blocking pending any input
  439. PAUSED_FOR_INPUT // Blocking pending text input (concept)
  440. };
  441. static MarlinBusyState busy_state;
  442. static uint8_t host_keepalive_interval;
  443. static void host_keepalive();
  444. static bool host_keepalive_is_paused() { return busy_state >= PAUSED_FOR_USER; }
  445. #define KEEPALIVE_STATE(N) REMEMBER(_KA_, gcode.busy_state, gcode.N)
  446. #else
  447. #define KEEPALIVE_STATE(N) NOOP
  448. #endif
  449. static void dwell(millis_t time);
  450. private:
  451. friend class MarlinSettings;
  452. #if ENABLED(MARLIN_DEV_MODE)
  453. static void D(const int16_t dcode);
  454. #endif
  455. static void G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move=false));
  456. #if ENABLED(ARC_SUPPORT)
  457. static void G2_G3(const bool clockwise);
  458. #endif
  459. static void G4();
  460. #if ENABLED(BEZIER_CURVE_SUPPORT)
  461. static void G5();
  462. #endif
  463. #if ENABLED(DIRECT_STEPPING)
  464. static void G6();
  465. #endif
  466. #if ENABLED(FWRETRACT)
  467. static void G10();
  468. static void G11();
  469. #endif
  470. #if ENABLED(NOZZLE_CLEAN_FEATURE)
  471. static void G12();
  472. #endif
  473. #if ENABLED(CNC_WORKSPACE_PLANES)
  474. static void G17();
  475. static void G18();
  476. static void G19();
  477. #endif
  478. #if ENABLED(INCH_MODE_SUPPORT)
  479. static void G20();
  480. static void G21();
  481. #endif
  482. #if ENABLED(G26_MESH_VALIDATION)
  483. static void G26();
  484. #endif
  485. #if ENABLED(NOZZLE_PARK_FEATURE)
  486. static void G27();
  487. #endif
  488. static void G28();
  489. #if HAS_LEVELING
  490. #if ENABLED(G29_RETRY_AND_RECOVER)
  491. static void event_probe_failure();
  492. static void event_probe_recover();
  493. static void G29_with_retry();
  494. #define G29_TYPE bool
  495. #else
  496. #define G29_TYPE void
  497. #endif
  498. static G29_TYPE G29();
  499. #endif
  500. #if HAS_BED_PROBE
  501. static void G30();
  502. #if ENABLED(Z_PROBE_SLED)
  503. static void G31();
  504. static void G32();
  505. #endif
  506. #endif
  507. #if ENABLED(DELTA_AUTO_CALIBRATION)
  508. static void G33();
  509. #endif
  510. #if ANY(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN, MECHANICAL_GANTRY_CALIBRATION)
  511. static void G34();
  512. #endif
  513. #if ENABLED(Z_STEPPER_AUTO_ALIGN)
  514. static void M422();
  515. static void M422_report(const bool forReplay=true);
  516. #endif
  517. #if ENABLED(ASSISTED_TRAMMING)
  518. static void G35();
  519. #endif
  520. #if ENABLED(G38_PROBE_TARGET)
  521. static void G38(const int8_t subcode);
  522. #endif
  523. #if HAS_MESH
  524. static void G42();
  525. #endif
  526. #if ENABLED(CNC_COORDINATE_SYSTEMS)
  527. static void G53();
  528. static void G54();
  529. static void G55();
  530. static void G56();
  531. static void G57();
  532. static void G58();
  533. static void G59();
  534. #endif
  535. #if BOTH(PTC_PROBE, PTC_BED)
  536. static void G76();
  537. #endif
  538. #if SAVED_POSITIONS
  539. static void G60();
  540. static void G61();
  541. #endif
  542. #if ENABLED(GCODE_MOTION_MODES)
  543. static void G80();
  544. #endif
  545. static void G92();
  546. #if ENABLED(CALIBRATION_GCODE)
  547. static void G425();
  548. #endif
  549. #if HAS_RESUME_CONTINUE
  550. static void M0_M1();
  551. #endif
  552. #if HAS_CUTTER
  553. static void M3_M4(const bool is_M4);
  554. static void M5();
  555. #endif
  556. #if ENABLED(COOLANT_MIST)
  557. static void M7();
  558. #endif
  559. #if EITHER(AIR_ASSIST, COOLANT_FLOOD)
  560. static void M8();
  561. #endif
  562. #if EITHER(AIR_ASSIST, COOLANT_CONTROL)
  563. static void M9();
  564. #endif
  565. #if ENABLED(AIR_EVACUATION)
  566. static void M10();
  567. static void M11();
  568. #endif
  569. #if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
  570. static void M12();
  571. #endif
  572. #if ENABLED(EXPECTED_PRINTER_CHECK)
  573. static void M16();
  574. #endif
  575. static void M17();
  576. static void M18_M84();
  577. #if ENABLED(SDSUPPORT)
  578. static void M20();
  579. static void M21();
  580. static void M22();
  581. static void M23();
  582. static void M24();
  583. static void M25();
  584. static void M26();
  585. static void M27();
  586. static void M28();
  587. static void M29();
  588. static void M30();
  589. #endif
  590. static void M31();
  591. #if ENABLED(SDSUPPORT)
  592. #if HAS_MEDIA_SUBCALLS
  593. static void M32();
  594. #endif
  595. #if ENABLED(LONG_FILENAME_HOST_SUPPORT)
  596. static void M33();
  597. #endif
  598. #if BOTH(SDCARD_SORT_ALPHA, SDSORT_GCODE)
  599. static void M34();
  600. #endif
  601. #endif
  602. #if ENABLED(DIRECT_PIN_CONTROL)
  603. static void M42();
  604. #endif
  605. #if ENABLED(PINS_DEBUGGING)
  606. static void M43();
  607. #endif
  608. #if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST)
  609. static void M48();
  610. #endif
  611. #if ENABLED(SET_PROGRESS_MANUALLY)
  612. static void M73();
  613. #endif
  614. static void M75();
  615. static void M76();
  616. static void M77();
  617. #if ENABLED(PRINTCOUNTER)
  618. static void M78();
  619. #endif
  620. #if ENABLED(PSU_CONTROL)
  621. static void M80();
  622. #endif
  623. static void M81();
  624. #if HAS_EXTRUDERS
  625. static void M82();
  626. static void M83();
  627. #endif
  628. static void M85();
  629. static void M92();
  630. static void M92_report(const bool forReplay=true, const int8_t e=-1);
  631. #if ENABLED(M100_FREE_MEMORY_WATCHER)
  632. static void M100();
  633. #endif
  634. #if ENABLED(BD_SENSOR)
  635. static void M102();
  636. static void M102_report(const bool forReplay=true);
  637. #endif
  638. #if HAS_EXTRUDERS
  639. static void M104_M109(const bool isM109);
  640. FORCE_INLINE static void M104() { M104_M109(false); }
  641. FORCE_INLINE static void M109() { M104_M109(true); }
  642. #endif
  643. static void M105();
  644. #if HAS_FAN
  645. static void M106();
  646. static void M107();
  647. #endif
  648. #if DISABLED(EMERGENCY_PARSER)
  649. static void M108();
  650. static void M112();
  651. static void M410();
  652. #if ENABLED(HOST_PROMPT_SUPPORT)
  653. static void M876();
  654. #endif
  655. #endif
  656. static void M110();
  657. static void M111();
  658. #if ENABLED(HOST_KEEPALIVE_FEATURE)
  659. static void M113();
  660. #endif
  661. static void M114();
  662. static void M115();
  663. #if HAS_STATUS_MESSAGE
  664. static void M117();
  665. #endif
  666. static void M118();
  667. static void M119();
  668. static void M120();
  669. static void M121();
  670. #if HAS_FANCHECK
  671. static void M123();
  672. #endif
  673. #if ENABLED(PARK_HEAD_ON_PAUSE)
  674. static void M125();
  675. #endif
  676. #if ENABLED(BARICUDA)
  677. #if HAS_HEATER_1
  678. static void M126();
  679. static void M127();
  680. #endif
  681. #if HAS_HEATER_2
  682. static void M128();
  683. static void M129();
  684. #endif
  685. #endif
  686. #if HAS_HEATED_BED
  687. static void M140_M190(const bool isM190);
  688. FORCE_INLINE static void M140() { M140_M190(false); }
  689. FORCE_INLINE static void M190() { M140_M190(true); }
  690. #endif
  691. #if HAS_HEATED_CHAMBER
  692. static void M141();
  693. static void M191();
  694. #endif
  695. #if HAS_TEMP_PROBE
  696. static void M192();
  697. #endif
  698. #if HAS_COOLER
  699. static void M143();
  700. static void M193();
  701. #endif
  702. #if HAS_PREHEAT
  703. static void M145();
  704. static void M145_report(const bool forReplay=true);
  705. #endif
  706. #if ENABLED(TEMPERATURE_UNITS_SUPPORT)
  707. static void M149();
  708. static void M149_report(const bool forReplay=true);
  709. #endif
  710. #if HAS_COLOR_LEDS
  711. static void M150();
  712. #endif
  713. #if ENABLED(AUTO_REPORT_POSITION)
  714. static void M154();
  715. #endif
  716. #if BOTH(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR)
  717. static void M155();
  718. #endif
  719. #if ENABLED(MIXING_EXTRUDER)
  720. static void M163();
  721. static void M164();
  722. #if ENABLED(DIRECT_MIXING_IN_G1)
  723. static void M165();
  724. #endif
  725. #if ENABLED(GRADIENT_MIX)
  726. static void M166();
  727. #endif
  728. #endif
  729. #if DISABLED(NO_VOLUMETRICS)
  730. static void M200();
  731. static void M200_report(const bool forReplay=true);
  732. #endif
  733. static void M201();
  734. static void M201_report(const bool forReplay=true);
  735. #if 0
  736. static void M202(); // Not used for Sprinter/grbl gen6
  737. #endif
  738. static void M203();
  739. static void M203_report(const bool forReplay=true);
  740. static void M204();
  741. static void M204_report(const bool forReplay=true);
  742. static void M205();
  743. static void M205_report(const bool forReplay=true);
  744. #if HAS_M206_COMMAND
  745. static void M206();
  746. static void M206_report(const bool forReplay=true);
  747. #endif
  748. #if ENABLED(FWRETRACT)
  749. static void M207();
  750. static void M207_report(const bool forReplay=true);
  751. static void M208();
  752. static void M208_report(const bool forReplay=true);
  753. #if ENABLED(FWRETRACT_AUTORETRACT)
  754. static void M209();
  755. static void M209_report(const bool forReplay=true);
  756. #endif
  757. #endif
  758. static void M211();
  759. static void M211_report(const bool forReplay=true);
  760. #if HAS_MULTI_EXTRUDER
  761. static void M217();
  762. static void M217_report(const bool forReplay=true);
  763. #endif
  764. #if HAS_HOTEND_OFFSET
  765. static void M218();
  766. static void M218_report(const bool forReplay=true);
  767. #endif
  768. static void M220();
  769. #if HAS_EXTRUDERS
  770. static void M221();
  771. #endif
  772. #if ENABLED(DIRECT_PIN_CONTROL)
  773. static void M226();
  774. #endif
  775. #if ENABLED(PHOTO_GCODE)
  776. static void M240();
  777. #endif
  778. #if HAS_LCD_CONTRAST
  779. static void M250();
  780. static void M250_report(const bool forReplay=true);
  781. #endif
  782. #if HAS_GCODE_M255
  783. static void M255();
  784. static void M255_report(const bool forReplay=true);
  785. #endif
  786. #if HAS_LCD_BRIGHTNESS
  787. static void M256();
  788. static void M256_report(const bool forReplay=true);
  789. #endif
  790. #if ENABLED(EXPERIMENTAL_I2CBUS)
  791. static void M260();
  792. static void M261();
  793. #endif
  794. #if HAS_SERVOS
  795. static void M280();
  796. #if ENABLED(EDITABLE_SERVO_ANGLES)
  797. static void M281();
  798. static void M281_report(const bool forReplay=true);
  799. #endif
  800. #if ENABLED(SERVO_DETACH_GCODE)
  801. static void M282();
  802. #endif
  803. #endif
  804. #if ENABLED(BABYSTEPPING)
  805. static void M290();
  806. #endif
  807. #if HAS_SOUND
  808. static void M300();
  809. #endif
  810. #if ENABLED(PIDTEMP)
  811. static void M301();
  812. static void M301_report(const bool forReplay=true E_OPTARG(const int8_t eindex=-1));
  813. #endif
  814. #if ENABLED(PREVENT_COLD_EXTRUSION)
  815. static void M302();
  816. #endif
  817. #if HAS_PID_HEATING
  818. static void M303();
  819. #endif
  820. #if ENABLED(PIDTEMPBED)
  821. static void M304();
  822. static void M304_report(const bool forReplay=true);
  823. #endif
  824. #if HAS_USER_THERMISTORS
  825. static void M305();
  826. #endif
  827. #if ENABLED(MPCTEMP)
  828. static void M306();
  829. static void M306_report(const bool forReplay=true);
  830. #endif
  831. #if ENABLED(PIDTEMPCHAMBER)
  832. static void M309();
  833. static void M309_report(const bool forReplay=true);
  834. #endif
  835. #if HAS_MICROSTEPS
  836. static void M350();
  837. static void M351();
  838. #endif
  839. #if ENABLED(CASE_LIGHT_ENABLE)
  840. static void M355();
  841. #endif
  842. #if ENABLED(REPETIER_GCODE_M360)
  843. static void M360();
  844. #endif
  845. #if ENABLED(MORGAN_SCARA)
  846. static bool M360();
  847. static bool M361();
  848. static bool M362();
  849. static bool M363();
  850. static bool M364();
  851. #endif
  852. #if EITHER(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL)
  853. static void M380();
  854. static void M381();
  855. #endif
  856. static void M400();
  857. #if HAS_BED_PROBE
  858. static void M401();
  859. static void M402();
  860. #endif
  861. #if HAS_PRUSA_MMU2
  862. static void M403();
  863. #endif
  864. #if ENABLED(FILAMENT_WIDTH_SENSOR)
  865. static void M404();
  866. static void M405();
  867. static void M406();
  868. static void M407();
  869. #endif
  870. #if HAS_FILAMENT_SENSOR
  871. static void M412();
  872. static void M412_report(const bool forReplay=true);
  873. #endif
  874. #if HAS_MULTI_LANGUAGE
  875. static void M414();
  876. static void M414_report(const bool forReplay=true);
  877. #endif
  878. #if HAS_LEVELING
  879. static void M420();
  880. static void M420_report(const bool forReplay=true);
  881. static void M421();
  882. #endif
  883. #if ENABLED(BACKLASH_GCODE)
  884. static void M425();
  885. static void M425_report(const bool forReplay=true);
  886. #endif
  887. #if HAS_M206_COMMAND
  888. static void M428();
  889. #endif
  890. #if HAS_POWER_MONITOR
  891. static void M430();
  892. #endif
  893. #if ENABLED(CANCEL_OBJECTS)
  894. static void M486();
  895. #endif
  896. static void M500();
  897. static void M501();
  898. static void M502();
  899. #if DISABLED(DISABLE_M503)
  900. static void M503();
  901. #endif
  902. #if ENABLED(EEPROM_SETTINGS)
  903. static void M504();
  904. #endif
  905. #if ENABLED(PASSWORD_FEATURE)
  906. static void M510();
  907. #if ENABLED(PASSWORD_UNLOCK_GCODE)
  908. static void M511();
  909. #endif
  910. #if ENABLED(PASSWORD_CHANGE_GCODE)
  911. static void M512();
  912. #endif
  913. #endif
  914. #if ENABLED(SDSUPPORT)
  915. static void M524();
  916. #endif
  917. #if ENABLED(SD_ABORT_ON_ENDSTOP_HIT)
  918. static void M540();
  919. #endif
  920. #if HAS_ETHERNET
  921. static void M552();
  922. static void M552_report();
  923. static void M553();
  924. static void M553_report();
  925. static void M554();
  926. static void M554_report();
  927. #endif
  928. #if HAS_STEALTHCHOP
  929. static void M569();
  930. static void M569_report(const bool forReplay=true);
  931. #endif
  932. #if ENABLED(BAUD_RATE_GCODE)
  933. static void M575();
  934. #endif
  935. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  936. static void M600();
  937. static void M603();
  938. static void M603_report(const bool forReplay=true);
  939. #endif
  940. #if HAS_DUPLICATION_MODE
  941. static void M605();
  942. #endif
  943. #if IS_KINEMATIC
  944. static void M665();
  945. static void M665_report(const bool forReplay=true);
  946. #endif
  947. #if EITHER(DELTA, HAS_EXTRA_ENDSTOPS)
  948. static void M666();
  949. static void M666_report(const bool forReplay=true);
  950. #endif
  951. #if ENABLED(DUET_SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD)
  952. static void M672();
  953. #endif
  954. #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
  955. static void M701();
  956. static void M702();
  957. #endif
  958. #if ENABLED(GCODE_REPEAT_MARKERS)
  959. static void M808();
  960. #endif
  961. #if ENABLED(GCODE_MACROS)
  962. static void M810_819();
  963. #endif
  964. #if HAS_BED_PROBE
  965. static void M851();
  966. static void M851_report(const bool forReplay=true);
  967. #endif
  968. #if ENABLED(SKEW_CORRECTION_GCODE)
  969. static void M852();
  970. static void M852_report(const bool forReplay=true);
  971. #endif
  972. #if ENABLED(I2C_POSITION_ENCODERS)
  973. FORCE_INLINE static void M860() { I2CPEM.M860(); }
  974. FORCE_INLINE static void M861() { I2CPEM.M861(); }
  975. FORCE_INLINE static void M862() { I2CPEM.M862(); }
  976. FORCE_INLINE static void M863() { I2CPEM.M863(); }
  977. FORCE_INLINE static void M864() { I2CPEM.M864(); }
  978. FORCE_INLINE static void M865() { I2CPEM.M865(); }
  979. FORCE_INLINE static void M866() { I2CPEM.M866(); }
  980. FORCE_INLINE static void M867() { I2CPEM.M867(); }
  981. FORCE_INLINE static void M868() { I2CPEM.M868(); }
  982. FORCE_INLINE static void M869() { I2CPEM.M869(); }
  983. #endif
  984. #if HAS_PTC
  985. static void M871();
  986. #endif
  987. #if ENABLED(LIN_ADVANCE)
  988. static void M900();
  989. static void M900_report(const bool forReplay=true);
  990. #endif
  991. #if HAS_TRINAMIC_CONFIG
  992. static void M122();
  993. static void M906();
  994. static void M906_report(const bool forReplay=true);
  995. #if ENABLED(MONITOR_DRIVER_STATUS)
  996. static void M911();
  997. static void M912();
  998. #endif
  999. #if ENABLED(HYBRID_THRESHOLD)
  1000. static void M913();
  1001. static void M913_report(const bool forReplay=true);
  1002. #endif
  1003. #if USE_SENSORLESS
  1004. static void M914();
  1005. static void M914_report(const bool forReplay=true);
  1006. #endif
  1007. static void M919();
  1008. #endif
  1009. #if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM || HAS_MOTOR_CURRENT_I2C || HAS_MOTOR_CURRENT_DAC
  1010. static void M907();
  1011. #if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM
  1012. static void M907_report(const bool forReplay=true);
  1013. #endif
  1014. #endif
  1015. #if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_DAC
  1016. static void M908();
  1017. #endif
  1018. #if HAS_MOTOR_CURRENT_DAC
  1019. static void M909();
  1020. static void M910();
  1021. #endif
  1022. #if ENABLED(SDSUPPORT)
  1023. static void M928();
  1024. #endif
  1025. #if ENABLED(MAGNETIC_PARKING_EXTRUDER)
  1026. static void M951();
  1027. #endif
  1028. #if ENABLED(TOUCH_SCREEN_CALIBRATION)
  1029. static void M995();
  1030. #endif
  1031. #if BOTH(HAS_SPI_FLASH, SDSUPPORT)
  1032. static void M993();
  1033. static void M994();
  1034. #endif
  1035. #if ENABLED(PLATFORM_M997_SUPPORT)
  1036. static void M997();
  1037. #endif
  1038. static void M999();
  1039. #if ENABLED(POWER_LOSS_RECOVERY)
  1040. static void M413();
  1041. static void M413_report(const bool forReplay=true);
  1042. static void M1000();
  1043. #endif
  1044. #if ENABLED(X_AXIS_TWIST_COMPENSATION)
  1045. static void M423();
  1046. static void M423_report(const bool forReplay=true);
  1047. #endif
  1048. #if ENABLED(SDSUPPORT)
  1049. static void M1001();
  1050. #endif
  1051. #if ENABLED(DGUS_LCD_UI_MKS)
  1052. static void M1002();
  1053. #endif
  1054. #if ENABLED(UBL_MESH_WIZARD)
  1055. static void M1004();
  1056. #endif
  1057. #if ENABLED(HAS_MCP3426_ADC)
  1058. static void M3426();
  1059. #endif
  1060. #if ENABLED(MAX7219_GCODE)
  1061. static void M7219();
  1062. #endif
  1063. #if ENABLED(CONTROLLER_FAN_EDITABLE)
  1064. static void M710();
  1065. static void M710_report(const bool forReplay=true);
  1066. #endif
  1067. static void T(const int8_t tool_index);
  1068. };
  1069. extern GcodeSuite gcode;