2018-10-07 17:06:14 -05:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2019-06-27 23:57:50 -05:00
|
|
|
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2018-10-07 17:06:14 -05:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
2019-06-27 23:57:50 -05:00
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
2018-10-07 17:06:14 -05:00
|
|
|
*
|
|
|
|
* 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/MarlinConfigPre.h"
|
|
|
|
|
2018-10-17 11:11:41 -05:00
|
|
|
#if EXTRUDERS > 1
|
2018-10-07 17:06:14 -05:00
|
|
|
|
|
|
|
#include "../gcode.h"
|
|
|
|
#include "../../module/tool_change.h"
|
|
|
|
|
2019-11-29 04:45:07 -06:00
|
|
|
#include "../../Marlin.h" // for SP_X_STR, etc.
|
|
|
|
|
|
|
|
extern const char SP_X_STR[], SP_Y_STR[], SP_Z_STR[];
|
|
|
|
|
2018-10-07 17:06:14 -05:00
|
|
|
void M217_report(const bool eeprom=false) {
|
2018-10-17 11:11:41 -05:00
|
|
|
|
2018-11-06 21:52:20 -06:00
|
|
|
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
2019-04-08 18:17:14 -05:00
|
|
|
serialprintPGM(eeprom ? PSTR(" M217") : PSTR("Toolchange:"));
|
2019-02-23 22:53:01 -06:00
|
|
|
SERIAL_ECHOPAIR(" S", LINEAR_UNIT(toolchange_settings.swap_length));
|
2019-11-29 04:45:07 -06:00
|
|
|
SERIAL_ECHOPAIR_P(SP_E_STR, LINEAR_UNIT(toolchange_settings.extra_prime));
|
2019-02-23 22:53:01 -06:00
|
|
|
SERIAL_ECHOPAIR(" P", LINEAR_UNIT(toolchange_settings.prime_speed));
|
|
|
|
SERIAL_ECHOPAIR(" R", LINEAR_UNIT(toolchange_settings.retract_speed));
|
2018-10-17 11:11:41 -05:00
|
|
|
|
2018-11-06 21:52:20 -06:00
|
|
|
#if ENABLED(TOOLCHANGE_PARK)
|
2019-11-29 04:45:07 -06:00
|
|
|
SERIAL_ECHOPAIR_P(SP_X_STR, LINEAR_UNIT(toolchange_settings.change_point.x));
|
|
|
|
SERIAL_ECHOPAIR_P(SP_Y_STR, LINEAR_UNIT(toolchange_settings.change_point.y));
|
2018-10-17 11:11:41 -05:00
|
|
|
#endif
|
|
|
|
|
2018-11-26 16:51:57 -06:00
|
|
|
#else
|
|
|
|
|
|
|
|
UNUSED(eeprom);
|
|
|
|
|
2018-10-13 23:08:20 -05:00
|
|
|
#endif
|
2018-10-17 11:11:41 -05:00
|
|
|
|
2019-11-29 04:45:07 -06:00
|
|
|
SERIAL_ECHOPAIR_P(SP_Z_STR, LINEAR_UNIT(toolchange_settings.z_raise));
|
2018-10-13 23:08:20 -05:00
|
|
|
SERIAL_EOL();
|
2018-10-07 17:06:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* M217 - Set SINGLENOZZLE toolchange parameters
|
|
|
|
*
|
2018-10-13 23:08:20 -05:00
|
|
|
* S[linear] Swap length
|
2019-07-14 11:40:58 -05:00
|
|
|
* E[linear] Purge length
|
2018-10-13 23:08:20 -05:00
|
|
|
* P[linear/m] Prime speed
|
|
|
|
* R[linear/m] Retract speed
|
2018-11-06 21:52:20 -06:00
|
|
|
* X[linear] Park X (Requires TOOLCHANGE_PARK)
|
|
|
|
* Y[linear] Park Y (Requires TOOLCHANGE_PARK)
|
2018-10-13 23:08:20 -05:00
|
|
|
* Z[linear] Z Raise
|
2018-10-07 17:06:14 -05:00
|
|
|
*/
|
|
|
|
void GcodeSuite::M217() {
|
|
|
|
|
2018-11-03 01:16:37 -05:00
|
|
|
#define SPR_PARAM
|
|
|
|
#define XY_PARAM
|
2018-10-07 17:06:14 -05:00
|
|
|
|
2018-11-06 21:52:20 -06:00
|
|
|
#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
|
2018-10-17 11:11:41 -05:00
|
|
|
|
2018-11-03 01:16:37 -05:00
|
|
|
#undef SPR_PARAM
|
2019-07-14 11:40:58 -05:00
|
|
|
#define SPR_PARAM "SPRE"
|
|
|
|
|
|
|
|
static constexpr float max_extrude =
|
|
|
|
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
|
|
|
EXTRUDE_MAXLENGTH
|
|
|
|
#else
|
|
|
|
500
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
|
|
|
|
if (parser.seenval('S')) { const float v = parser.value_linear_units(); toolchange_settings.swap_length = constrain(v, 0, max_extrude); }
|
|
|
|
if (parser.seenval('E')) { const float v = parser.value_linear_units(); toolchange_settings.extra_prime = constrain(v, 0, max_extrude); }
|
2018-11-03 01:16:37 -05:00
|
|
|
if (parser.seenval('P')) { const int16_t v = parser.value_linear_units(); toolchange_settings.prime_speed = constrain(v, 10, 5400); }
|
|
|
|
if (parser.seenval('R')) { const int16_t v = parser.value_linear_units(); toolchange_settings.retract_speed = constrain(v, 10, 5400); }
|
2018-10-13 23:08:20 -05:00
|
|
|
#endif
|
2019-07-14 11:40:58 -05:00
|
|
|
|
2018-11-06 21:52:20 -06:00
|
|
|
#if ENABLED(TOOLCHANGE_PARK)
|
|
|
|
#undef XY_PARAM
|
|
|
|
#define XY_PARAM "XY"
|
|
|
|
if (parser.seenval('X')) { toolchange_settings.change_point.x = parser.value_linear_units(); }
|
|
|
|
if (parser.seenval('Y')) { toolchange_settings.change_point.y = parser.value_linear_units(); }
|
|
|
|
#endif
|
2019-07-14 11:40:58 -05:00
|
|
|
|
2018-11-03 01:16:37 -05:00
|
|
|
if (parser.seenval('Z')) { toolchange_settings.z_raise = parser.value_linear_units(); }
|
2018-10-07 17:06:14 -05:00
|
|
|
|
2018-11-03 01:16:37 -05:00
|
|
|
if (!parser.seen(SPR_PARAM XY_PARAM "Z")) M217_report();
|
2018-10-07 17:06:14 -05:00
|
|
|
}
|
|
|
|
|
2018-10-17 11:11:41 -05:00
|
|
|
#endif // EXTRUDERS > 1
|