Browse Source

Revert behavior of enqueue_and_echo_commands_P

Scott Lahteine 8 years ago
parent
commit
1a775cecac
2 changed files with 3 additions and 36 deletions
  1. 2
    2
      Marlin/Marlin.h
  2. 1
    34
      Marlin/Marlin_main.cpp

+ 2
- 2
Marlin/Marlin.h View File

@@ -243,8 +243,8 @@ extern bool Running;
243 243
 inline bool IsRunning() { return  Running; }
244 244
 inline bool IsStopped() { return !Running; }
245 245
 
246
-bool enqueue_and_echo_command(const char* cmd, bool say_ok=false); //put a single ASCII command at the end of the current buffer or return false when it is full
247
-void enqueue_and_echo_commands_P(const char* cmd); //put one or many ASCII commands at the end of the current buffer, read from flash
246
+bool enqueue_and_echo_command(const char* cmd, bool say_ok=false); // Add a single command to the end of the buffer. Return false on failure.
247
+void enqueue_and_echo_commands_P(const char * const cmd);          // Set one or more commands to be prioritized over the next Serial/SD command.
248 248
 void clear_command_queue();
249 249
 
250 250
 extern millis_t previous_cmd_ms;

+ 1
- 34
Marlin/Marlin_main.cpp View File

@@ -796,39 +796,6 @@ inline void echo_command(const char* cmd) {
796 796
 }
797 797
 
798 798
 /**
799
- * Shove a command in RAM to the front of the main command queue.
800
- * Return true if the command is successfully added.
801
- */
802
-inline bool _shovecommand(const char* cmd, bool say_ok=false) {
803
-  if (*cmd == ';' || commands_in_queue >= BUFSIZE) return false;
804
-  cmd_queue_index_r = (cmd_queue_index_r + BUFSIZE - 1) % BUFSIZE; // Index of the previous slot
805
-  commands_in_queue++;
806
-  strcpy(command_queue[cmd_queue_index_r], cmd);
807
-  send_ok[cmd_queue_index_r] = say_ok;
808
-  return true;
809
-}
810
-
811
-/**
812
- * Shove a command to the front of the queue with Serial Echo
813
- * Return true if the command is successfully added.
814
- */
815
-bool shove_and_echo_command(const char* cmd, bool say_ok=false) {
816
-  if (_shovecommand(cmd, say_ok)) {
817
-    echo_command(cmd);
818
-    return true;
819
-  }
820
-  return false;
821
-}
822
-
823
-/**
824
- * Shove a command onto the front of the queue,
825
- * and don't return until successful.
826
- */
827
-void shove_and_echo_command_now(const char* cmd) {
828
-  while (!shove_and_echo_command(cmd)) idle();
829
-}
830
-
831
-/**
832 799
  * Inject the next "immediate" command, when possible, onto the front of the queue.
833 800
  * Return true if any immediate commands remain to inject.
834 801
  */
@@ -840,7 +807,7 @@ static bool drain_injected_commands_P() {
840 807
     cmd[sizeof(cmd) - 1] = '\0';
841 808
     while ((c = cmd[i]) && c != '\n') i++; // find the end of this gcode command
842 809
     cmd[i] = '\0';
843
-    if (shove_and_echo_command(cmd))       // success?
810
+    if (enqueue_and_echo_command(cmd))     // success?
844 811
       injected_commands_P = c ? injected_commands_P + i + 1 : NULL; // next command or done
845 812
   }
846 813
   return (injected_commands_P != NULL);    // return whether any more remain

Loading…
Cancel
Save