0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-01-22 17:52:57 +00:00

M110 Get Command Line Number (#27090)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
ellensp 2024-05-20 16:11:30 +12:00 committed by GitHub
parent 75eee04972
commit 5561bafbe6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 3 deletions

View file

@ -135,6 +135,7 @@
#define STR_BUSY_PAUSED_FOR_USER "busy: paused for user"
#define STR_BUSY_PAUSED_FOR_INPUT "busy: paused for input"
#define STR_Z_MOVE_COMP "Z_move_comp"
#define STR_LINE_NO "Line: "
#define STR_RESEND "Resend: "
#define STR_UNKNOWN_COMMAND "Unknown command: \""
#define STR_ACTIVE_EXTRUDER "Active Extruder: "

View file

@ -143,7 +143,7 @@
* R<temp> Wait for extruder current temp to reach target temp. ** Wait for heating or cooling. **
* If AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F
*
* M110 - Set the current line number. (Used by host printing)
* M110 - Get or set the current line number. (Used by host printing)
* M111 - Set debug flags: "M111 S<flagbits>". See flag bits defined in enum.h.
* M112 - Full Shutdown.
*

View file

@ -24,11 +24,19 @@
#include "../queue.h" // for last_N
/**
* M110: Set Current Line Number
* M110: Get or set Current Line Number
*
* Parameters:
* N<int> Number to set as last-processed command
*
* Without parameters:
* Report the last-processed (not last-received or last-enqueued) command
* (To purge the queue and resume from this line, the host should use 'M999' instead.)
*/
void GcodeSuite::M110() {
if (parser.seenval('N'))
queue.set_current_line_number(parser.value_long());
else
SERIAL_ECHOLNPGM(STR_LINE_NO, queue.get_current_line_number());
}

View file

@ -212,6 +212,11 @@ public:
*/
static void set_current_line_number(long n) { serial_state[ring_buffer.command_port().index].last_N = n; }
/**
* Get the current line number for the last received command
*/
static long get_current_line_number() { return serial_state[ring_buffer.command_port().index].last_N; }
#if ENABLED(BUFFER_MONITORING)
private: