diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp
index b3f9cf243f6f1e53ea3d90238fa8fd5adf4ceece..f9f94dccc2abdc37b1b01da36789fabd1ac6c4d2 100644
--- a/Marlin/src/Marlin.cpp
+++ b/Marlin/src/Marlin.cpp
@@ -355,8 +355,6 @@ bool pin_is_protected(const int8_t pin) {
return false;
}
-#include "gcode/control/M211.h"
-
#include "gcode/config/M220.h"
#include "gcode/control/M226.h"
diff --git a/Marlin/src/gcode/control/M211.h b/Marlin/src/gcode/control/M211.cpp
similarity index 95%
rename from Marlin/src/gcode/control/M211.h
rename to Marlin/src/gcode/control/M211.cpp
index 2c4d90de27269c2ec9c0d2bc146334e069a16ef4..3b4498a180faad0114013d60f6c5bad1d9f29d09 100644
--- a/Marlin/src/gcode/control/M211.h
+++ b/Marlin/src/gcode/control/M211.cpp
@@ -20,12 +20,15 @@
*
*/
+#include "../gcode.h"
+#include "../../module/motion.h"
+
/**
* M211: Enable, Disable, and/or Report software endstops
*
* Usage: M211 S1 to enable, M211 S0 to disable, M211 alone for report
*/
-void gcode_M211() {
+void GcodeSuite::M211() {
SERIAL_ECHO_START();
#if HAS_SOFTWARE_ENDSTOPS
if (parser.seen('S')) soft_endstops_enabled = parser.value_bool();
diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp
index 30433e13162d483af7fd72832dc9276a54d4199d..e037f6bf174ffcd0d6f32b14804683600888a4f5 100644
--- a/Marlin/src/gcode/gcode.cpp
+++ b/Marlin/src/gcode/gcode.cpp
@@ -119,7 +119,6 @@ void GcodeSuite::dwell(millis_t time) {
extern void gcode_M163();
extern void gcode_M164();
extern void gcode_M165();
-extern void gcode_M211();
extern void gcode_M220();
extern void gcode_M226();
extern void gcode_M240();
@@ -552,9 +551,7 @@ void GcodeSuite::process_next_command() {
case 209: if (MIN_AUTORETRACT <= MAX_AUTORETRACT) M209(); break; // M209: Turn Automatic Retract Detection on/off
#endif
- case 211: // M211: Enable, Disable, and/or Report software endstops
- gcode_M211();
- break;
+ case 211: M211(); break; // M211: Enable, Disable, and/or Report software endstops
#if HOTENDS > 1
case 218: // M218: Set a tool offset