Browse Source

Tweak command index increment

Scott Lahteine 7 years ago
parent
commit
6876e79d42
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      Marlin/Marlin_main.cpp

+ 2
- 2
Marlin/Marlin_main.cpp View File

@@ -832,7 +832,7 @@ void clear_command_queue() {
832 832
  */
833 833
 inline void _commit_command(bool say_ok) {
834 834
   send_ok[cmd_queue_index_w] = say_ok;
835
-  cmd_queue_index_w = (cmd_queue_index_w + 1) % BUFSIZE;
835
+  if (++cmd_queue_index_w >= BUFSIZE) cmd_queue_index_w = 0;
836 836
   commands_in_queue++;
837 837
 }
838 838
 
@@ -12330,7 +12330,7 @@ void loop() {
12330 12330
     // The queue may be reset by a command handler or by code invoked by idle() within a handler
12331 12331
     if (commands_in_queue) {
12332 12332
       --commands_in_queue;
12333
-      cmd_queue_index_r = (cmd_queue_index_r + 1) % BUFSIZE;
12333
+      if (++cmd_queue_index_r >= BUFSIZE) cmd_queue_index_r = 0;
12334 12334
     }
12335 12335
   }
12336 12336
   endstops.report_state();

Loading…
Cancel
Save