diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp
index fdec77414b..88ab61d861 100644
--- a/Marlin/Marlin_main.cpp
+++ b/Marlin/Marlin_main.cpp
@@ -7875,9 +7875,9 @@ inline void gcode_M42() {
 
     // Enable or disable endstop monitoring
     if (parser.seen('E')) {
-      endstop_monitor_flag = parser.value_bool();
+      endstops.monitor_flag = parser.value_bool();
       SERIAL_PROTOCOLPGM("endstop monitor ");
-      serialprintPGM(endstop_monitor_flag ? PSTR("en") : PSTR("dis"));
+      serialprintPGM(endstops.monitor_flag ? PSTR("en") : PSTR("dis"));
       SERIAL_PROTOCOLLNPGM("abled");
       return;
     }
diff --git a/Marlin/pinsDebug.h b/Marlin/pinsDebug.h
index 24d058b4f2..ba6241fbeb 100644
--- a/Marlin/pinsDebug.h
+++ b/Marlin/pinsDebug.h
@@ -20,8 +20,6 @@
  *
  */
 
-bool endstop_monitor_flag = false;
-
 #define NAME_FORMAT "%-35s"   // one place to specify the format of all the sources of names
                                // "-" left justify, "28" minimum width of name, pad with blanks