1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-26 05:17:17 +00:00

️ 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" #include "feature/fanmux.h"
#endif #endif
#include "module/tool_change.h" #if HAS_TOOLCHANGE
#include "module/tool_change.h"
#endif
#if HAS_FANCHECK #if HAS_FANCHECK
#include "feature/fancheck.h" #include "feature/fancheck.h"

View File

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

View File

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

View File

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

View File

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

View File

@ -1285,7 +1285,7 @@ private:
static void M710_report(const bool forReplay=true); static void M710_report(const bool forReplay=true);
#endif #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
#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)) #if ENABLED(MIXING_EXTRUDER) && (ENABLED(RETRACT_SYNC_MIXING) || ALL(FILAMENT_LOAD_UNLOAD_GCODES, FILAMENT_UNLOAD_ALL_EXTRUDERS))
#define HAS_MIXER_SYNC_CHANNEL 1 #define HAS_MIXER_SYNC_CHANNEL 1
#endif #endif

View File

@ -22,6 +22,8 @@
#include "../inc/MarlinConfigPre.h" #include "../inc/MarlinConfigPre.h"
#if HAS_TOOLCHANGE
#include "tool_change.h" #include "tool_change.h"
#include "motion.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 // 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> HAS_DUPLICATION_MODE = build_src_filter=+<src/gcode/control/M605.cpp>
SPI_FLASH_BACKUP = build_src_filter=+<src/gcode/control/M993_M994.cpp> SPI_FLASH_BACKUP = build_src_filter=+<src/gcode/control/M993_M994.cpp>
PLATFORM_M997_SUPPORT = build_src_filter=+<src/gcode/control/M997.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> FT_MOTION = build_src_filter=+<src/module/ft_motion.cpp> +<src/gcode/feature/ft_motion>
LIN_ADVANCE = build_src_filter=+<src/gcode/feature/advance> LIN_ADVANCE = build_src_filter=+<src/gcode/feature/advance>
PHOTO_GCODE = build_src_filter=+<src/gcode/feature/camera> 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/M111.cpp>
+<src/gcode/control/M120_M121.cpp> +<src/gcode/control/M120_M121.cpp>
+<src/gcode/control/M999.cpp> +<src/gcode/control/M999.cpp>
+<src/gcode/control/T.cpp>
+<src/gcode/geometry/G92.cpp> +<src/gcode/geometry/G92.cpp>
+<src/gcode/host/M110.cpp> +<src/gcode/host/M110.cpp>
+<src/gcode/host/M114.cpp> +<src/gcode/host/M114.cpp>