Add an emergency-command parser to MarlinSerial (supporting M108)
Add an emergency-command parser to MarlinSerial's RX interrupt. The parser tries to find and execute M108,M112,M410 before the commands disappear in the RX-buffer. To avoid false positives for M117, comments and commands followed by filenames (M23, M28, M30, M32, M33) are filtered. This enables Marlin to receive and react on the Emergency command at all times - regardless of whether the buffers are full or not. It remains to convince hosts to send the commands. To inform the hosts about the new feature a new entry in the M115-report was made. "`EMERGENCY_CODES:M112,M108,M410;`". The parser is fast. It only ever needs two switch decisions and one assignment of the new state for every character. One problem remains. If the host has sent an incomplete line before sending an emergency command the emergency command could be omitted when the parser is in `state_IGNORE`. In that case the host should send "\ncommand\n" Also introduces M108 to break the waiting for the heaters in M109, M190 and M303. Rename `cancel_heatup` to `wait_for_heatup` to better see the purpose.
This commit is contained in:
@ -522,6 +522,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
|
||||
#define MAX_CMD_SIZE 96
|
||||
#define BUFSIZE 4
|
||||
|
||||
// Enable an emergency-command parser to intercept certain commands as they
|
||||
// enter the serial receive buffer, so they cannot be blocked.
|
||||
// Currently handles M108, M112, M410
|
||||
// Does not work on boards using AT90USB (USBCON) processors!
|
||||
//#define EMERGENCY_PARSER
|
||||
|
||||
// Bad Serial-connections can miss a received command by sending an 'ok'
|
||||
// Therefore some clients abort after 30 seconds in a timeout.
|
||||
// Some other clients start sending commands while receiving a 'wait'.
|
||||
|
@ -522,6 +522,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
|
||||
#define MAX_CMD_SIZE 96
|
||||
#define BUFSIZE 4
|
||||
|
||||
// Enable an emergency-command parser to intercept certain commands as they
|
||||
// enter the serial receive buffer, so they cannot be blocked.
|
||||
// Currently handles M108, M112, M410
|
||||
// Does not work on boards using AT90USB (USBCON) processors!
|
||||
//#define EMERGENCY_PARSER
|
||||
|
||||
// Bad Serial-connections can miss a received command by sending an 'ok'
|
||||
// Therefore some clients abort after 30 seconds in a timeout.
|
||||
// Some other clients start sending commands while receiving a 'wait'.
|
||||
|
@ -521,6 +521,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
|
||||
#define MAX_CMD_SIZE 96
|
||||
#define BUFSIZE 4
|
||||
|
||||
// Enable an emergency-command parser to intercept certain commands as they
|
||||
// enter the serial receive buffer, so they cannot be blocked.
|
||||
// Currently handles M108, M112, M410
|
||||
// Does not work on boards using AT90USB (USBCON) processors!
|
||||
//#define EMERGENCY_PARSER
|
||||
|
||||
// Bad Serial-connections can miss a received command by sending an 'ok'
|
||||
// Therefore some clients abort after 30 seconds in a timeout.
|
||||
// Some other clients start sending commands while receiving a 'wait'.
|
||||
|
@ -526,6 +526,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
|
||||
#define MAX_CMD_SIZE 96
|
||||
#define BUFSIZE 4
|
||||
|
||||
// Enable an emergency-command parser to intercept certain commands as they
|
||||
// enter the serial receive buffer, so they cannot be blocked.
|
||||
// Currently handles M108, M112, M410
|
||||
// Does not work on boards using AT90USB (USBCON) processors!
|
||||
//#define EMERGENCY_PARSER
|
||||
|
||||
// Bad Serial-connections can miss a received command by sending an 'ok'
|
||||
// Therefore some clients abort after 30 seconds in a timeout.
|
||||
// Some other clients start sending commands while receiving a 'wait'.
|
||||
|
@ -522,6 +522,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
|
||||
#define MAX_CMD_SIZE 96
|
||||
#define BUFSIZE 4
|
||||
|
||||
// Enable an emergency-command parser to intercept certain commands as they
|
||||
// enter the serial receive buffer, so they cannot be blocked.
|
||||
// Currently handles M108, M112, M410
|
||||
// Does not work on boards using AT90USB (USBCON) processors!
|
||||
//#define EMERGENCY_PARSER
|
||||
|
||||
// Bad Serial-connections can miss a received command by sending an 'ok'
|
||||
// Therefore some clients abort after 30 seconds in a timeout.
|
||||
// Some other clients start sending commands while receiving a 'wait'.
|
||||
|
Reference in New Issue
Block a user