|
@@ -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
|