Merge pull request #7719 from thinkyhead/bugfix_refactor_work

[2.0.x] Group G-codes to fix command-line overflow
This commit is contained in:
Scott Lahteine 2017-09-23 19:18:33 -05:00 committed by GitHub
commit 6da97ebdd1
55 changed files with 713 additions and 1726 deletions

View File

@ -24,7 +24,7 @@
#if HAS_CASE_LIGHT #if HAS_CASE_LIGHT
int case_light_brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS; uint8_t case_light_brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS;
bool case_light_on = CASE_LIGHT_DEFAULT_ON; bool case_light_on = CASE_LIGHT_DEFAULT_ON;
#ifndef INVERT_CASE_LIGHT #ifndef INVERT_CASE_LIGHT
@ -33,7 +33,6 @@ bool case_light_on = CASE_LIGHT_DEFAULT_ON;
void update_case_light() { void update_case_light() {
SET_OUTPUT(CASE_LIGHT_PIN); SET_OUTPUT(CASE_LIGHT_PIN);
uint8_t case_light_bright = (uint8_t)case_light_brightness;
if (case_light_on) { if (case_light_on) {
if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) { if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) {
analogWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? 255 - case_light_brightness : case_light_brightness ); analogWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? 255 - case_light_brightness : case_light_brightness );

View File

@ -23,7 +23,7 @@
#ifndef __CASELIGHT_H__ #ifndef __CASELIGHT_H__
#define __CASELIGHT_H__ #define __CASELIGHT_H__
extern int case_light_brightness; // LCD routine wants INT extern uint8_t case_light_brightness;
extern bool case_light_on; extern bool case_light_on;
void update_case_light(); void update_case_light();

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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();
}

View File

@ -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

View File

@ -25,7 +25,21 @@
#if DISABLED(EMERGENCY_PARSER) #if DISABLED(EMERGENCY_PARSER)
#include "../gcode.h" #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 * M410: Quickstop - Abort all planned moves
@ -34,9 +48,7 @@
* will be out of sync with the stepper position after this. * will be out of sync with the stepper position after this.
*/ */
void GcodeSuite::M410() { void GcodeSuite::M410() {
quickstop_stepper(); quickstop_stepper();
} }
#endif // !EMERGENCY_PARSER #endif // !EMERGENCY_PARSER

View File

@ -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

View File

@ -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();
}

View File

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

View File

@ -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" #include "../../gcode.h"
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM #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()); LOOP_XYZE(i) if (parser.seen(axis_codes[i])) dac_current_percent(i, parser.value_float());
#endif #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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -27,6 +27,21 @@
#include "../../../feature/fwretract.h" #include "../../../feature/fwretract.h"
#include "../../gcode.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 * 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); 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 #endif // FWRETRACT

View File

@ -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

View File

@ -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

View File

@ -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 #endif // MIXING_EXTRUDER

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

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

View File

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

View File

@ -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

View File

@ -30,6 +30,27 @@
#include "../../libs/buzzer.h" #include "../../libs/buzzer.h"
#include "../../Marlin.h" // for axis_homed #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 * M428: Set home_offset based on the distance between the
* current_position and the nearest "reference point." * current_position and the nearest "reference point."

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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(); }

View File

@ -20,13 +20,26 @@
* *
*/ */
#include "../../inc/MarlinConfig.h"
#if ENABLED(PRINTCOUNTER)
#include "../gcode.h" #include "../gcode.h"
#include "../../module/printcounter.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 * M78: Show print statistics
*/ */

View File

@ -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
}

View File

@ -22,6 +22,7 @@
#include "../gcode.h" #include "../gcode.h"
#include "../../module/temperature.h" #include "../../module/temperature.h"
#include "../../module/motion.h"
#include "../../module/planner.h" #include "../../module/planner.h"
#include "../../lcd/ultralcd.h" #include "../../lcd/ultralcd.h"
#include "../../Marlin.h" #include "../../Marlin.h"
@ -30,14 +31,54 @@
#include "../../module/printcounter.h" #include "../../module/printcounter.h"
#endif #endif
#if ENABLED(DUAL_X_CARRIAGE)
#include "../../module/motion.h"
#endif
#if HAS_COLOR_LEDS #if HAS_COLOR_LEDS
#include "../../feature/leds/leds.h" #include "../../feature/leds/leds.h"
#endif #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. * 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. * Rxxx Wait for extruder(s) to reach temperature. Waits when heating and cooling.

View File

@ -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

View File

@ -25,8 +25,8 @@
#if HAS_HEATER_BED && HAS_TEMP_BED #if HAS_HEATER_BED && HAS_TEMP_BED
#include "../gcode.h" #include "../gcode.h"
#include "../../module/motion.h"
#include "../../module/temperature.h" #include "../../module/temperature.h"
#include "../../module/motion.h"
#include "../../lcd/ultralcd.h" #include "../../lcd/ultralcd.h"
#if ENABLED(PRINTJOB_TIMER_AUTOSTART) #if ENABLED(PRINTJOB_TIMER_AUTOSTART)
@ -39,6 +39,14 @@
#include "../../Marlin.h" // for wait_for_heatup and idle() #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 #ifndef MIN_COOLING_SLOPE_DEG_BED
#define MIN_COOLING_SLOPE_DEG_BED 1.50 #define MIN_COOLING_SLOPE_DEG_BED 1.50
#endif #endif

View File

@ -761,9 +761,7 @@ void kill_screen(const char* lcd_msg) {
#if ENABLED(MENU_ITEM_CASE_LIGHT) #if ENABLED(MENU_ITEM_CASE_LIGHT)
extern int case_light_brightness; #include "../feature/caselight.h"
extern bool case_light_on;
extern void update_case_light();
void case_light_menu() { void case_light_menu() {
START_MENU(); START_MENU();
@ -771,7 +769,7 @@ void kill_screen(const char* lcd_msg) {
// ^ Main // ^ Main
// //
MENU_BACK(MSG_MAIN); MENU_BACK(MSG_MAIN);
MENU_ITEM_EDIT_CALLBACK(int3, MSG_CASE_LIGHT_BRIGHTNESS, &case_light_brightness, 0, 255, update_case_light, true); MENU_ITEM_EDIT_CALLBACK(int8, MSG_CASE_LIGHT_BRIGHTNESS, &case_light_brightness, 0, 255, update_case_light, true);
MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light); MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light);
END_MENU(); END_MENU();
} }