From 272072fa208e6da3ad6ac80f36073b645be6da9e Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Fri, 14 Mar 2014 23:19:43 +0000 Subject: [PATCH 1/3] Added M112 --- Marlin/Marlin_main.cpp | 3 +++ README.md | 1 + 2 files changed, 4 insertions(+) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index d62447071e..f9bb1c6e15 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1808,6 +1808,9 @@ void process_commands() #endif setWatch(); break; + case 112: // M112 -Emergency Stop + kill(); + break; case 140: // M140 set bed temp if (code_seen('S')) setTargetBed(code_value()); break; diff --git a/README.md b/README.md index 236c312776..443799e0c6 100644 --- a/README.md +++ b/README.md @@ -193,6 +193,7 @@ M Codes * M107 - Fan off * M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating * Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling +* M112 - Emergency stop * M114 - Output current position to serial port * M115 - Capabilities string * M117 - display message From a38c90ee84a1045320759708742942e10f873f64 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Sat, 15 Mar 2014 15:56:15 +0000 Subject: [PATCH 2/3] Added estop handling --- Marlin/Marlin_main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index f9bb1c6e15..f27add1576 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -658,6 +658,12 @@ void get_command() } } + + if(strcmp(cmdbuffer[bufindw], "M112") == 0) + { + kill(); + } + bufindw = (bufindw + 1)%BUFSIZE; buflen += 1; } @@ -3340,6 +3346,9 @@ void handle_status_leds(void) { void manage_inactivity() { + if(buflen < (BUFSIZE-1)) + get_command(); + if( (millis() - previous_millis_cmd) > max_inactive_time ) if(max_inactive_time) kill(); From f643f4d67487e0d4ae190e579e9051e90985516f Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Fri, 21 Mar 2014 20:42:00 +0000 Subject: [PATCH 3/3] Test and refactor --- Marlin/Marlin_main.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index f27add1576..669c7b81b1 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -659,10 +659,9 @@ void get_command() } + //If command was e-stop process now if(strcmp(cmdbuffer[bufindw], "M112") == 0) - { kill(); - } bufindw = (bufindw + 1)%BUFSIZE; buflen += 1;