소스 검색

Allow the queue to be cleared from within commands

Scott Lahteine 9 년 전
부모
커밋
0d4ff0c48b
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5
    2
      Marlin/Marlin_main.cpp

+ 5
- 2
Marlin/Marlin_main.cpp 파일 보기

@@ -990,8 +990,11 @@ void loop() {
990 990
 
991 991
     #endif // SDSUPPORT
992 992
 
993
-    commands_in_queue--;
994
-    cmd_queue_index_r = (cmd_queue_index_r + 1) % BUFSIZE;
993
+    // The queue may be reset by a command handler or by code invoked by idle() within a handler
994
+    if (commands_in_queue) {
995
+      --commands_in_queue;
996
+      cmd_queue_index_r = (cmd_queue_index_r + 1) % BUFSIZE;
997
+    }
995 998
   }
996 999
   endstops.report_state();
997 1000
   idle();

Loading…
취소
저장