️ Slimmer null T command (#26615)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
plampix 2024-01-05 00:09:53 +01:00 committed by GitHub
parent 6e67ad51b7
commit 994aa9f692
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 38 additions and 15 deletions

View file

@ -219,7 +219,9 @@
#include "feature/fanmux.h"
#endif
#include "module/tool_change.h"
#if HAS_TOOLCHANGE
#include "module/tool_change.h"
#endif
#if HAS_FANCHECK
#include "feature/fancheck.h"

View file

@ -501,8 +501,10 @@ void GcodeSuite::G26() {
// or if the parameter parsing did not go OK, abort
if (homing_needed_error()) return;
// Change the tool first, if specified
if (parser.seenval('T')) tool_change(parser.value_int());
#if HAS_TOOLCHANGE
// Change the tool first, if specified
if (parser.seenval('T')) tool_change(parser.value_int());
#endif
g26_helper_t g26;

View file

@ -25,7 +25,10 @@
#if HAS_MULTI_EXTRUDER
#include "../gcode.h"
#include "../../module/tool_change.h"
#if HAS_TOOLCHANGE
#include "../../module/tool_change.h"
#endif
#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
#include "../../module/motion.h" // for active_extruder
@ -119,7 +122,7 @@ void GcodeSuite::M217() {
#endif
#endif
#if HAS_Z_AXIS
#if HAS_Z_AXIS && HAS_TOOLCHANGE
if (parser.seenval('Z')) { toolchange_settings.z_raise = parser.value_linear_units(); }
#endif

View file

@ -20,6 +20,10 @@
*
*/
#include "../../inc/MarlinConfigPre.h"
#if HAS_TOOLCHANGE
#include "../gcode.h"
#include "../../module/tool_change.h"
@ -76,3 +80,5 @@ void GcodeSuite::T(const int8_t tool_index) {
#endif
);
}
#endif // HAS_TOOLCHANGE

View file

@ -122,14 +122,16 @@ void GcodeSuite::say_units() {
* Return -1 if the T parameter is out of range
*/
int8_t GcodeSuite::get_target_extruder_from_command() {
if (parser.seenval('T')) {
const int8_t e = parser.value_byte();
if (e < EXTRUDERS) return e;
SERIAL_ECHO_START();
SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum);
SERIAL_ECHOLNPGM(" " STR_INVALID_EXTRUDER " ", e);
return -1;
}
#if HAS_TOOLCHANGE
if (parser.seenval('T')) {
const int8_t e = parser.value_byte();
if (e < EXTRUDERS) return e;
SERIAL_ECHO_START();
SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum);
SERIAL_ECHOLNPGM(" " STR_INVALID_EXTRUDER " ", e);
return -1;
}
#endif
return active_extruder;
}

View file

@ -1285,7 +1285,7 @@ private:
static void M710_report(const bool forReplay=true);
#endif
static void T(const int8_t tool_index);
static void T(const int8_t tool_index) IF_DISABLED(HAS_TOOLCHANGE, { UNUSED(tool_index); });
};

View file

@ -803,6 +803,10 @@
#endif
#endif
#if HAS_MULTI_EXTRUDER || HAS_MULTI_HOTEND || HAS_PRUSA_MMU2 || (ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1)
#define HAS_TOOLCHANGE 1
#endif
#if ENABLED(MIXING_EXTRUDER) && (ENABLED(RETRACT_SYNC_MIXING) || ALL(FILAMENT_LOAD_UNLOAD_GCODES, FILAMENT_UNLOAD_ALL_EXTRUDERS))
#define HAS_MIXER_SYNC_CHANNEL 1
#endif

View file

@ -22,6 +22,8 @@
#include "../inc/MarlinConfigPre.h"
#if HAS_TOOLCHANGE
#include "tool_change.h"
#include "motion.h"
@ -1629,3 +1631,5 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
}
#endif // TOOLCHANGE_MIGRATION_FEATURE
#endif // HAS_TOOLCHANGE

View file

@ -306,6 +306,7 @@ SERVO_DETACH_GCODE = build_src_filter=+<src/gcode/control/M2
HAS_DUPLICATION_MODE = build_src_filter=+<src/gcode/control/M605.cpp>
SPI_FLASH_BACKUP = build_src_filter=+<src/gcode/control/M993_M994.cpp>
PLATFORM_M997_SUPPORT = build_src_filter=+<src/gcode/control/M997.cpp>
HAS_TOOLCHANGE = build_src_filter=+<src/gcode/control/T.cpp>
FT_MOTION = build_src_filter=+<src/module/ft_motion.cpp> +<src/gcode/feature/ft_motion>
LIN_ADVANCE = build_src_filter=+<src/gcode/feature/advance>
PHOTO_GCODE = build_src_filter=+<src/gcode/feature/camera>

View file

@ -107,7 +107,6 @@ default_src_filter = +<src/*> -<src/config> -<src/tests>
+<src/gcode/control/M111.cpp>
+<src/gcode/control/M120_M121.cpp>
+<src/gcode/control/M999.cpp>
+<src/gcode/control/T.cpp>
+<src/gcode/geometry/G92.cpp>
+<src/gcode/host/M110.cpp>
+<src/gcode/host/M114.cpp>