Browse Source

Combine G-code files into fewer units

Addressing #7707
pull/1/head
Scott Lahteine 7 years ago
parent
commit
1587962547
  1. 129
      Marlin/src/gcode/config/M200-M205.cpp
  2. 45
      Marlin/src/gcode/config/M200.cpp
  3. 43
      Marlin/src/gcode/config/M201.cpp
  4. 40
      Marlin/src/gcode/config/M203.cpp
  5. 52
      Marlin/src/gcode/config/M204.cpp
  6. 45
      Marlin/src/gcode/config/M205.cpp
  7. 39
      Marlin/src/gcode/control/M108.cpp
  8. 18
      Marlin/src/gcode/control/M108_M112_M410.cpp
  9. 39
      Marlin/src/gcode/control/M112.cpp
  10. 33
      Marlin/src/gcode/control/M17.cpp
  11. 10
      Marlin/src/gcode/control/M17_M18_M84.cpp
  12. 35
      Marlin/src/gcode/feature/digipot/M907-M910.cpp
  13. 55
      Marlin/src/gcode/feature/digipot/M908.cpp
  14. 36
      Marlin/src/gcode/feature/digipot/M909.cpp
  15. 36
      Marlin/src/gcode/feature/digipot/M910.cpp
  16. 29
      Marlin/src/gcode/feature/fwretract/M207-M209.cpp
  17. 45
      Marlin/src/gcode/feature/fwretract/M207.cpp
  18. 44
      Marlin/src/gcode/feature/fwretract/M209.cpp
  19. 38
      Marlin/src/gcode/feature/mixing/M163-M165.cpp
  20. 45
      Marlin/src/gcode/feature/mixing/M164.cpp
  21. 45
      Marlin/src/gcode/feature/mixing/M165.cpp
  22. 155
      Marlin/src/gcode/feature/trinamic/M911-M914.cpp
  23. 59
      Marlin/src/gcode/feature/trinamic/M911.cpp
  24. 57
      Marlin/src/gcode/feature/trinamic/M912.cpp
  25. 68
      Marlin/src/gcode/feature/trinamic/M913.cpp
  26. 55
      Marlin/src/gcode/feature/trinamic/M914.cpp
  27. 15
      Marlin/src/gcode/gcode.cpp
  28. 15
      Marlin/src/gcode/gcode.h
  29. 51
      Marlin/src/gcode/geometry/M206.cpp
  30. 21
      Marlin/src/gcode/geometry/M206_M428.cpp
  31. 191
      Marlin/src/gcode/sdcard/M20-M30_M32-M34_M928.cpp
  32. 39
      Marlin/src/gcode/sdcard/M20.cpp
  33. 35
      Marlin/src/gcode/sdcard/M21.cpp
  34. 35
      Marlin/src/gcode/sdcard/M22.cpp
  35. 39
      Marlin/src/gcode/sdcard/M23.cpp
  36. 47
      Marlin/src/gcode/sdcard/M24.cpp
  37. 47
      Marlin/src/gcode/sdcard/M25.cpp
  38. 38
      Marlin/src/gcode/sdcard/M26.cpp
  39. 35
      Marlin/src/gcode/sdcard/M27.cpp
  40. 35
      Marlin/src/gcode/sdcard/M28.cpp
  41. 38
      Marlin/src/gcode/sdcard/M29.cpp
  42. 40
      Marlin/src/gcode/sdcard/M30.cpp
  43. 55
      Marlin/src/gcode/sdcard/M32.cpp
  44. 46
      Marlin/src/gcode/sdcard/M33.cpp
  45. 42
      Marlin/src/gcode/sdcard/M34.cpp
  46. 37
      Marlin/src/gcode/sdcard/M928.cpp
  47. 39
      Marlin/src/gcode/stats/M75-M77.cpp
  48. 21
      Marlin/src/gcode/stats/M75-M78.cpp
  49. 75
      Marlin/src/gcode/temperature/M104.cpp
  50. 49
      Marlin/src/gcode/temperature/M104_M109.cpp
  51. 38
      Marlin/src/gcode/temperature/M140.cpp
  52. 10
      Marlin/src/gcode/temperature/M140_M190.cpp

129
Marlin/src/gcode/config/M200-M205.cpp

@ -0,0 +1,129 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../gcode.h"
#include "../../Marlin.h"
#include "../../module/planner.h"
/**
* M200: Set filament diameter and set E axis units to cubic units
*
* T<extruder> - Optional extruder number. Current extruder if omitted.
* D<linear> - Diameter of the filament. Use "D0" to switch back to linear units on the E axis.
*/
void GcodeSuite::M200() {
if (get_target_extruder_from_command()) return;
if (parser.seen('D')) {
// setting any extruder filament size disables volumetric on the assumption that
// slicers either generate in extruder values as cubic mm or as as filament feeds
// for all extruders
if ( (parser.volumetric_enabled = (parser.value_linear_units() != 0.0)) )
planner.set_filament_size(target_extruder, parser.value_linear_units());
}
planner.calculate_volumetric_multipliers();
}
/**
* M201: Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000)
*
* With multiple extruders use T to specify which one.
*/
void GcodeSuite::M201() {
GET_TARGET_EXTRUDER();
LOOP_XYZE(i) {
if (parser.seen(axis_codes[i])) {
const uint8_t a = i + (i == E_AXIS ? TARGET_EXTRUDER : 0);
planner.max_acceleration_mm_per_s2[a] = parser.value_axis_units((AxisEnum)a);
}
}
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
planner.reset_acceleration_rates();
}
/**
* M203: Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in units/sec
*
* With multiple extruders use T to specify which one.
*/
void GcodeSuite::M203() {
GET_TARGET_EXTRUDER();
LOOP_XYZE(i)
if (parser.seen(axis_codes[i])) {
const uint8_t a = i + (i == E_AXIS ? TARGET_EXTRUDER : 0);
planner.max_feedrate_mm_s[a] = parser.value_axis_units((AxisEnum)a);
}
}
/**
* M204: Set Accelerations in units/sec^2 (M204 P1200 R3000 T3000)
*
* P = Printing moves
* R = Retract only (no X, Y, Z) moves
* T = Travel (non printing) moves
*
* Also sets minimum segment time in ms (B20000) to prevent buffer under-runs and M20 minimum feedrate
*/
void GcodeSuite::M204() {
if (parser.seen('S')) { // Kept for legacy compatibility. Should NOT BE USED for new developments.
planner.travel_acceleration = planner.acceleration = parser.value_linear_units();
SERIAL_ECHOLNPAIR("Setting Print and Travel Acceleration: ", planner.acceleration);
}
if (parser.seen('P')) {
planner.acceleration = parser.value_linear_units();
SERIAL_ECHOLNPAIR("Setting Print Acceleration: ", planner.acceleration);
}
if (parser.seen('R')) {
planner.retract_acceleration = parser.value_linear_units();
SERIAL_ECHOLNPAIR("Setting Retract Acceleration: ", planner.retract_acceleration);
}
if (parser.seen('T')) {
planner.travel_acceleration = parser.value_linear_units();
SERIAL_ECHOLNPAIR("Setting Travel Acceleration: ", planner.travel_acceleration);
}
}
/**
* M205: Set Advanced Settings
*
* S = Min Feed Rate (units/s)
* T = Min Travel Feed Rate (units/s)
* B = Min Segment Time (µs)
* X = Max X Jerk (units/sec^2)
* Y = Max Y Jerk (units/sec^2)
* Z = Max Z Jerk (units/sec^2)
* E = Max E Jerk (units/sec^2)
*/
void GcodeSuite::M205() {
if (parser.seen('S')) planner.min_feedrate_mm_s = parser.value_linear_units();
if (parser.seen('T')) planner.min_travel_feedrate_mm_s = parser.value_linear_units();
if (parser.seen('B')) planner.min_segment_time = parser.value_millis();
if (parser.seen('X')) planner.max_jerk[X_AXIS] = parser.value_linear_units();
if (parser.seen('Y')) planner.max_jerk[Y_AXIS] = parser.value_linear_units();
if (parser.seen('Z')) planner.max_jerk[Z_AXIS] = parser.value_linear_units();
if (parser.seen('E')) planner.max_jerk[E_AXIS] = parser.value_linear_units();
}

45
Marlin/src/gcode/config/M200.cpp

@ -1,45 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../gcode.h"
#include "../../Marlin.h"
#include "../../module/planner.h"
/**
* M200: Set filament diameter and set E axis units to cubic units
*
* T<extruder> - Optional extruder number. Current extruder if omitted.
* D<linear> - Diameter of the filament. Use "D0" to switch back to linear units on the E axis.
*/
void GcodeSuite::M200() {
if (get_target_extruder_from_command()) return;
if (parser.seen('D')) {
// setting any extruder filament size disables volumetric on the assumption that
// slicers either generate in extruder values as cubic mm or as as filament feeds
// for all extruders
if ( (parser.volumetric_enabled = (parser.value_linear_units() != 0.0)) )
planner.set_filament_size(target_extruder, parser.value_linear_units());
}
planner.calculate_volumetric_multipliers();
}

43
Marlin/src/gcode/config/M201.cpp

@ -1,43 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../gcode.h"
#include "../../module/planner.h"
/**
* M201: Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000)
*
* With multiple extruders use T to specify which one.
*/
void GcodeSuite::M201() {
GET_TARGET_EXTRUDER();
LOOP_XYZE(i) {
if (parser.seen(axis_codes[i])) {
const uint8_t a = i + (i == E_AXIS ? TARGET_EXTRUDER : 0);
planner.max_acceleration_mm_per_s2[a] = parser.value_axis_units((AxisEnum)a);
}
}
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
planner.reset_acceleration_rates();
}

40
Marlin/src/gcode/config/M203.cpp

@ -1,40 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../gcode.h"
#include "../../module/planner.h"
/**
* M203: Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in units/sec
*
* With multiple extruders use T to specify which one.
*/
void GcodeSuite::M203() {
GET_TARGET_EXTRUDER();
LOOP_XYZE(i)
if (parser.seen(axis_codes[i])) {
const uint8_t a = i + (i == E_AXIS ? TARGET_EXTRUDER : 0);
planner.max_feedrate_mm_s[a] = parser.value_axis_units((AxisEnum)a);
}
}

52
Marlin/src/gcode/config/M204.cpp

@ -1,52 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../gcode.h"
#include "../../module/planner.h"
/**
* M204: Set Accelerations in units/sec^2 (M204 P1200 R3000 T3000)
*
* P = Printing moves
* R = Retract only (no X, Y, Z) moves
* T = Travel (non printing) moves
*
* Also sets minimum segment time in ms (B20000) to prevent buffer under-runs and M20 minimum feedrate
*/
void GcodeSuite::M204() {
if (parser.seen('S')) { // Kept for legacy compatibility. Should NOT BE USED for new developments.
planner.travel_acceleration = planner.acceleration = parser.value_linear_units();
SERIAL_ECHOLNPAIR("Setting Print and Travel Acceleration: ", planner.acceleration);
}
if (parser.seen('P')) {
planner.acceleration = parser.value_linear_units();
SERIAL_ECHOLNPAIR("Setting Print Acceleration: ", planner.acceleration);
}
if (parser.seen('R')) {
planner.retract_acceleration = parser.value_linear_units();
SERIAL_ECHOLNPAIR("Setting Retract Acceleration: ", planner.retract_acceleration);
}
if (parser.seen('T')) {
planner.travel_acceleration = parser.value_linear_units();
SERIAL_ECHOLNPAIR("Setting Travel Acceleration: ", planner.travel_acceleration);
}
}

45
Marlin/src/gcode/config/M205.cpp

@ -1,45 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../gcode.h"
#include "../../module/planner.h"
/**
* M205: Set Advanced Settings
*
* S = Min Feed Rate (units/s)
* T = Min Travel Feed Rate (units/s)
* B = Min Segment Time (µs)
* X = Max X Jerk (units/sec^2)
* Y = Max Y Jerk (units/sec^2)
* Z = Max Z Jerk (units/sec^2)
* E = Max E Jerk (units/sec^2)
*/
void GcodeSuite::M205() {
if (parser.seen('S')) planner.min_feedrate_mm_s = parser.value_linear_units();
if (parser.seen('T')) planner.min_travel_feedrate_mm_s = parser.value_linear_units();
if (parser.seen('B')) planner.min_segment_time = parser.value_millis();
if (parser.seen('X')) planner.max_jerk[X_AXIS] = parser.value_linear_units();
if (parser.seen('Y')) planner.max_jerk[Y_AXIS] = parser.value_linear_units();
if (parser.seen('Z')) planner.max_jerk[Z_AXIS] = parser.value_linear_units();
if (parser.seen('E')) planner.max_jerk[E_AXIS] = parser.value_linear_units();
}

39
Marlin/src/gcode/control/M108.cpp

@ -1,39 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if DISABLED(EMERGENCY_PARSER)
#include "../gcode.h"
#include "../../Marlin.h" // for wait_for_heatup
/**
* M108: Stop the waiting for heaters in M109, M190, M303. Does not affect the target temperature.
*/
void GcodeSuite::M108() {
wait_for_heatup = false;
}
#endif // !EMERGENCY_PARSER

18
Marlin/src/gcode/control/M410.cpp → Marlin/src/gcode/control/M108_M112_M410.cpp

@ -25,7 +25,21 @@
#if DISABLED(EMERGENCY_PARSER)
#include "../gcode.h"
#include "../../Marlin.h" // for quickstop_stepper
#include "../../Marlin.h" // for wait_for_heatup, kill, quickstop_stepper
/**
* M108: Stop the waiting for heaters in M109, M190, M303. Does not affect the target temperature.
*/
void GcodeSuite::M108() {
wait_for_heatup = false;
}
/**
* M112: Emergency Stop
*/
void GcodeSuite::M112() {
kill(PSTR(MSG_KILLED));
}
/**
* M410: Quickstop - Abort all planned moves
@ -34,9 +48,7 @@
* will be out of sync with the stepper position after this.
*/
void GcodeSuite::M410() {
quickstop_stepper();
}
#endif // !EMERGENCY_PARSER

39
Marlin/src/gcode/control/M112.cpp

@ -1,39 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if DISABLED(EMERGENCY_PARSER)
#include "../gcode.h"
#include "../../Marlin.h" // for kill
/**
* M112: Emergency Stop
*/
void GcodeSuite::M112() {
kill(PSTR(MSG_KILLED));
}
#endif // !EMERGENCY_PARSER

33
Marlin/src/gcode/control/M17.cpp

@ -1,33 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../gcode.h"
#include "../../lcd/ultralcd.h"
#include "../../Marlin.h"
/**
* M17: Enable power on all stepper motors
*/
void GcodeSuite::M17() {
LCD_MESSAGEPGM(MSG_NO_MOVE);
enable_all_steppers();
}

10
Marlin/src/gcode/control/M18_M84.cpp → Marlin/src/gcode/control/M17_M18_M84.cpp

@ -22,13 +22,21 @@
#include "../gcode.h"
#include "../../Marlin.h" // for stepper_inactive_time
#include "../../lcd/ultralcd.h"
#include "../../module/stepper.h"
#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD)
#include "../../feature/bedlevel/bedlevel.h"
#include "../../lcd/ultralcd.h"
#endif
/**
* M17: Enable power on all stepper motors
*/
void GcodeSuite::M17() {
LCD_MESSAGEPGM(MSG_NO_MOVE);
enable_all_steppers();
}
/**
* M18, M84: Disable stepper motors
*/

35
Marlin/src/gcode/feature/digipot/M907.cpp → Marlin/src/gcode/feature/digipot/M907-M910.cpp

@ -20,6 +20,10 @@
*
*/
#include "../../../inc/MarlinConfig.h"
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || ENABLED(DIGIPOT_I2C) || ENABLED(DAC_STEPPER_CURRENT)
#include "../../gcode.h"
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM
@ -73,3 +77,34 @@ void GcodeSuite::M907() {
LOOP_XYZE(i) if (parser.seen(axis_codes[i])) dac_current_percent(i, parser.value_float());
#endif
}
#if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT)
/**
* M908: Control digital trimpot directly (M908 P<pin> S<current>)
*/
void GcodeSuite::M908() {
#if HAS_DIGIPOTSS
stepper.digitalPotWrite(
parser.intval('P'),
parser.intval('S')
);
#endif
#if ENABLED(DAC_STEPPER_CURRENT)
dac_current_raw(
parser.byteval('P', -1),
parser.ushortval('S', 0)
);
#endif
}
#endif // HAS_DIGIPOTSS || DAC_STEPPER_CURRENT
#if ENABLED(DAC_STEPPER_CURRENT)
void GcodeSuite::M909() { dac_print_values(); }
void GcodeSuite::M910() { dac_commit_eeprom(); }
#endif // DAC_STEPPER_CURRENT
#endif // HAS_DIGIPOTSS || DAC_STEPPER_CURRENT || HAS_MOTOR_CURRENT_PWM || DIGIPOT_I2C

55
Marlin/src/gcode/feature/digipot/M908.cpp

@ -1,55 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT)
#include "../../gcode.h"
#if HAS_DIGIPOTSS
#include "../../../module/stepper.h"
#endif
#if ENABLED(DAC_STEPPER_CURRENT)
#include "../../../feature/dac/stepper_dac.h"
#endif
/**
* M908: Control digital trimpot directly (M908 P<pin> S<current>)
*/
void GcodeSuite::M908() {
#if HAS_DIGIPOTSS
stepper.digitalPotWrite(
parser.intval('P'),
parser.intval('S')
);
#endif
#if ENABLED(DAC_STEPPER_CURRENT)
dac_current_raw(
parser.byteval('P', -1),
parser.ushortval('S', 0)
);
#endif
}
#endif // HAS_DIGIPOTSS || DAC_STEPPER_CURRENT

36
Marlin/src/gcode/feature/digipot/M909.cpp

@ -1,36 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(DAC_STEPPER_CURRENT)
#include "../../gcode.h"
#include "../../../feature/dac/stepper_dac.h"
void GcodeSuite::M909() {
dac_print_values();
}
#endif // DAC_STEPPER_CURRENT

36
Marlin/src/gcode/feature/digipot/M910.cpp

@ -1,36 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(DAC_STEPPER_CURRENT)
#include "../../gcode.h"
#include "../../../feature/dac/stepper_dac.h"
void GcodeSuite::M910() {
dac_commit_eeprom();
}
#endif // DAC_STEPPER_CURRENT

29
Marlin/src/gcode/feature/fwretract/M208.cpp → Marlin/src/gcode/feature/fwretract/M207-M209.cpp

@ -27,6 +27,21 @@
#include "../../../feature/fwretract.h"
#include "../../gcode.h"
/**
* M207: Set firmware retraction values
*
* S[+units] retract_length
* W[+units] swap_retract_length (multi-extruder)
* F[units/min] retract_feedrate_mm_s
* Z[units] retract_zlift
*/
void GcodeSuite::M207() {
if (parser.seen('S')) fwretract.retract_length = parser.value_axis_units(E_AXIS);
if (parser.seen('F')) fwretract.retract_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
if (parser.seen('Z')) fwretract.retract_zlift = parser.value_linear_units();
if (parser.seen('W')) fwretract.swap_retract_length = parser.value_axis_units(E_AXIS);
}
/**
* M208: Set firmware un-retraction values
*
@ -42,4 +57,18 @@ void GcodeSuite::M208() {
if (parser.seen('W')) fwretract.swap_retract_recover_length = parser.value_axis_units(E_AXIS);
}
/**
* M209: Enable automatic retract (M209 S1)
* For slicers that don't support G10/11, reversed extrude-only
* moves will be classified as retraction.
*/
void GcodeSuite::M209() {
if (MIN_AUTORETRACT <= MAX_AUTORETRACT) {
if (parser.seen('S')) {
fwretract.autoretract_enabled = parser.value_bool();
for (uint8_t i = 0; i < EXTRUDERS; i++) fwretract.retracted[i] = false;
}
}
}
#endif // FWRETRACT

45
Marlin/src/gcode/feature/fwretract/M207.cpp

@ -1,45 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(FWRETRACT)
#include "../../../feature/fwretract.h"
#include "../../gcode.h"
/**
* M207: Set firmware retraction values
*
* S[+units] retract_length
* W[+units] swap_retract_length (multi-extruder)
* F[units/min] retract_feedrate_mm_s
* Z[units] retract_zlift
*/
void GcodeSuite::M207() {
if (parser.seen('S')) fwretract.retract_length = parser.value_axis_units(E_AXIS);
if (parser.seen('F')) fwretract.retract_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
if (parser.seen('Z')) fwretract.retract_zlift = parser.value_linear_units();
if (parser.seen('W')) fwretract.swap_retract_length = parser.value_axis_units(E_AXIS);
}
#endif // FWRETRACT

44
Marlin/src/gcode/feature/fwretract/M209.cpp

@ -1,44 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(FWRETRACT)
#include "../../../feature/fwretract.h"
#include "../../gcode.h"
/**
* M209: Enable automatic retract (M209 S1)
* For slicers that don't support G10/11, reversed extrude-only
* moves will be classified as retraction.
*/
void GcodeSuite::M209() {
if (MIN_AUTORETRACT <= MAX_AUTORETRACT) {
if (parser.seen('S')) {
fwretract.autoretract_enabled = parser.value_bool();
for (uint8_t i = 0; i < EXTRUDERS; i++) fwretract.retracted[i] = false;
}
}
}
#endif // FWRETRACT

38
Marlin/src/gcode/feature/mixing/M163.cpp → Marlin/src/gcode/feature/mixing/M163-M165.cpp

@ -44,4 +44,42 @@ void GcodeSuite::M163() {
}
}
#if MIXING_VIRTUAL_TOOLS > 1
/**
* M164: Store the current mix factors as a virtual tool.
*
* S[index] The virtual tool to store
*
*/
void GcodeSuite::M164() {
const int tool_index = parser.intval('S');
if (tool_index < MIXING_VIRTUAL_TOOLS) {
normalize_mix();
for (uint8_t i = 0; i < MIXING_STEPPERS; i++)
mixing_virtual_tool_mix[tool_index][i] = mixing_factor[i];
}
}
#endif // MIXING_VIRTUAL_TOOLS > 1
#if ENABLED(DIRECT_MIXING_IN_G1)
/**
* M165: Set multiple mix factors for a mixing extruder.
* Factors that are left out will be set to 0.
* All factors together must add up to 1.0.
*
* A[factor] Mix factor for extruder stepper 1
* B[factor] Mix factor for extruder stepper 2
* C[factor] Mix factor for extruder stepper 3
* D[factor] Mix factor for extruder stepper 4
* H[factor] Mix factor for extruder stepper 5
* I[factor] Mix factor for extruder stepper 6
*
*/
void GcodeSuite::M165() { gcode_get_mix(); }
#endif // DIRECT_MIXING_IN_G1
#endif // MIXING_EXTRUDER

45
Marlin/src/gcode/feature/mixing/M164.cpp

@ -1,45 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1
#include "../../gcode.h"
#include "../../../feature/mixing.h"
/**
* M164: Store the current mix factors as a virtual tool.
*
* S[index] The virtual tool to store
*
*/
void GcodeSuite::M164() {
const int tool_index = parser.intval('S');
if (tool_index < MIXING_VIRTUAL_TOOLS) {
normalize_mix();
for (uint8_t i = 0; i < MIXING_STEPPERS; i++)
mixing_virtual_tool_mix[tool_index][i] = mixing_factor[i];
}
}
#endif // MIXING_EXTRUDER && MIXING_VIRTUAL_TOOLS > 1

45
Marlin/src/gcode/feature/mixing/M165.cpp

@ -1,45 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(DIRECT_MIXING_IN_G1)
#include "../../gcode.h"
#include "../../../feature/mixing.h"
/**
* M165: Set multiple mix factors for a mixing extruder.
* Factors that are left out will be set to 0.
* All factors together must add up to 1.0.
*
* A[factor] Mix factor for extruder stepper 1
* B[factor] Mix factor for extruder stepper 2
* C[factor] Mix factor for extruder stepper 3
* D[factor] Mix factor for extruder stepper 4
* H[factor] Mix factor for extruder stepper 5
* I[factor] Mix factor for extruder stepper 6
*
*/
void GcodeSuite::M165() { gcode_get_mix(); }
#endif // DIRECT_MIXING_IN_G1

155
Marlin/src/gcode/feature/trinamic/M911-M914.cpp

@ -0,0 +1,155 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(HAVE_TMC2130)
#include "../../gcode.h"
#include "../../../feature/tmc2130.h"
#include "../../../module/stepper_indirection.h"
inline void tmc2130_report_otpw(TMC2130Stepper &st, const char name) {
SERIAL_CHAR(name);
SERIAL_ECHOPGM(" axis temperature prewarn triggered: ");
serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false"));
SERIAL_EOL();
}
/**
* M911: Report TMC2130 stepper driver overtemperature pre-warn flag
* The flag is held by the library and persist until manually cleared by M912
*/
void GcodeSuite::M911() {
const bool reportX = parser.seen('X'), reportY = parser.seen('Y'), reportZ = parser.seen('Z'), reportE = parser.seen('E'),
reportAll = (!reportX && !reportY && !reportZ && !reportE) || (reportX && reportY && reportZ && reportE);
#if ENABLED(X_IS_TMC2130)
if (reportX || reportAll) tmc2130_report_otpw(stepperX, 'X');
#endif
#if ENABLED(Y_IS_TMC2130)
if (reportY || reportAll) tmc2130_report_otpw(stepperY, 'Y');
#endif
#if ENABLED(Z_IS_TMC2130)
if (reportZ || reportAll) tmc2130_report_otpw(stepperZ, 'Z');
#endif
#if ENABLED(E0_IS_TMC2130)
if (reportE || reportAll) tmc2130_report_otpw(stepperE0, 'E');
#endif
}
inline void tmc2130_clear_otpw(TMC2130Stepper &st, const char name) {
st.clear_otpw();
SERIAL_CHAR(name);
SERIAL_ECHOLNPGM(" prewarn flag cleared");
}
/**
* M912: Clear TMC2130 stepper driver overtemperature pre-warn flag held by the library
*/
void GcodeSuite::M912() {
const bool clearX = parser.seen('X'), clearY = parser.seen('Y'), clearZ = parser.seen('Z'), clearE = parser.seen('E'),
clearAll = (!clearX && !clearY && !clearZ && !clearE) || (clearX && clearY && clearZ && clearE);
#if ENABLED(X_IS_TMC2130)
if (clearX || clearAll) tmc2130_clear_otpw(stepperX, 'X');
#endif
#if ENABLED(Y_IS_TMC2130)
if (clearY || clearAll) tmc2130_clear_otpw(stepperY, 'Y');
#endif
#if ENABLED(Z_IS_TMC2130)
if (clearZ || clearAll) tmc2130_clear_otpw(stepperZ, 'Z');
#endif
#if ENABLED(E0_IS_TMC2130)
if (clearE || clearAll) tmc2130_clear_otpw(stepperE0, 'E');
#endif
}
#if ENABLED(HYBRID_THRESHOLD)
#include "../../../module/planner.h"
inline void tmc2130_get_pwmthrs(TMC2130Stepper &st, const char name, const uint16_t spmm) {
SERIAL_CHAR(name);
SERIAL_ECHOPGM(" stealthChop max speed set to ");
SERIAL_ECHOLN(12650000UL * st.microsteps() / (256 * st.stealth_max_speed() * spmm));
}
inline void tmc2130_set_pwmthrs(TMC2130Stepper &st, const char name, const int32_t thrs, const uint32_t spmm) {
st.stealth_max_speed(12650000UL * st.microsteps() / (256 * thrs * spmm));
tmc2130_get_pwmthrs(st, name, spmm);
}
/**
* M913: Set HYBRID_THRESHOLD speed.
*/
void GcodeSuite::M913() {
uint16_t values[XYZE];
LOOP_XYZE(i)
values[i] = parser.intval(axis_codes[i]);
#if ENABLED(X_IS_TMC2130)
if (values[X_AXIS]) tmc2130_set_pwmthrs(stepperX, 'X', values[X_AXIS], planner.axis_steps_per_mm[X_AXIS]);
else tmc2130_get_pwmthrs(stepperX, 'X', planner.axis_steps_per_mm[X_AXIS]);
#endif
#if ENABLED(Y_IS_TMC2130)
if (values[Y_AXIS]) tmc2130_set_pwmthrs(stepperY, 'Y', values[Y_AXIS], planner.axis_steps_per_mm[Y_AXIS]);
else tmc2130_get_pwmthrs(stepperY, 'Y', planner.axis_steps_per_mm[Y_AXIS]);
#endif
#if ENABLED(Z_IS_TMC2130)
if (values[Z_AXIS]) tmc2130_set_pwmthrs(stepperZ, 'Z', values[Z_AXIS], planner.axis_steps_per_mm[Z_AXIS]);
else tmc2130_get_pwmthrs(stepperZ, 'Z', planner.axis_steps_per_mm[Z_AXIS]);
#endif
#if ENABLED(E0_IS_TMC2130)
if (values[E_AXIS]) tmc2130_set_pwmthrs(stepperE0, 'E', values[E_AXIS], planner.axis_steps_per_mm[E_AXIS]);
else tmc2130_get_pwmthrs(stepperE0, 'E', planner.axis_steps_per_mm[E_AXIS]);
#endif
}
#endif // HYBRID_THRESHOLD
#if ENABLED(SENSORLESS_HOMING)
inline void tmc2130_get_sgt(TMC2130Stepper &st, const char name) {
SERIAL_CHAR(name);
SERIAL_ECHOPGM(" driver homing sensitivity set to ");
SERIAL_ECHOLN(st.sgt());
}
inline void tmc2130_set_sgt(TMC2130Stepper &st, const char name, const int8_t sgt_val) {
st.sgt(sgt_val);
tmc2130_get_sgt(st, name);
}
/**
* M914: Set SENSORLESS_HOMING sensitivity.
*/
void GcodeSuite::M914() {
#if ENABLED(X_IS_TMC2130)
if (parser.seen(axis_codes[X_AXIS])) tmc2130_set_sgt(stepperX, 'X', parser.value_int());
else tmc2130_get_sgt(stepperX, 'X');
#endif
#if ENABLED(Y_IS_TMC2130)
if (parser.seen(axis_codes[Y_AXIS])) tmc2130_set_sgt(stepperY, 'Y', parser.value_int());
else tmc2130_get_sgt(stepperY, 'Y');
#endif
}
#endif // SENSORLESS_HOMING
#endif // HAVE_TMC2130

59
Marlin/src/gcode/feature/trinamic/M911.cpp

@ -1,59 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(HAVE_TMC2130)
#include "../../gcode.h"
#include "../../../feature/tmc2130.h"
#include "../../../module/stepper_indirection.h"
inline void tmc2130_report_otpw(TMC2130Stepper &st, const char name) {
SERIAL_CHAR(name);
SERIAL_ECHOPGM(" axis temperature prewarn triggered: ");
serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false"));
SERIAL_EOL();
}
/**
* M911: Report TMC2130 stepper driver overtemperature pre-warn flag
* The flag is held by the library and persist until manually cleared by M912
*/
void GcodeSuite::M911() {
const bool reportX = parser.seen('X'), reportY = parser.seen('Y'), reportZ = parser.seen('Z'), reportE = parser.seen('E'),
reportAll = (!reportX && !reportY && !reportZ && !reportE) || (reportX && reportY && reportZ && reportE);
#if ENABLED(X_IS_TMC2130)
if (reportX || reportAll) tmc2130_report_otpw(stepperX, 'X');
#endif
#if ENABLED(Y_IS_TMC2130)
if (reportY || reportAll) tmc2130_report_otpw(stepperY, 'Y');
#endif
#if ENABLED(Z_IS_TMC2130)
if (reportZ || reportAll) tmc2130_report_otpw(stepperZ, 'Z');
#endif
#if ENABLED(E0_IS_TMC2130)
if (reportE || reportAll) tmc2130_report_otpw(stepperE0, 'E');
#endif
}
#endif // HAVE_TMC2130

57
Marlin/src/gcode/feature/trinamic/M912.cpp

@ -1,57 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(HAVE_TMC2130)
#include "../../gcode.h"
#include "../../../feature/tmc2130.h"
#include "../../../module/stepper_indirection.h"
inline void tmc2130_clear_otpw(TMC2130Stepper &st, const char name) {
st.clear_otpw();
SERIAL_CHAR(name);
SERIAL_ECHOLNPGM(" prewarn flag cleared");
}
/**
* M912: Clear TMC2130 stepper driver overtemperature pre-warn flag held by the library
*/
void GcodeSuite::M912() {
const bool clearX = parser.seen('X'), clearY = parser.seen('Y'), clearZ = parser.seen('Z'), clearE = parser.seen('E'),
clearAll = (!clearX && !clearY && !clearZ && !clearE) || (clearX && clearY && clearZ && clearE);
#if ENABLED(X_IS_TMC2130)
if (clearX || clearAll) tmc2130_clear_otpw(stepperX, 'X');
#endif
#if ENABLED(Y_IS_TMC2130)
if (clearY || clearAll) tmc2130_clear_otpw(stepperY, 'Y');
#endif
#if ENABLED(Z_IS_TMC2130)
if (clearZ || clearAll) tmc2130_clear_otpw(stepperZ, 'Z');
#endif
#if ENABLED(E0_IS_TMC2130)
if (clearE || clearAll) tmc2130_clear_otpw(stepperE0, 'E');
#endif
}
#endif // HAVE_TMC2130

68
Marlin/src/gcode/feature/trinamic/M913.cpp

@ -1,68 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(HAVE_TMC2130) && ENABLED(HYBRID_THRESHOLD)
#include "../../gcode.h"
#include "../../../feature/tmc2130.h"
#include "../../../module/planner.h"
#include "../../../module/stepper_indirection.h"
inline void tmc2130_get_pwmthrs(TMC2130Stepper &st, const char name, const uint16_t spmm) {
SERIAL_CHAR(name);
SERIAL_ECHOPGM(" stealthChop max speed set to ");
SERIAL_ECHOLN(12650000UL * st.microsteps() / (256 * st.stealth_max_speed() * spmm));
}
inline void tmc2130_set_pwmthrs(TMC2130Stepper &st, const char name, const int32_t thrs, const uint32_t spmm) {
st.stealth_max_speed(12650000UL * st.microsteps() / (256 * thrs * spmm));
tmc2130_get_pwmthrs(st, name, spmm);
}
/**
* M913: Set HYBRID_THRESHOLD speed.
*/
void GcodeSuite::M913() {
uint16_t values[XYZE];
LOOP_XYZE(i)
values[i] = parser.intval(axis_codes[i]);
#if ENABLED(X_IS_TMC2130)
if (values[X_AXIS]) tmc2130_set_pwmthrs(stepperX, 'X', values[X_AXIS], planner.axis_steps_per_mm[X_AXIS]);
else tmc2130_get_pwmthrs(stepperX, 'X', planner.axis_steps_per_mm[X_AXIS]);
#endif
#if ENABLED(Y_IS_TMC2130)
if (values[Y_AXIS]) tmc2130_set_pwmthrs(stepperY, 'Y', values[Y_AXIS], planner.axis_steps_per_mm[Y_AXIS]);
else tmc2130_get_pwmthrs(stepperY, 'Y', planner.axis_steps_per_mm[Y_AXIS]);
#endif
#if ENABLED(Z_IS_TMC2130)
if (values[Z_AXIS]) tmc2130_set_pwmthrs(stepperZ, 'Z', values[Z_AXIS], planner.axis_steps_per_mm[Z_AXIS]);
else tmc2130_get_pwmthrs(stepperZ, 'Z', planner.axis_steps_per_mm[Z_AXIS]);
#endif
#if ENABLED(E0_IS_TMC2130)
if (values[E_AXIS]) tmc2130_set_pwmthrs(stepperE0, 'E', values[E_AXIS], planner.axis_steps_per_mm[E_AXIS]);
else tmc2130_get_pwmthrs(stepperE0, 'E', planner.axis_steps_per_mm[E_AXIS]);
#endif
}
#endif // HAVE_TMC2130 && HYBRID_THRESHOLD

55
Marlin/src/gcode/feature/trinamic/M914.cpp

@ -1,55 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(HAVE_TMC2130) && ENABLED(SENSORLESS_HOMING)
#include "../../gcode.h"
#include "../../../feature/tmc2130.h"
#include "../../../module/stepper_indirection.h"
inline void tmc2130_get_sgt(TMC2130Stepper &st, const char name) {
SERIAL_CHAR(name);
SERIAL_ECHOPGM(" driver homing sensitivity set to ");
SERIAL_ECHOLN(st.sgt());
}
inline void tmc2130_set_sgt(TMC2130Stepper &st, const char name, const int8_t sgt_val) {
st.sgt(sgt_val);
tmc2130_get_sgt(st, name);
}
/**
* M914: Set SENSORLESS_HOMING sensitivity.
*/
void GcodeSuite::M914() {
#if ENABLED(X_IS_TMC2130)
if (parser.seen(axis_codes[X_AXIS])) tmc2130_set_sgt(stepperX, 'X', parser.value_int());
else tmc2130_get_sgt(stepperX, 'X');
#endif
#if ENABLED(Y_IS_TMC2130)
if (parser.seen(axis_codes[Y_AXIS])) tmc2130_set_sgt(stepperY, 'Y', parser.value_int());
else tmc2130_get_sgt(stepperY, 'Y');
#endif
}
#endif // HAVE_TMC2130 && SENSORLESS_HOMING

15
Marlin/src/gcode/gcode.cpp

@ -636,13 +636,14 @@ void GcodeSuite::process_next_command() {
case 900: M900(); break; // M900: Set advance K factor.
#endif
case 907: M907(); break; // M907: Set digital trimpot motor current using axis codes.
#if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT)
case 908: M908(); break; // M908: Control digital trimpot directly.
#if ENABLED(DAC_STEPPER_CURRENT) // As with Printrbot RevF
case 909: M909(); break; // M909: Print digipot/DAC current value
case 910: M910(); break; // M910: Commit digipot/DAC value to external EEPROM
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || ENABLED(DIGIPOT_I2C) || ENABLED(DAC_STEPPER_CURRENT)
case 907: M907(); break; // M907: Set digital trimpot motor current using axis codes.
#if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT)
case 908: M908(); break; // M908: Control digital trimpot directly.
#if ENABLED(DAC_STEPPER_CURRENT) // As with Printrbot RevF
case 909: M909(); break; // M909: Print digipot/DAC current value
case 910: M910(); break; // M910: Commit digipot/DAC value to external EEPROM
#endif
#endif
#endif

15
Marlin/src/gcode/gcode.h

@ -706,13 +706,14 @@ private:
#endif
#endif
static void M907();
#if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT)
static void M908();
#if ENABLED(DAC_STEPPER_CURRENT)
static void M909();
static void M910();
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || ENABLED(DIGIPOT_I2C) || ENABLED(DAC_STEPPER_CURRENT)
static void M907();
#if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT)
static void M908();
#if ENABLED(DAC_STEPPER_CURRENT)
static void M909();
static void M910();
#endif
#endif
#endif

51
Marlin/src/gcode/geometry/M206.cpp

@ -1,51 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if HAS_M206_COMMAND
#include "../gcode.h"
#include "../../module/motion.h"
/**
* M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
*
* *** @thinkyhead: I recommend deprecating M206 for SCARA in favor of M665.
* *** M206 for SCARA will remain enabled in 1.1.x for compatibility.
* *** In the 2.0 release, it will simply be disabled by default.
*/
void GcodeSuite::M206() {
LOOP_XYZ(i)
if (parser.seen(axis_codes[i]))
set_home_offset((AxisEnum)i, parser.value_linear_units());
#if ENABLED(MORGAN_SCARA)
if (parser.seen('T')) set_home_offset(A_AXIS, parser.value_linear_units()); // Theta
if (parser.seen('P')) set_home_offset(B_AXIS, parser.value_linear_units()); // Psi
#endif
SYNC_PLAN_POSITION_KINEMATIC();
report_current_position();
}
#endif // HAS_M206_COMMAND

21
Marlin/src/gcode/geometry/M428.cpp → Marlin/src/gcode/geometry/M206_M428.cpp

@ -30,6 +30,27 @@
#include "../../libs/buzzer.h"
#include "../../Marlin.h" // for axis_homed
/**
* M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
*
* *** @thinkyhead: I recommend deprecating M206 for SCARA in favor of M665.
* *** M206 for SCARA will remain enabled in 1.1.x for compatibility.
* *** In the 2.0 release, it will simply be disabled by default.
*/
void GcodeSuite::M206() {
LOOP_XYZ(i)
if (parser.seen(axis_codes[i]))
set_home_offset((AxisEnum)i, parser.value_linear_units());
#if ENABLED(MORGAN_SCARA)
if (parser.seen('T')) set_home_offset(A_AXIS, parser.value_linear_units()); // Theta
if (parser.seen('P')) set_home_offset(B_AXIS, parser.value_linear_units()); // Psi
#endif
SYNC_PLAN_POSITION_KINEMATIC();
report_current_position();
}
/**
* M428: Set home_offset based on the distance between the
* current_position and the nearest "reference point."

191
Marlin/src/gcode/sdcard/M20-M30_M32-M34_M928.cpp

@ -0,0 +1,191 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT)
#include "../gcode.h"
#include "../../sd/cardreader.h"
#include "../../module/printcounter.h"
#include "../../module/stepper.h"
#if ENABLED(PARK_HEAD_ON_PAUSE)
#include "../../feature/pause.h"
#include "../queue.h"
#endif
/**
* M20: List SD card to serial output
*/
void GcodeSuite::M20() {
SERIAL_PROTOCOLLNPGM(MSG_BEGIN_FILE_LIST);
card.ls();
SERIAL_PROTOCOLLNPGM(MSG_END_FILE_LIST);
}
/**
* M21: Init SD Card
*/
void GcodeSuite::M21() { card.initsd(); }
/**
* M22: Release SD Card
*/
void GcodeSuite::M22() { card.release(); }
/**
* M23: Open a file
*/
void GcodeSuite::M23() {
// Simplify3D includes the size, so zero out all spaces (#7227)
for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
card.openFile(parser.string_arg, true);
}
/**
* M24: Start or Resume SD Print
*/
void GcodeSuite::M24() {
#if ENABLED(PARK_HEAD_ON_PAUSE)
resume_print();
#endif
card.startFileprint();
print_job_timer.start();
}
/**
* M25: Pause SD Print
*/
void GcodeSuite::M25() {
card.pauseSDPrint();
print_job_timer.pause();
#if ENABLED(PARK_HEAD_ON_PAUSE)
enqueue_and_echo_commands_P(PSTR("M125")); // Must be enqueued with pauseSDPrint set to be last in the buffer
#endif
}
/**
* M26: Set SD Card file index
*/
void GcodeSuite::M26() {
if (card.cardOK && parser.seenval('S'))
card.setIndex(parser.value_long());
}
/**
* M27: Get SD Card status
*/
void GcodeSuite::M27() { card.getStatus(); }
/**
* M28: Start SD Write
*/
void GcodeSuite::M28() { card.openFile(parser.string_arg, false); }
/**
* M29: Stop SD Write
* Processed in write to file routine
*/
void GcodeSuite::M29() {
// card.saving = false;
}
/**
* M30 <filename>: Delete SD Card file
*/
void GcodeSuite::M30() {
if (card.cardOK) {
card.closefile();
card.removeFile(parser.string_arg);
}
}
/**
* M32: Select file and start SD Print
*/
void GcodeSuite::M32() {
if (IS_SD_PRINTING)
stepper.synchronize();
char* namestartpos = parser.string_arg;
const bool call_procedure = parser.boolval('P');
if (card.cardOK) {
card.openFile(namestartpos, true, call_procedure);
if (parser.seenval('S'))
card.setIndex(parser.value_long());
card.startFileprint();
// Procedure calls count as normal print time.
if (!call_procedure) print_job_timer.start();
}
}
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
/**
* M33: Get the long full path of a file or folder
*
* Parameters:
* <dospath> Case-insensitive DOS-style path to a file or folder
*
* Example:
* M33 miscel~1/armchair/armcha~1.gco
*
* Output:
* /Miscellaneous/Armchair/Armchair.gcode
*/
void GcodeSuite::M33() {
card.printLongPath(parser.string_arg);
}
#endif // LONG_FILENAME_HOST_SUPPORT
#if ENABLED(SDCARD_SORT_ALPHA) && ENABLED(SDSORT_GCODE)
/**
* M34: Set SD Card Sorting Options
*/
void GcodeSuite::M34() {
if (parser.seen('S')) card.setSortOn(parser.value_bool());
if (parser.seenval('F')) {
const int v = parser.value_long();
card.setSortFolders(v < 0 ? -1 : v > 0 ? 1 : 0);
}
//if (parser.seen('R')) card.setSortReverse(parser.value_bool());
}
#endif // SDCARD_SORT_ALPHA && SDSORT_GCODE
/**
* M928: Start SD Write
*/
void GcodeSuite::M928() {
card.openLogFile(parser.string_arg);
}
#endif // SDSUPPORT

39
Marlin/src/gcode/sdcard/M20.cpp

@ -1,39 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT)
#include "../gcode.h"
#include "../../sd/cardreader.h"
/**
* M20: List SD card to serial output
*/
void GcodeSuite::M20() {
SERIAL_PROTOCOLLNPGM(MSG_BEGIN_FILE_LIST);
card.ls();
SERIAL_PROTOCOLLNPGM(MSG_END_FILE_LIST);
}
#endif // SDSUPPORT

35
Marlin/src/gcode/sdcard/M21.cpp

@ -1,35 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT)
#include "../gcode.h"
#include "../../sd/cardreader.h"
/**
* M21: Init SD Card
*/
void GcodeSuite::M21() { card.initsd(); }
#endif // SDSUPPORT

35
Marlin/src/gcode/sdcard/M22.cpp

@ -1,35 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT)
#include "../gcode.h"
#include "../../sd/cardreader.h"
/**
* M22: Release SD Card
*/
void GcodeSuite::M22() { card.release(); }
#endif // SDSUPPORT

39
Marlin/src/gcode/sdcard/M23.cpp

@ -1,39 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT)
#include "../gcode.h"
#include "../../sd/cardreader.h"
/**
* M23: Open a file
*/
void GcodeSuite::M23() {
// Simplify3D includes the size, so zero out all spaces (#7227)
for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
card.openFile(parser.string_arg, true);
}
#endif // SDSUPPORT

47
Marlin/src/gcode/sdcard/M24.cpp

@ -1,47 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT)
#include "../gcode.h"
#include "../../sd/cardreader.h"
#include "../../module/printcounter.h"
#if ENABLED(PARK_HEAD_ON_PAUSE)
#include "../../feature/pause.h"
#endif
/**
* M24: Start or Resume SD Print
*/
void GcodeSuite::M24() {
#if ENABLED(PARK_HEAD_ON_PAUSE)
resume_print();
#endif
card.startFileprint();
print_job_timer.start();
}
#endif // SDSUPPORT

47
Marlin/src/gcode/sdcard/M25.cpp

@ -1,47 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT)
#include "../gcode.h"
#include "../../sd/cardreader.h"
#include "../../module/printcounter.h"
#if ENABLED(PARK_HEAD_ON_PAUSE)
#include "../queue.h"
#endif
/**
* M25: Pause SD Print
*/
void GcodeSuite::M25() {
card.pauseSDPrint();
print_job_timer.pause();
#if ENABLED(PARK_HEAD_ON_PAUSE)
enqueue_and_echo_commands_P(PSTR("M125")); // Must be enqueued with pauseSDPrint set to be last in the buffer
#endif
}
#endif // SDSUPPORT

38
Marlin/src/gcode/sdcard/M26.cpp

@ -1,38 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT)
#include "../gcode.h"
#include "../../sd/cardreader.h"
/**
* M26: Set SD Card file index
*/
void GcodeSuite::M26() {
if (card.cardOK && parser.seenval('S'))
card.setIndex(parser.value_long());
}
#endif // SDSUPPORT

35
Marlin/src/gcode/sdcard/M27.cpp

@ -1,35 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT)
#include "../gcode.h"
#include "../../sd/cardreader.h"
/**
* M27: Get SD Card status
*/
void GcodeSuite::M27() { card.getStatus(); }
#endif // SDSUPPORT

35
Marlin/src/gcode/sdcard/M28.cpp

@ -1,35 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT)
#include "../gcode.h"
#include "../../sd/cardreader.h"
/**
* M28: Start SD Write
*/
void GcodeSuite::M28() { card.openFile(parser.string_arg, false); }
#endif // SDSUPPORT

38
Marlin/src/gcode/sdcard/M29.cpp

@ -1,38 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT)
#include "../gcode.h"
#include "../../sd/cardreader.h"
/**
* M29: Stop SD Write
* Processed in write to file routine above
*/
void GcodeSuite::M29() {
// card.saving = false;
}
#endif // SDSUPPORT

40
Marlin/src/gcode/sdcard/M30.cpp

@ -1,40 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT)
#include "../gcode.h"
#include "../../sd/cardreader.h"
/**
* M30 <filename>: Delete SD Card file
*/
void GcodeSuite::M30() {
if (card.cardOK) {
card.closefile();
card.removeFile(parser.string_arg);
}
}
#endif // SDSUPPORT

55
Marlin/src/gcode/sdcard/M32.cpp

@ -1,55 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT)
#include "../gcode.h"
#include "../../sd/cardreader.h"
#include "../../module/stepper.h"
#include "../../module/printcounter.h"
/**
* M32: Select file and start SD Print
*/
void GcodeSuite::M32() {
if (IS_SD_PRINTING)
stepper.synchronize();
char* namestartpos = parser.string_arg;
const bool call_procedure = parser.boolval('P');
if (card.cardOK) {
card.openFile(namestartpos, true, call_procedure);
if (parser.seenval('S'))
card.setIndex(parser.value_long());
card.startFileprint();
// Procedure calls count as normal print time.
if (!call_procedure) print_job_timer.start();
}
}
#endif // SDSUPPORT

46
Marlin/src/gcode/sdcard/M33.cpp

@ -1,46 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT) && ENABLED(LONG_FILENAME_HOST_SUPPORT)
#include "../gcode.h"
#include "../../sd/cardreader.h"
/**
* M33: Get the long full path of a file or folder
*
* Parameters:
* <dospath> Case-insensitive DOS-style path to a file or folder
*
* Example:
* M33 miscel~1/armchair/armcha~1.gco
*
* Output:
* /Miscellaneous/Armchair/Armchair.gcode
*/
void GcodeSuite::M33() {
card.printLongPath(parser.string_arg);
}
#endif // SDSUPPORT && LONG_FILENAME_HOST_SUPPORT

42
Marlin/src/gcode/sdcard/M34.cpp

@ -1,42 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT) && ENABLED(SDCARD_SORT_ALPHA) && ENABLED(SDSORT_GCODE)
#include "../gcode.h"
#include "../../sd/cardreader.h"
/**
* M34: Set SD Card Sorting Options
*/
void GcodeSuite::M34() {
if (parser.seen('S')) card.setSortOn(parser.value_bool());
if (parser.seenval('F')) {
const int v = parser.value_long();
card.setSortFolders(v < 0 ? -1 : v > 0 ? 1 : 0);
}
//if (parser.seen('R')) card.setSortReverse(parser.value_bool());
}
#endif // SDSUPPORT && SDCARD_SORT_ALPHA && SDSORT_GCODE

37
Marlin/src/gcode/sdcard/M928.cpp

@ -1,37 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(SDSUPPORT)
#include "../gcode.h"
#include "../../sd/cardreader.h"
/**
* M928: Start SD Write
*/
void GcodeSuite::M928() {
card.openLogFile(parser.string_arg);
}
#endif // SDSUPPORT

39
Marlin/src/gcode/stats/M75-M77.cpp

@ -1,39 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../gcode.h"
#include "../../module/printcounter.h"
/**
* M75: Start print timer
*/
void GcodeSuite::M75() { print_job_timer.start(); }
/**
* M76: Pause print timer
*/
void GcodeSuite::M76() { print_job_timer.pause(); }
/**
* M77: Stop print timer
*/
void GcodeSuite::M77() { print_job_timer.stop(); }

21
Marlin/src/gcode/stats/M78.cpp → Marlin/src/gcode/stats/M75-M78.cpp

@ -20,13 +20,26 @@
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(PRINTCOUNTER)
#include "../gcode.h"
#include "../../module/printcounter.h"
/**
* M75: Start print timer
*/
void GcodeSuite::M75() { print_job_timer.start(); }
/**
* M76: Pause print timer
*/
void GcodeSuite::M76() { print_job_timer.pause(); }
/**
* M77: Stop print timer
*/
void GcodeSuite::M77() { print_job_timer.stop(); }
#if ENABLED(PRINTCOUNTER)
/**
* M78: Show print statistics
*/

75
Marlin/src/gcode/temperature/M104.cpp

@ -1,75 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../gcode.h"
#include "../../module/temperature.h"
#include "../../module/motion.h"
#include "../../module/planner.h"
#include "../../lcd/ultralcd.h"
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
#include "../../module/printcounter.h"
#endif
/**
* M104: Set hot end temperature
*/
void GcodeSuite::M104() {
if (get_target_extruder_from_command()) return;
if (DEBUGGING(DRYRUN)) return;
const uint8_t e = target_extruder;
#if ENABLED(SINGLENOZZLE)
if (e != active_extruder) return;
#endif
if (parser.seenval('S')) {
const int16_t temp = parser.value_celsius();
thermalManager.setTargetHotend(temp, e);
#if ENABLED(DUAL_X_CARRIAGE)
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && e == 0)
thermalManager.setTargetHotend(temp ? temp + duplicate_extruder_temp_offset : 0, 1);
#endif
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
/**
* Stop the timer at the end of print. Start is managed by 'heat and wait' M109.
* We use half EXTRUDE_MINTEMP here to allow nozzles to be put into hot
* standby mode, for instance in a dual extruder setup, without affecting
* the running print timer.
*/
if (parser.value_celsius() <= (EXTRUDE_MINTEMP) / 2) {
print_job_timer.stop();
LCD_MESSAGEPGM(WELCOME_MSG);
}
#endif
if (parser.value_celsius() > thermalManager.degHotend(e))
lcd_status_printf_P(0, PSTR("E%i %s"), e + 1, MSG_HEATING);
}
#if ENABLED(AUTOTEMP)
planner.autotemp_M104_M109();
#endif
}

49
Marlin/src/gcode/temperature/M109.cpp → Marlin/src/gcode/temperature/M104_M109.cpp

@ -22,6 +22,7 @@
#include "../gcode.h"
#include "../../module/temperature.h"
#include "../../module/motion.h"
#include "../../module/planner.h"
#include "../../lcd/ultralcd.h"
#include "../../Marlin.h"
@ -30,14 +31,54 @@
#include "../../module/printcounter.h"
#endif
#if ENABLED(DUAL_X_CARRIAGE)
#include "../../module/motion.h"
#endif
#if HAS_COLOR_LEDS
#include "../../feature/leds/leds.h"
#endif
/**
* M104: Set hot end temperature
*/
void GcodeSuite::M104() {
if (get_target_extruder_from_command()) return;
if (DEBUGGING(DRYRUN)) return;
const uint8_t e = target_extruder;
#if ENABLED(SINGLENOZZLE)
if (e != active_extruder) return;
#endif
if (parser.seenval('S')) {
const int16_t temp = parser.value_celsius();
thermalManager.setTargetHotend(temp, e);
#if ENABLED(DUAL_X_CARRIAGE)
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && e == 0)
thermalManager.setTargetHotend(temp ? temp + duplicate_extruder_temp_offset : 0, 1);
#endif
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
/**
* Stop the timer at the end of print. Start is managed by 'heat and wait' M109.
* We use half EXTRUDE_MINTEMP here to allow nozzles to be put into hot
* standby mode, for instance in a dual extruder setup, without affecting
* the running print timer.
*/
if (parser.value_celsius() <= (EXTRUDE_MINTEMP) / 2) {
print_job_timer.stop();
LCD_MESSAGEPGM(WELCOME_MSG);
}
#endif
if (parser.value_celsius() > thermalManager.degHotend(e))
lcd_status_printf_P(0, PSTR("E%i %s"), e + 1, MSG_HEATING);
}
#if ENABLED(AUTOTEMP)
planner.autotemp_M104_M109();
#endif
}
/**
* M109: Sxxx Wait for extruder(s) to reach temperature. Waits only when heating.
* Rxxx Wait for extruder(s) to reach temperature. Waits when heating and cooling.

38
Marlin/src/gcode/temperature/M140.cpp

@ -1,38 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if HAS_HEATER_BED && HAS_TEMP_BED
#include "../gcode.h"
#include "../../module/temperature.h"
/**
* M140: Set bed temperature
*/
void GcodeSuite::M140() {
if (DEBUGGING(DRYRUN)) return;
if (parser.seenval('S')) thermalManager.setTargetBed(parser.value_celsius());
}
#endif // HAS_HEATER_BED && HAS_TEMP_BED

10
Marlin/src/gcode/temperature/M190.cpp → Marlin/src/gcode/temperature/M140_M190.cpp

@ -25,8 +25,8 @@
#if HAS_HEATER_BED && HAS_TEMP_BED
#include "../gcode.h"
#include "../../module/motion.h"
#include "../../module/temperature.h"
#include "../../module/motion.h"
#include "../../lcd/ultralcd.h"
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
@ -39,6 +39,14 @@
#include "../../Marlin.h" // for wait_for_heatup and idle()
/**
* M140: Set bed temperature
*/
void GcodeSuite::M140() {
if (DEBUGGING(DRYRUN)) return;
if (parser.seenval('S')) thermalManager.setTargetBed(parser.value_celsius());
}
#ifndef MIN_COOLING_SLOPE_DEG_BED
#define MIN_COOLING_SLOPE_DEG_BED 1.50
#endif
Loading…
Cancel
Save