Browse Source

Add "End Repeat Loops" menu item

Scott Lahteine 3 years ago
parent
commit
f0c29afe21

+ 4
- 0
Marlin/src/feature/repeat.h View File

@@ -39,6 +39,10 @@ private:
39 39
   static uint8_t index;
40 40
 public:
41 41
   static inline void reset() { index = 0; }
42
+  static inline bool is_active() {
43
+    LOOP_L_N(i, index) if (marker[i].counter) return true;
44
+    return false;
45
+  }
42 46
   static bool is_command_M808(char * const cmd) { return cmd[0] == 'M' && cmd[1] == '8' && cmd[2] == '0' && cmd[3] == '8' && !NUMERIC(cmd[4]); }
43 47
   static void early_parse_M808(char * const cmd);
44 48
   static void add_marker(const uint32_t sdpos, const uint16_t count);

+ 1
- 0
Marlin/src/lcd/language/language_en.h View File

@@ -388,6 +388,7 @@ namespace Language_en {
388 388
   PROGMEM Language_Str MSG_RESUME_PRINT                    = _UxGT("Resume Print");
389 389
   PROGMEM Language_Str MSG_HOST_START_PRINT                = _UxGT("Host Start");
390 390
   PROGMEM Language_Str MSG_STOP_PRINT                      = _UxGT("Stop Print");
391
+  PROGMEM Language_Str MSG_END_LOOPS                       = _UxGT("End Repeat Loops");
391 392
   PROGMEM Language_Str MSG_PRINTING_OBJECT                 = _UxGT("Printing Object");
392 393
   PROGMEM Language_Str MSG_CANCEL_OBJECT                   = _UxGT("Cancel Object");
393 394
   PROGMEM Language_Str MSG_CANCEL_OBJECT_N                 = _UxGT("Cancel Object =");

+ 9
- 0
Marlin/src/lcd/menu/menu_main.cpp View File

@@ -58,6 +58,10 @@
58 58
   #include "../../feature/host_actions.h"
59 59
 #endif
60 60
 
61
+#if ENABLED(GCODE_REPEAT_MARKERS)
62
+  #include "../../feature/repeat.h"
63
+#endif
64
+
61 65
 void menu_tune();
62 66
 void menu_cancelobject();
63 67
 void menu_motion();
@@ -120,6 +124,11 @@ void menu_main() {
120 124
       });
121 125
     #endif
122 126
 
127
+    #if ENABLED(GCODE_REPEAT_MARKERS)
128
+      if (repeat.is_active())
129
+        ACTION_ITEM(MSG_END_LOOPS, repeat.cancel);
130
+    #endif
131
+
123 132
     SUBMENU(MSG_TUNE, menu_tune);
124 133
 
125 134
     #if ENABLED(CANCEL_OBJECTS) && DISABLED(SLIM_LCD_MENUS)

Loading…
Cancel
Save