summaryrefslogtreecommitdiff
path: root/Tonokip_Firmware
diff options
context:
space:
mode:
authorNils <bacardicoke@gmail.com>2011-05-12 14:26:31 +0200
committerNils <bacardicoke@gmail.com>2011-05-12 14:26:31 +0200
commit38660dbd399746bbd2c042755e5b1ffc5ffce457 (patch)
tree09af4afae798b0191d86c665be9b350ca5a1b880 /Tonokip_Firmware
parent140f11833c8102f761e7d13b3962dd4f542818ac (diff)
Adding experimental support for max temperature gueard (M143)
Diffstat (limited to 'Tonokip_Firmware')
-rw-r--r--Tonokip_Firmware/Tonokip_Firmware.pde14
-rw-r--r--Tonokip_Firmware/configuration.h7
2 files changed, 21 insertions, 0 deletions
diff --git a/Tonokip_Firmware/Tonokip_Firmware.pde b/Tonokip_Firmware/Tonokip_Firmware.pde
index 9c395f8..c1f11dd 100644
--- a/Tonokip_Firmware/Tonokip_Firmware.pde
+++ b/Tonokip_Firmware/Tonokip_Firmware.pde
@@ -83,6 +83,7 @@ void kill(byte debug);
// M92 - Set axis_steps_per_unit - same syntax as G92
// M115 - Capabilities string
// M140 - Set bed target temp
+// M143 - Set maximum hot-end temperature
// M190 - Wait for bed current temp to reach target temp.
@@ -170,6 +171,9 @@ unsigned long watchmillis=0;
#ifdef MINTEMP
int minttemp=temp2analog(MINTEMP);
#endif
+#ifdef MAXTEMP
+int maxttemp=temp2analog(MAXTEMP);
+#endif
//Inactivity shutdown variables
unsigned long previous_millis_cmd=0;
@@ -693,6 +697,9 @@ inline void process_commands()
case 140: // M140 set bed temp
if (code_seen('S')) target_bed_raw = temp2analogBed(code_value());
break;
+ case 143: // M143 set maximum hotend temperature
+ if (code_seen('S')) maxttemp = temp2analog(code_value());
+ break;
case 105: // M105
#if (TEMP_0_PIN>-1) || defined (HEATER_USES_MAX6675)
tt=analog2temp(current_raw);
@@ -1325,6 +1332,12 @@ inline void manage_heater()
if(current_raw<=minttemp)
target_raw=0;
#endif
+ #ifdef MAXTEMP
+ if(current_raw>maxttemp) {
+ // We are too hot. Emergency brake to protect hotend
+ kill(5);
+ }
+ #endif
#if (TEMP_0_PIN > -1) || defined (HEATER_USES_MAX66675)
#ifdef PIDTEMP
error = target_raw - current_raw;
@@ -1528,6 +1541,7 @@ inline void kill(byte debug)
case 2: Serial.print("Linear Move Abort, Last Line: "); break;
case 3: Serial.print("Homing X Min Stop Fail, Last Line: "); break;
case 4: Serial.print("Homing Y Min Stop Fail, Last Line: "); break;
+ case 5: Serial.print("Hot-end overheat protection, Last Line: "); break;
}
Serial.println(gcode_LastN);
delay(5000); // 5 Second delay
diff --git a/Tonokip_Firmware/configuration.h b/Tonokip_Firmware/configuration.h
index 97e94bc..de4d04e 100644
--- a/Tonokip_Firmware/configuration.h
+++ b/Tonokip_Firmware/configuration.h
@@ -61,6 +61,13 @@ float min_constant_speed_units = 2; // the minimum units of an accelerated move
//The minimal temperature defines the temperature below which the heater will not be enabled
//#define MINTEMP
+//Experimental max temp
+//When temperature exceeds max temp, your bot will halt.
+//This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure!
+//You should use MINTEMP for thermistor short/failure protection.
+//Can be customized using M143
+//#define MAXTEMP 275
+
// Select one of these only to define how the nozzle temp is read.
#define HEATER_USES_THERMISTOR
//#define HEATER_USES_AD595