Merge pull request #198 from blddk/experimental

Synchronize before certain commands are executed if chain of command is defined
This commit is contained in:
kliment 2012-07-10 09:57:05 -07:00
commit 9fe56bac47
2 changed files with 24 additions and 1 deletions

View file

@ -369,6 +369,8 @@ const int dropsegments=5; //everything with less than this number of steps will
//#define EXTRUDERFAN_PIN 66 //Pin used to control the fan, comment out to disable this function
#define EXTRUDERFAN_DEC 50 //Hotend temperature from where the fan will be turned on
//#define CHAIN_OF_COMMAND 1 //Finish buffered moves before executing M42, fan speed, heater target, and so...
//-----------------------------------------------------------------------
// DEBUGING
//-----------------------------------------------------------------------

View file

@ -1421,6 +1421,9 @@ FORCE_INLINE void process_commands()
case 42: //M42 -Change pin status via gcode
if (code_seen('S'))
{
#ifdef CHAIN_OF_COMMAND
st_synchronize(); // wait for all movements to finish
#endif
int pin_status = code_value();
if (code_seen('P') && pin_status >= 0 && pin_status <= 255)
{
@ -1444,6 +1447,9 @@ FORCE_INLINE void process_commands()
}
break;
case 104: // M104
#ifdef CHAIN_OF_COMMAND
st_synchronize(); // wait for all movements to finish
#endif
if (code_seen('S')) target_raw = temp2analogh(target_temp = code_value());
#ifdef WATCHPERIOD
if(target_raw > current_raw)
@ -1458,6 +1464,9 @@ FORCE_INLINE void process_commands()
#endif
break;
case 140: // M140 set bed temp
#ifdef CHAIN_OF_COMMAND
st_synchronize(); // wait for all movements to finish
#endif
#if TEMP_1_PIN > -1 || defined BED_USES_AD595
if (code_seen('S')) target_bed_raw = temp2analogBed(code_value());
#endif
@ -1500,6 +1509,9 @@ FORCE_INLINE void process_commands()
return;
//break;
case 109: { // M109 - Wait for extruder heater to reach target.
#ifdef CHAIN_OF_COMMAND
st_synchronize(); // wait for all movements to finish
#endif
if (code_seen('S')) target_raw = temp2analogh(target_temp = code_value());
#ifdef WATCHPERIOD
if(target_raw>current_raw)
@ -1550,6 +1562,9 @@ FORCE_INLINE void process_commands()
}
break;
case 190: // M190 - Wait for bed heater to reach target temperature.
#ifdef CHAIN_OF_COMMAND
st_synchronize(); // wait for all movements to finish
#endif
#if TEMP_1_PIN > -1
if (code_seen('S')) target_bed_raw = temp2analogBed(code_value());
codenum = millis();
@ -1573,6 +1588,9 @@ FORCE_INLINE void process_commands()
break;
#if FAN_PIN > -1
case 106: //M106 Fan On
#ifdef CHAIN_OF_COMMAND
st_synchronize(); // wait for all movements to finish
#endif
if (code_seen('S'))
{
unsigned char l_fan_code_val = constrain(code_value(),0,255);
@ -1627,6 +1645,9 @@ FORCE_INLINE void process_commands()
SET_OUTPUT(PS_ON_PIN); //GND
break;
case 81: // M81 - ATX Power Off
#ifdef CHAIN_OF_COMMAND
st_synchronize(); // wait for all movements to finish
#endif
SET_INPUT(PS_ON_PIN); //Floating
break;
#endif
@ -3508,4 +3529,4 @@ void log_ulong_array(char* message, unsigned long value[], int array_lenght) {
}
Serial.println("}");
}
#endif
#endif