Initial split-up of G-code handlers by category
This commit is contained in:
30
Marlin/src/gcode/control/M108.h
Normal file
30
Marlin/src/gcode/control/M108.h
Normal file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M108: Stop the waiting for heaters in M109, M190, M303. Does not affect the target temperature.
|
||||
*/
|
||||
void gcode_M108() {
|
||||
|
||||
wait_for_heatup = false;
|
||||
|
||||
}
|
61
Marlin/src/gcode/control/M111.h
Normal file
61
Marlin/src/gcode/control/M111.h
Normal file
@ -0,0 +1,61 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M111: Set the debug level
|
||||
*/
|
||||
void gcode_M111() {
|
||||
if (parser.seen('S')) marlin_debug_flags = parser.byteval('S');
|
||||
|
||||
const static char str_debug_1[] PROGMEM = MSG_DEBUG_ECHO,
|
||||
str_debug_2[] PROGMEM = MSG_DEBUG_INFO,
|
||||
str_debug_4[] PROGMEM = MSG_DEBUG_ERRORS,
|
||||
str_debug_8[] PROGMEM = MSG_DEBUG_DRYRUN,
|
||||
str_debug_16[] PROGMEM = MSG_DEBUG_COMMUNICATION
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
, str_debug_32[] PROGMEM = MSG_DEBUG_LEVELING
|
||||
#endif
|
||||
;
|
||||
|
||||
const static char* const debug_strings[] PROGMEM = {
|
||||
str_debug_1, str_debug_2, str_debug_4, str_debug_8, str_debug_16
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
, str_debug_32
|
||||
#endif
|
||||
};
|
||||
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPGM(MSG_DEBUG_PREFIX);
|
||||
if (marlin_debug_flags) {
|
||||
uint8_t comma = 0;
|
||||
for (uint8_t i = 0; i < COUNT(debug_strings); i++) {
|
||||
if (TEST(marlin_debug_flags, i)) {
|
||||
if (comma++) SERIAL_CHAR(',');
|
||||
serialprintPGM((char*)pgm_read_word(&debug_strings[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHOPGM(MSG_DEBUG_OFF);
|
||||
}
|
||||
SERIAL_EOL();
|
||||
}
|
30
Marlin/src/gcode/control/M112.h
Normal file
30
Marlin/src/gcode/control/M112.h
Normal file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M112: Emergency Stop
|
||||
*/
|
||||
void gcode_M112() {
|
||||
|
||||
kill(PSTR(MSG_KILLED));
|
||||
|
||||
}
|
39
Marlin/src/gcode/control/M120_M121.h
Normal file
39
Marlin/src/gcode/control/M120_M121.h
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M120: Enable endstops and set non-homing endstop state to "enabled"
|
||||
*/
|
||||
void gcode_M120() {
|
||||
|
||||
endstops.enable_globally(true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* M121: Disable endstops and set non-homing endstop state to "disabled"
|
||||
*/
|
||||
void gcode_M121() {
|
||||
|
||||
endstops.enable_globally(false);
|
||||
|
||||
}
|
29
Marlin/src/gcode/control/M17.h
Normal file
29
Marlin/src/gcode/control/M17.h
Normal file
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M17: Enable power on all stepper motors
|
||||
*/
|
||||
void gcode_M17() {
|
||||
LCD_MESSAGEPGM(MSG_NO_MOVE);
|
||||
enable_all_steppers();
|
||||
}
|
53
Marlin/src/gcode/control/M18_M84.h
Normal file
53
Marlin/src/gcode/control/M18_M84.h
Normal file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD)
|
||||
extern bool defer_return_to_status;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M18, M84: Disable stepper motors
|
||||
*/
|
||||
void gcode_M18_M84() {
|
||||
if (parser.seenval('S')) {
|
||||
stepper_inactive_time = parser.value_millis_from_seconds();
|
||||
}
|
||||
else {
|
||||
bool all_axis = !((parser.seen('X')) || (parser.seen('Y')) || (parser.seen('Z')) || (parser.seen('E')));
|
||||
if (all_axis) {
|
||||
stepper.finish_and_disable();
|
||||
}
|
||||
else {
|
||||
stepper.synchronize();
|
||||
if (parser.seen('X')) disable_X();
|
||||
if (parser.seen('Y')) disable_Y();
|
||||
if (parser.seen('Z')) disable_Z();
|
||||
#if E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN // Only enable on boards that have separate ENABLE_PINS
|
||||
if (parser.seen('E')) disable_e_steppers();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD) // Only needed with an LCD
|
||||
ubl_lcd_map_control = defer_return_to_status = false;
|
||||
#endif
|
||||
}
|
||||
}
|
46
Marlin/src/gcode/control/M211.h
Normal file
46
Marlin/src/gcode/control/M211.h
Normal file
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M211: Enable, Disable, and/or Report software endstops
|
||||
*
|
||||
* Usage: M211 S1 to enable, M211 S0 to disable, M211 alone for report
|
||||
*/
|
||||
void gcode_M211() {
|
||||
SERIAL_ECHO_START();
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
if (parser.seen('S')) soft_endstops_enabled = parser.value_bool();
|
||||
SERIAL_ECHOPGM(MSG_SOFT_ENDSTOPS);
|
||||
serialprintPGM(soft_endstops_enabled ? PSTR(MSG_ON) : PSTR(MSG_OFF));
|
||||
#else
|
||||
SERIAL_ECHOPGM(MSG_SOFT_ENDSTOPS);
|
||||
SERIAL_ECHOPGM(MSG_OFF);
|
||||
#endif
|
||||
SERIAL_ECHOPGM(MSG_SOFT_MIN);
|
||||
SERIAL_ECHOPAIR( MSG_X, soft_endstop_min[X_AXIS]);
|
||||
SERIAL_ECHOPAIR(" " MSG_Y, soft_endstop_min[Y_AXIS]);
|
||||
SERIAL_ECHOPAIR(" " MSG_Z, soft_endstop_min[Z_AXIS]);
|
||||
SERIAL_ECHOPGM(MSG_SOFT_MAX);
|
||||
SERIAL_ECHOPAIR( MSG_X, soft_endstop_max[X_AXIS]);
|
||||
SERIAL_ECHOPAIR(" " MSG_Y, soft_endstop_max[Y_AXIS]);
|
||||
SERIAL_ECHOLNPAIR(" " MSG_Z, soft_endstop_max[Z_AXIS]);
|
||||
}
|
54
Marlin/src/gcode/control/M226.h
Normal file
54
Marlin/src/gcode/control/M226.h
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M226: Wait until the specified pin reaches the state required (M226 P<pin> S<state>)
|
||||
*/
|
||||
void gcode_M226() {
|
||||
if (parser.seen('P')) {
|
||||
const int pin_number = parser.value_int(),
|
||||
pin_state = parser.intval('S', -1); // required pin state - default is inverted
|
||||
|
||||
if (WITHIN(pin_state, -1, 1) && pin_number > -1 && !pin_is_protected(pin_number)) {
|
||||
|
||||
int target = LOW;
|
||||
|
||||
stepper.synchronize();
|
||||
|
||||
pinMode(pin_number, INPUT);
|
||||
switch (pin_state) {
|
||||
case 1:
|
||||
target = HIGH;
|
||||
break;
|
||||
case 0:
|
||||
target = LOW;
|
||||
break;
|
||||
case -1:
|
||||
target = !digitalRead(pin_number);
|
||||
break;
|
||||
}
|
||||
|
||||
while (digitalRead(pin_number) != target) idle();
|
||||
|
||||
} // pin_state -1 0 1 && pin_number > -1
|
||||
} // parser.seen('P')
|
||||
}
|
43
Marlin/src/gcode/control/M280.h
Normal file
43
Marlin/src/gcode/control/M280.h
Normal file
@ -0,0 +1,43 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M280: Get or set servo position. P<index> [S<angle>]
|
||||
*/
|
||||
void gcode_M280() {
|
||||
if (!parser.seen('P')) return;
|
||||
const int servo_index = parser.value_int();
|
||||
if (WITHIN(servo_index, 0, NUM_SERVOS - 1)) {
|
||||
if (parser.seen('S'))
|
||||
MOVE_SERVO(servo_index, parser.value_int());
|
||||
else {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPAIR(" Servo ", servo_index);
|
||||
SERIAL_ECHOLNPAIR(": ", servo[servo_index].read());
|
||||
}
|
||||
}
|
||||
else {
|
||||
SERIAL_ERROR_START();
|
||||
SERIAL_ECHOPAIR("Servo ", servo_index);
|
||||
SERIAL_ECHOLNPGM(" out of range");
|
||||
}
|
||||
}
|
127
Marlin/src/gcode/control/M3-M5.h
Normal file
127
Marlin/src/gcode/control/M3-M5.h
Normal file
@ -0,0 +1,127 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M3: Spindle Clockwise
|
||||
* M4: Spindle Counter-clockwise
|
||||
*
|
||||
* S0 turns off spindle.
|
||||
*
|
||||
* If no speed PWM output is defined then M3/M4 just turns it on.
|
||||
*
|
||||
* At least 12.8KHz (50Hz * 256) is needed for spindle PWM.
|
||||
* Hardware PWM is required. ISRs are too slow.
|
||||
*
|
||||
* NOTE: WGM for timers 3, 4, and 5 must be either Mode 1 or Mode 5.
|
||||
* No other settings give a PWM signal that goes from 0 to 5 volts.
|
||||
*
|
||||
* The system automatically sets WGM to Mode 1, so no special
|
||||
* initialization is needed.
|
||||
*
|
||||
* WGM bits for timer 2 are automatically set by the system to
|
||||
* Mode 1. This produces an acceptable 0 to 5 volt signal.
|
||||
* No special initialization is needed.
|
||||
*
|
||||
* NOTE: A minimum PWM frequency of 50 Hz is needed. All prescaler
|
||||
* factors for timers 2, 3, 4, and 5 are acceptable.
|
||||
*
|
||||
* SPINDLE_LASER_ENABLE_PIN needs an external pullup or it may power on
|
||||
* the spindle/laser during power-up or when connecting to the host
|
||||
* (usually goes through a reset which sets all I/O pins to tri-state)
|
||||
*
|
||||
* PWM duty cycle goes from 0 (off) to 255 (always on).
|
||||
*/
|
||||
|
||||
// Wait for spindle to come up to speed
|
||||
inline void delay_for_power_up() { dwell(SPINDLE_LASER_POWERUP_DELAY); }
|
||||
|
||||
// Wait for spindle to stop turning
|
||||
inline void delay_for_power_down() { dwell(SPINDLE_LASER_POWERDOWN_DELAY); }
|
||||
|
||||
/**
|
||||
* ocr_val_mode() is used for debugging and to get the points needed to compute the RPM vs ocr_val line
|
||||
*
|
||||
* it accepts inputs of 0-255
|
||||
*/
|
||||
|
||||
inline void ocr_val_mode() {
|
||||
uint8_t spindle_laser_power = parser.value_byte();
|
||||
WRITE(SPINDLE_LASER_ENABLE_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low)
|
||||
if (SPINDLE_LASER_PWM_INVERT) spindle_laser_power = 255 - spindle_laser_power;
|
||||
analogWrite(SPINDLE_LASER_PWM_PIN, spindle_laser_power);
|
||||
}
|
||||
|
||||
void gcode_M3_M4(bool is_M3) {
|
||||
|
||||
stepper.synchronize(); // wait until previous movement commands (G0/G0/G2/G3) have completed before playing with the spindle
|
||||
#if SPINDLE_DIR_CHANGE
|
||||
const bool rotation_dir = (is_M3 != SPINDLE_INVERT_DIR);
|
||||
if (SPINDLE_STOP_ON_DIR_CHANGE \
|
||||
&& READ(SPINDLE_LASER_ENABLE_PIN) == SPINDLE_LASER_ENABLE_INVERT \
|
||||
&& READ(SPINDLE_DIR_PIN) != rotation_dir
|
||||
) {
|
||||
WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); // turn spindle off
|
||||
delay_for_power_down();
|
||||
}
|
||||
WRITE(SPINDLE_DIR_PIN, rotation_dir);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Our final value for ocr_val is an unsigned 8 bit value between 0 and 255 which usually means uint8_t.
|
||||
* Went to uint16_t because some of the uint8_t calculations would sometimes give 1000 0000 rather than 1111 1111.
|
||||
* Then needed to AND the uint16_t result with 0x00FF to make sure we only wrote the byte of interest.
|
||||
*/
|
||||
#if ENABLED(SPINDLE_LASER_PWM)
|
||||
if (parser.seen('O')) ocr_val_mode();
|
||||
else {
|
||||
const float spindle_laser_power = parser.floatval('S');
|
||||
if (spindle_laser_power == 0) {
|
||||
WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); // turn spindle off (active low)
|
||||
delay_for_power_down();
|
||||
}
|
||||
else {
|
||||
int16_t ocr_val = (spindle_laser_power - (SPEED_POWER_INTERCEPT)) * (1.0 / (SPEED_POWER_SLOPE)); // convert RPM to PWM duty cycle
|
||||
NOMORE(ocr_val, 255); // limit to max the Atmel PWM will support
|
||||
if (spindle_laser_power <= SPEED_POWER_MIN)
|
||||
ocr_val = (SPEED_POWER_MIN - (SPEED_POWER_INTERCEPT)) * (1.0 / (SPEED_POWER_SLOPE)); // minimum setting
|
||||
if (spindle_laser_power >= SPEED_POWER_MAX)
|
||||
ocr_val = (SPEED_POWER_MAX - (SPEED_POWER_INTERCEPT)) * (1.0 / (SPEED_POWER_SLOPE)); // limit to max RPM
|
||||
if (SPINDLE_LASER_PWM_INVERT) ocr_val = 255 - ocr_val;
|
||||
WRITE(SPINDLE_LASER_ENABLE_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low)
|
||||
analogWrite(SPINDLE_LASER_PWM_PIN, ocr_val & 0xFF); // only write low byte
|
||||
delay_for_power_up();
|
||||
}
|
||||
}
|
||||
#else
|
||||
WRITE(SPINDLE_LASER_ENABLE_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low) if spindle speed option not enabled
|
||||
delay_for_power_up();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* M5 turn off spindle
|
||||
*/
|
||||
void gcode_M5() {
|
||||
stepper.synchronize();
|
||||
WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT);
|
||||
delay_for_power_down();
|
||||
}
|
33
Marlin/src/gcode/control/M350.h
Normal file
33
Marlin/src/gcode/control/M350.h
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M350: Set axis microstepping modes. S sets mode for all drivers.
|
||||
*
|
||||
* Warning: Steps-per-unit remains unchanged.
|
||||
*/
|
||||
void gcode_M350() {
|
||||
if (parser.seen('S')) for (int i = 0; i <= 4; i++) stepper.microstep_mode(i, parser.value_byte());
|
||||
LOOP_XYZE(i) if (parser.seen(axis_codes[i])) stepper.microstep_mode(i, parser.value_byte());
|
||||
if (parser.seen('B')) stepper.microstep_mode(4, parser.value_byte());
|
||||
stepper.microstep_readings();
|
||||
}
|
39
Marlin/src/gcode/control/M351.h
Normal file
39
Marlin/src/gcode/control/M351.h
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M351: Toggle MS1 MS2 pins directly with axis codes X Y Z E B
|
||||
* S# determines MS1 or MS2, X# sets the pin high/low.
|
||||
*/
|
||||
void gcode_M351() {
|
||||
if (parser.seenval('S')) switch (parser.value_byte()) {
|
||||
case 1:
|
||||
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, parser.value_byte(), -1);
|
||||
if (parser.seenval('B')) stepper.microstep_ms(4, parser.value_byte(), -1);
|
||||
break;
|
||||
case 2:
|
||||
LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, parser.value_byte());
|
||||
if (parser.seenval('B')) stepper.microstep_ms(4, -1, parser.value_byte());
|
||||
break;
|
||||
}
|
||||
stepper.microstep_readings();
|
||||
}
|
93
Marlin/src/gcode/control/M380_M381.h
Normal file
93
Marlin/src/gcode/control/M380_M381.h
Normal file
@ -0,0 +1,93 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#if ENABLED(EXT_SOLENOID)
|
||||
|
||||
void enable_solenoid(const uint8_t num) {
|
||||
switch (num) {
|
||||
case 0:
|
||||
OUT_WRITE(SOL0_PIN, HIGH);
|
||||
break;
|
||||
#if HAS_SOLENOID_1 && EXTRUDERS > 1
|
||||
case 1:
|
||||
OUT_WRITE(SOL1_PIN, HIGH);
|
||||
break;
|
||||
#endif
|
||||
#if HAS_SOLENOID_2 && EXTRUDERS > 2
|
||||
case 2:
|
||||
OUT_WRITE(SOL2_PIN, HIGH);
|
||||
break;
|
||||
#endif
|
||||
#if HAS_SOLENOID_3 && EXTRUDERS > 3
|
||||
case 3:
|
||||
OUT_WRITE(SOL3_PIN, HIGH);
|
||||
break;
|
||||
#endif
|
||||
#if HAS_SOLENOID_4 && EXTRUDERS > 4
|
||||
case 4:
|
||||
OUT_WRITE(SOL4_PIN, HIGH);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPGM(MSG_INVALID_SOLENOID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void enable_solenoid_on_active_extruder() { enable_solenoid(active_extruder); }
|
||||
|
||||
void disable_all_solenoids() {
|
||||
OUT_WRITE(SOL0_PIN, LOW);
|
||||
#if HAS_SOLENOID_1 && EXTRUDERS > 1
|
||||
OUT_WRITE(SOL1_PIN, LOW);
|
||||
#endif
|
||||
#if HAS_SOLENOID_2 && EXTRUDERS > 2
|
||||
OUT_WRITE(SOL2_PIN, LOW);
|
||||
#endif
|
||||
#if HAS_SOLENOID_3 && EXTRUDERS > 3
|
||||
OUT_WRITE(SOL3_PIN, LOW);
|
||||
#endif
|
||||
#if HAS_SOLENOID_4 && EXTRUDERS > 4
|
||||
OUT_WRITE(SOL4_PIN, LOW);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* M380: Enable solenoid on the active extruder
|
||||
*/
|
||||
void gcode_M380() {
|
||||
|
||||
enable_solenoid_on_active_extruder();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* M381: Disable all solenoids
|
||||
*/
|
||||
void gcode_M381() {
|
||||
|
||||
disable_all_solenoids();
|
||||
|
||||
}
|
||||
|
||||
#endif // EXT_SOLENOID
|
30
Marlin/src/gcode/control/M400.h
Normal file
30
Marlin/src/gcode/control/M400.h
Normal file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M400: Finish all moves
|
||||
*/
|
||||
void gcode_M400() {
|
||||
|
||||
stepper.synchronize();
|
||||
|
||||
}
|
33
Marlin/src/gcode/control/M410.h
Normal file
33
Marlin/src/gcode/control/M410.h
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M410: Quickstop - Abort all planned moves
|
||||
*
|
||||
* This will stop the carriages mid-move, so most likely they
|
||||
* will be out of sync with the stepper position after this.
|
||||
*/
|
||||
void gcode_M410() {
|
||||
|
||||
quickstop_stepper();
|
||||
|
||||
}
|
59
Marlin/src/gcode/control/M42.h
Normal file
59
Marlin/src/gcode/control/M42.h
Normal file
@ -0,0 +1,59 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M42: Change pin status via GCode
|
||||
*
|
||||
* P<pin> Pin number (LED if omitted)
|
||||
* S<byte> Pin status from 0 - 255
|
||||
*/
|
||||
void gcode_M42() {
|
||||
if (!parser.seenval('S')) return;
|
||||
const byte pin_status = parser.value_byte();
|
||||
|
||||
const int pin_number = parser.intval('P', LED_PIN);
|
||||
if (pin_number < 0) return;
|
||||
|
||||
if (pin_is_protected(pin_number)) {
|
||||
SERIAL_ERROR_START();
|
||||
SERIAL_ERRORLNPGM(MSG_ERR_PROTECTED_PIN);
|
||||
return;
|
||||
}
|
||||
|
||||
pinMode(pin_number, OUTPUT);
|
||||
digitalWrite(pin_number, pin_status);
|
||||
analogWrite(pin_number, pin_status);
|
||||
|
||||
#if FAN_COUNT > 0
|
||||
switch (pin_number) {
|
||||
#if HAS_FAN0
|
||||
case FAN_PIN: fanSpeeds[0] = pin_status; break;
|
||||
#endif
|
||||
#if HAS_FAN1
|
||||
case FAN1_PIN: fanSpeeds[1] = pin_status; break;
|
||||
#endif
|
||||
#if HAS_FAN2
|
||||
case FAN2_PIN: fanSpeeds[2] = pin_status; break;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
76
Marlin/src/gcode/control/M605.h
Normal file
76
Marlin/src/gcode/control/M605.h
Normal file
@ -0,0 +1,76 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
|
||||
/**
|
||||
* M605: Set dual x-carriage movement mode
|
||||
*
|
||||
* M605 S0: Full control mode. The slicer has full control over x-carriage movement
|
||||
* M605 S1: Auto-park mode. The inactive head will auto park/unpark without slicer involvement
|
||||
* M605 S2 [Xnnn] [Rmmm]: Duplication mode. The second extruder will duplicate the first with nnn
|
||||
* units x-offset and an optional differential hotend temperature of
|
||||
* mmm degrees. E.g., with "M605 S2 X100 R2" the second extruder will duplicate
|
||||
* the first with a spacing of 100mm in the x direction and 2 degrees hotter.
|
||||
*
|
||||
* Note: the X axis should be homed after changing dual x-carriage mode.
|
||||
*/
|
||||
void gcode_M605() {
|
||||
stepper.synchronize();
|
||||
if (parser.seen('S')) dual_x_carriage_mode = (DualXMode)parser.value_byte();
|
||||
switch (dual_x_carriage_mode) {
|
||||
case DXC_FULL_CONTROL_MODE:
|
||||
case DXC_AUTO_PARK_MODE:
|
||||
break;
|
||||
case DXC_DUPLICATION_MODE:
|
||||
if (parser.seen('X')) duplicate_extruder_x_offset = max(parser.value_linear_units(), X2_MIN_POS - x_home_pos(0));
|
||||
if (parser.seen('R')) duplicate_extruder_temp_offset = parser.value_celsius_diff();
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_ECHO(hotend_offset[X_AXIS][0]);
|
||||
SERIAL_CHAR(',');
|
||||
SERIAL_ECHO(hotend_offset[Y_AXIS][0]);
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_ECHO(duplicate_extruder_x_offset);
|
||||
SERIAL_CHAR(',');
|
||||
SERIAL_ECHOLN(hotend_offset[Y_AXIS][1]);
|
||||
break;
|
||||
default:
|
||||
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
|
||||
break;
|
||||
}
|
||||
active_extruder_parked = false;
|
||||
extruder_duplication_enabled = false;
|
||||
delayed_move_time = 0;
|
||||
}
|
||||
|
||||
#elif ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
|
||||
|
||||
void gcode_M605() {
|
||||
stepper.synchronize();
|
||||
extruder_duplication_enabled = parser.intval('S') == (int)DXC_DUPLICATION_MODE;
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR(MSG_DUPLICATION_MODE, extruder_duplication_enabled ? MSG_ON : MSG_OFF);
|
||||
}
|
||||
|
||||
#endif // DUAL_NOZZLE_DUPLICATION_MODE
|
56
Marlin/src/gcode/control/M80.h
Normal file
56
Marlin/src/gcode/control/M80.h
Normal file
@ -0,0 +1,56 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M80 : Turn on the Power Supply
|
||||
* M80 S : Report the current state and exit
|
||||
*/
|
||||
void gcode_M80() {
|
||||
|
||||
// S: Report the current power supply state and exit
|
||||
if (parser.seen('S')) {
|
||||
serialprintPGM(powersupply_on ? PSTR("PS:1\n") : PSTR("PS:0\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE); // GND
|
||||
|
||||
/**
|
||||
* If you have a switch on suicide pin, this is useful
|
||||
* if you want to start another print with suicide feature after
|
||||
* a print without suicide...
|
||||
*/
|
||||
#if HAS_SUICIDE
|
||||
OUT_WRITE(SUICIDE_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAVE_TMC2130)
|
||||
delay(100);
|
||||
tmc2130_init(); // Settings only stick when the driver has power
|
||||
#endif
|
||||
|
||||
powersupply_on = true;
|
||||
|
||||
#if ENABLED(ULTIPANEL)
|
||||
LCD_MESSAGEPGM(WELCOME_MSG);
|
||||
#endif
|
||||
}
|
53
Marlin/src/gcode/control/M81.h
Normal file
53
Marlin/src/gcode/control/M81.h
Normal file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M81: Turn off Power, including Power Supply, if there is one.
|
||||
*
|
||||
* This code should ALWAYS be available for EMERGENCY SHUTDOWN!
|
||||
*/
|
||||
void gcode_M81() {
|
||||
thermalManager.disable_all_heaters();
|
||||
stepper.finish_and_disable();
|
||||
|
||||
#if FAN_COUNT > 0
|
||||
for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
|
||||
#if ENABLED(PROBING_FANS_OFF)
|
||||
fans_paused = false;
|
||||
ZERO(paused_fanSpeeds);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
safe_delay(1000); // Wait 1 second before switching off
|
||||
|
||||
#if HAS_SUICIDE
|
||||
stepper.synchronize();
|
||||
suicide();
|
||||
#elif HAS_POWER_SWITCH
|
||||
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
|
||||
powersupply_on = false;
|
||||
#endif
|
||||
|
||||
#if ENABLED(ULTIPANEL)
|
||||
LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF ".");
|
||||
#endif
|
||||
}
|
31
Marlin/src/gcode/control/M85.h
Normal file
31
Marlin/src/gcode/control/M85.h
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M85: Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
|
||||
*/
|
||||
void gcode_M85() {
|
||||
|
||||
if (parser.seen('S')) max_inactive_time = parser.value_millis_from_seconds();
|
||||
|
||||
}
|
||||
|
41
Marlin/src/gcode/control/M999.h
Normal file
41
Marlin/src/gcode/control/M999.h
Normal file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* M999: Restart after being stopped
|
||||
*
|
||||
* Default behaviour is to flush the serial buffer and request
|
||||
* a resend to the host starting on the last N line received.
|
||||
*
|
||||
* Sending "M999 S1" will resume printing without flushing the
|
||||
* existing command buffer.
|
||||
*
|
||||
*/
|
||||
void gcode_M999() {
|
||||
Running = true;
|
||||
lcd_reset_alert_level();
|
||||
|
||||
if (parser.boolval('S')) return;
|
||||
|
||||
// gcode_LastN = Stopped_gcode_LastN;
|
||||
FlushSerialRequestResend();
|
||||
}
|
62
Marlin/src/gcode/control/T.h
Normal file
62
Marlin/src/gcode/control/T.h
Normal file
@ -0,0 +1,62 @@
|
||||
/**
|
||||
* 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 "../../module/tool_change.h"
|
||||
|
||||
/**
|
||||
* T0-T3: Switch tool, usually switching extruders
|
||||
*
|
||||
* F[units/min] Set the movement feedrate
|
||||
* S1 Don't move the tool in XY after change
|
||||
*/
|
||||
void gcode_T(uint8_t tmp_extruder) {
|
||||
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
SERIAL_ECHOPAIR(">>> gcode_T(", tmp_extruder);
|
||||
SERIAL_CHAR(')');
|
||||
SERIAL_EOL();
|
||||
DEBUG_POS("BEFORE", current_position);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HOTENDS == 1 || (ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1)
|
||||
|
||||
tool_change(tmp_extruder);
|
||||
|
||||
#elif HOTENDS > 1
|
||||
|
||||
tool_change(
|
||||
tmp_extruder,
|
||||
MMM_TO_MMS(parser.linearval('F')),
|
||||
(tmp_extruder == active_extruder) || parser.boolval('S')
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
DEBUG_POS("AFTER", current_position);
|
||||
SERIAL_ECHOLNPGM("<<< gcode_T");
|
||||
}
|
||||
#endif
|
||||
}
|
Reference in New Issue
Block a user