fix move to zero in next move after homing command, add M84 disable motors

This commit is contained in:
Michael Moon 2011-06-22 11:17:48 +10:00
parent fd93109b63
commit 131d7390c0
1 changed files with 33 additions and 14 deletions

View File

@ -5,6 +5,7 @@
*/ */
#include <string.h> #include <string.h>
#include <avr/interrupt.h>
#include "gcode_parse.h" #include "gcode_parse.h"
@ -137,6 +138,16 @@ void process_gcode_command() {
next_tool = next_target.T; next_tool = next_target.T;
} }
// if we didn't see an axis word, set it to startpoint. this fixes incorrect moves after homing
if (next_target.seen_X == 0)
next_target.target.X = startpoint.X;
if (next_target.seen_Y == 0)
next_target.target.Y = startpoint.Y;
if (next_target.seen_Z == 0)
next_target.target.Z = startpoint.Z;
if (next_target.seen_E == 0)
next_target.target.E = startpoint.E;
if (next_target.seen_G) { if (next_target.seen_G) {
uint8_t axisSelected = 0; uint8_t axisSelected = 0;
switch (next_target.G) { switch (next_target.G) {
@ -357,11 +368,24 @@ void process_gcode_command() {
} }
else if (next_target.seen_M) { else if (next_target.seen_M) {
switch (next_target.M) { switch (next_target.M) {
// M0- machine stop
case 0:
// M2- program end // M2- program end
case 2: case 2:
//? ==== M2: program end ==== //? ==== M2: program end ====
//? //?
//? Undocumented. //? Undocumented.
queue_wait();
// no break- we fall through to M112 below
// M112- immediate stop
case 112:
//? ==== M112: Emergency Stop ====
//?
//? Example: M112
//?
//? Any moves in progress are immediately terminated, then RepRap shuts down. All motors and heaters are turned off.
//? It can be started again by pressing the reset button on the master microcontroller. See also M0.
timer_stop(); timer_stop();
queue_flush(); queue_flush();
x_disable(); x_disable();
@ -369,6 +393,7 @@ void process_gcode_command() {
z_disable(); z_disable();
e_disable(); e_disable();
power_off(); power_off();
cli();
for (;;) for (;;)
wd_reset(); wd_reset();
break; break;
@ -380,6 +405,13 @@ void process_gcode_command() {
//? Undocumented. //? Undocumented.
tool = next_tool; tool = next_tool;
break; break;
// M84- stop idle hold
case 84:
x_disable();
y_disable();
z_disable();
e_disable();
break;
// M3/M101- extruder on // M3/M101- extruder on
case 3: case 3:
case 101: case 101:
@ -539,20 +571,7 @@ void process_gcode_command() {
debug_flags = next_target.S; debug_flags = next_target.S;
break; break;
#endif #endif
// M112- immediate stop // M113- extruder PWM
case 112:
//? ==== M112: Emergency Stop ====
//?
//? Example: M112
//?
//? Any moves in progress are immediately terminated, then RepRap shuts down. All motors and heaters are turned off.
//? It can be started again by pressing the reset button on the master microcontroller. See also M0.
timer_stop();
queue_flush();
power_off();
break;
// M113- extruder PWM
// M114- report XYZEF to host // M114- report XYZEF to host
case 114: case 114:
//? ==== M114: Get Current Position ==== //? ==== M114: Get Current Position ====