Browse Source

Revert behavior of enqueue_and_echo_commands_P

pull/1/head
Scott Lahteine 8 years ago
parent
commit
1a775cecac
  1. 4
      Marlin/Marlin.h
  2. 35
      Marlin/Marlin_main.cpp

4
Marlin/Marlin.h

@ -243,8 +243,8 @@ extern bool Running;
inline bool IsRunning() { return Running; } inline bool IsRunning() { return Running; }
inline bool IsStopped() { return !Running; } inline bool IsStopped() { return !Running; }
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 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.
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 void enqueue_and_echo_commands_P(const char * const cmd); // Set one or more commands to be prioritized over the next Serial/SD command.
void clear_command_queue(); void clear_command_queue();
extern millis_t previous_cmd_ms; extern millis_t previous_cmd_ms;

35
Marlin/Marlin_main.cpp

@ -795,39 +795,6 @@ inline void echo_command(const char* cmd) {
SERIAL_EOL; SERIAL_EOL;
} }
/**
* Shove a command in RAM to the front of the main command queue.
* Return true if the command is successfully added.
*/
inline bool _shovecommand(const char* cmd, bool say_ok=false) {
if (*cmd == ';' || commands_in_queue >= BUFSIZE) return false;
cmd_queue_index_r = (cmd_queue_index_r + BUFSIZE - 1) % BUFSIZE; // Index of the previous slot
commands_in_queue++;
strcpy(command_queue[cmd_queue_index_r], cmd);
send_ok[cmd_queue_index_r] = say_ok;
return true;
}
/**
* Shove a command to the front of the queue with Serial Echo
* Return true if the command is successfully added.
*/
bool shove_and_echo_command(const char* cmd, bool say_ok=false) {
if (_shovecommand(cmd, say_ok)) {
echo_command(cmd);
return true;
}
return false;
}
/**
* Shove a command onto the front of the queue,
* and don't return until successful.
*/
void shove_and_echo_command_now(const char* cmd) {
while (!shove_and_echo_command(cmd)) idle();
}
/** /**
* Inject the next "immediate" command, when possible, onto the front of the queue. * Inject the next "immediate" command, when possible, onto the front of the queue.
* Return true if any immediate commands remain to inject. * Return true if any immediate commands remain to inject.
@ -840,7 +807,7 @@ static bool drain_injected_commands_P() {
cmd[sizeof(cmd) - 1] = '\0'; cmd[sizeof(cmd) - 1] = '\0';
while ((c = cmd[i]) && c != '\n') i++; // find the end of this gcode command while ((c = cmd[i]) && c != '\n') i++; // find the end of this gcode command
cmd[i] = '\0'; cmd[i] = '\0';
if (shove_and_echo_command(cmd)) // success? if (enqueue_and_echo_command(cmd)) // success?
injected_commands_P = c ? injected_commands_P + i + 1 : NULL; // next command or done injected_commands_P = c ? injected_commands_P + i + 1 : NULL; // next command or done
} }
return (injected_commands_P != NULL); // return whether any more remain return (injected_commands_P != NULL); // return whether any more remain

Loading…
Cancel
Save