summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkliment <kliment.yanev@gmail.com>2012-07-10 09:57:05 -0700
committerkliment <kliment.yanev@gmail.com>2012-07-10 09:57:05 -0700
commit9fe56bac47bb01f5412e12ed31a3d74b31b29040 (patch)
treeba5a01ab1f6e62b555b351f85adfd56774087d0b
parentd98317e2136c9b61a68b83fee8af863980cdb3bb (diff)
parent982796f9f023ca158593a52348224ec3faf99a84 (diff)
Merge pull request #198 from blddk/experimental
Synchronize before certain commands are executed if chain of command is defined
-rw-r--r--Sprinter/Configuration.h2
-rw-r--r--Sprinter/Sprinter.pde23
2 files changed, 24 insertions, 1 deletions
diff --git a/Sprinter/Configuration.h b/Sprinter/Configuration.h
index f5a5730..aca24e1 100644
--- a/Sprinter/Configuration.h
+++ b/Sprinter/Configuration.h
@@ -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
//-----------------------------------------------------------------------
diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde
index cc0ed44..3620030 100644
--- a/Sprinter/Sprinter.pde
+++ b/Sprinter/Sprinter.pde
@@ -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 \ No newline at end of file