Changed M401 to M0/M1 as suggested, so they match normal CNC stop commands.

This commit is contained in:
Daid 2012-05-20 14:37:30 +02:00
parent b59724e42b
commit 4d7fe7115f

View File

@ -56,6 +56,8 @@
// G92 - Set current position to cordinates given // G92 - Set current position to cordinates given
//RepRap M Codes //RepRap M Codes
// M0 - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
// M1 - Same as M0
// M104 - Set extruder target temp // M104 - Set extruder target temp
// M105 - Read current temp // M105 - Read current temp
// M106 - Fan on // M106 - Fan on
@ -107,7 +109,6 @@
// M302 - Allow cold extrudes // M302 - Allow cold extrudes
// M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C) // M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
// M400 - Finish all moves // M400 - Finish all moves
// M401 - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
// M500 - stores paramters in EEPROM // M500 - stores paramters in EEPROM
// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily). // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
@ -709,6 +710,35 @@ void process_commands()
{ {
switch( (int)code_value() ) switch( (int)code_value() )
{ {
#ifdef ULTRA_LCD
case 0: // M0 - Unconditional stop - Wait for user button press on LCD
case 1: // M1 - Conditional stop - Wait for user button press on LCD
{
LCD_MESSAGEPGM(MSG_USERWAIT);
codenum = 0;
if(code_seen('P')) codenum = code_value(); // milliseconds to wait
if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait
st_synchronize();
previous_millis_cmd = millis();
if (codenum > 0)
{
codenum += millis(); // keep track of when we started waiting
while(millis() < codenum && !CLICKED){
manage_heater();
manage_inactivity(1);
LCD_STATUS;
}
}else{
while(!CLICKED) {
manage_heater();
manage_inactivity(1);
LCD_STATUS;
}
}
}
break;
#endif
case 17: case 17:
LCD_MESSAGEPGM(MSG_NO_MOVE); LCD_MESSAGEPGM(MSG_NO_MOVE);
enable_x(); enable_x();
@ -1266,34 +1296,6 @@ void process_commands()
st_synchronize(); st_synchronize();
} }
break; break;
#ifdef ULTRA_LCD
case 401: // M401 - Wait for user button press on LCD
{
LCD_MESSAGEPGM(MSG_USERWAIT);
codenum = 0;
if(code_seen('P')) codenum = code_value(); // milliseconds to wait
if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait
st_synchronize();
previous_millis_cmd = millis();
if (codenum > 0)
{
codenum += millis(); // keep track of when we started waiting
while(millis() < codenum && !CLICKED){
manage_heater();
manage_inactivity(1);
LCD_STATUS;
}
}else{
while(!CLICKED) {
manage_heater();
manage_inactivity(1);
LCD_STATUS;
}
}
}
break;
#endif
case 500: // Store settings in EEPROM case 500: // Store settings in EEPROM
{ {
EEPROM_StoreSettings(); EEPROM_StoreSettings();