浏览代码

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
 
990
 
991
     #endif // SDSUPPORT
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
   endstops.report_state();
999
   endstops.report_state();
997
   idle();
1000
   idle();

正在加载...
取消
保存