summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidopple <mdoppler@gmx.at>2012-05-28 05:30:43 -0700
committermidopple <mdoppler@gmx.at>2012-05-28 05:30:43 -0700
commitaab62de29c0076cf69d589f6999f6c31c06119c4 (patch)
tree991c3c13c73aa8aa191d9a7559593c73873fcb54
parent9af0980080a97e572c21ad6ab2278116f78aec48 (diff)
parent9c708af22ec71ca97bbfe18cbb6d1c868faea9a9 (diff)
Merge pull request #176 from blddk/experimental
Error with DELAY_ENABLE Thanks to blddk
-rw-r--r--Sprinter/Configuration.h3
-rw-r--r--Sprinter/Sprinter.pde4
-rw-r--r--Sprinter/heater.cpp29
3 files changed, 34 insertions, 2 deletions
diff --git a/Sprinter/Configuration.h b/Sprinter/Configuration.h
index ccf2762..5d5d78e 100644
--- a/Sprinter/Configuration.h
+++ b/Sprinter/Configuration.h
@@ -362,6 +362,9 @@ const int dropsegments=5; //everything with less than this number of steps will
//#define CONTROLLERFAN_PIN 23 //Pin used for the fan to cool controller, comment out to disable this function
#define CONTROLLERFAN_SEC 60 //How many seconds, after all motors were disabled, the fan should run
+//This is for controlling a fan that will keep the extruder cool.
+//#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
//-----------------------------------------------------------------------
// DEBUGING
diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde
index 8801973..e76f1c4 100644
--- a/Sprinter/Sprinter.pde
+++ b/Sprinter/Sprinter.pde
@@ -2502,12 +2502,12 @@ void plan_buffer_line(float x, float y, float z, float e, float feed_rate)
enable_y();
delayMicroseconds(DELAY_ENABLE);
}
- if(if(block->steps_z != 0))
+ if(block->steps_z != 0)
{
enable_z();
delayMicroseconds(DELAY_ENABLE);
}
- if(if(block->steps_e != 0))
+ if(block->steps_e != 0)
{
enable_e();
delayMicroseconds(DELAY_ENABLE);
diff --git a/Sprinter/heater.cpp b/Sprinter/heater.cpp
index ebab2a5..69e9e86 100644
--- a/Sprinter/heater.cpp
+++ b/Sprinter/heater.cpp
@@ -32,6 +32,10 @@
void controllerFan(void);
#endif
+#ifdef EXTRUDERFAN_PIN
+ void extruderFan(void);
+#endif
+
// Manage heater variables. For a thermistor or AD595 thermocouple, raw values refer to the
// reading from the analog pin. For a MAX6675 thermocouple, the raw value is the temperature in 0.25
// degree increments (i.e. 100=25 deg).
@@ -734,6 +738,10 @@ void PID_autotune(int PIDAT_test_temp)
controllerFan(); //Check if fan should be turned on to cool stepper drivers down
#endif
+#ifdef EXTRUDERFAN_PIN
+ extruderFan(); //Check if fan should be turned on to cool extruder down
+#endif
+
}
#if defined (HEATER_USES_THERMISTOR) || defined (BED_USES_THERMISTOR)
@@ -844,3 +852,24 @@ void controllerFan()
}
#endif
+#ifdef EXTRUDERFAN_PIN
+unsigned long lastExtruderCheck = 0;
+
+void extruderFan()
+{
+ if ((millis() - lastExtruderCheck) >= 2500) //Not a time critical function, so we only check every 2500ms
+ {
+ lastExtruderCheck = millis();
+
+ if (analog2temp(current_raw) < EXTRUDERFAN_DEC)
+ {
+ WRITE(EXTRUDERFAN_PIN, LOW); //... turn the fan off
+ }
+ else
+ {
+ WRITE(EXTRUDERFAN_PIN, HIGH); //... turn the fan on
+ }
+ }
+}
+#endif
+