Add SRAM command injection (#17459)
This commit is contained in:
@@ -66,11 +66,30 @@ public:
|
||||
static void clear();
|
||||
|
||||
/**
|
||||
* Enqueue one or many commands to run from program memory.
|
||||
* Aborts the current queue, if any.
|
||||
* Note: process_injected_command() will process them.
|
||||
* Next Injected Command (PROGMEM) pointer. (nullptr == empty)
|
||||
* Internal commands are enqueued ahead of serial / SD commands.
|
||||
*/
|
||||
static void inject_P(PGM_P const pgcode);
|
||||
static PGM_P injected_commands_P;
|
||||
|
||||
/**
|
||||
* Injected Commands (SRAM)
|
||||
*/
|
||||
static char injected_commands[64];
|
||||
|
||||
/**
|
||||
* Enqueue command(s) to run from PROGMEM. Drained by process_injected_command_P().
|
||||
* Don't inject comments or use leading spaces!
|
||||
* Aborts the current PROGMEM queue so only use for one or two commands.
|
||||
*/
|
||||
static inline void inject_P(PGM_P const pgcode) { injected_commands_P = pgcode; }
|
||||
|
||||
/**
|
||||
* Enqueue command(s) to run from SRAM. Drained by process_injected_command().
|
||||
* Aborts the current SRAM queue so only use for one or two commands.
|
||||
*/
|
||||
static inline void inject(char * const gcode) {
|
||||
strncpy(injected_commands, gcode, sizeof(injected_commands) - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue and return only when commands are actually enqueued
|
||||
@@ -145,7 +164,10 @@ private:
|
||||
#endif
|
||||
);
|
||||
|
||||
// Process the next "immediate" command
|
||||
// Process the next "immediate" command (PROGMEM)
|
||||
static bool process_injected_command_P();
|
||||
|
||||
// Process the next "immediate" command (SRAM)
|
||||
static bool process_injected_command();
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user