summaryrefslogtreecommitdiff
path: root/Tonokip_Firmware
diff options
context:
space:
mode:
authorjohnnyr <thehdesk@gmail.com>2010-11-10 11:23:12 -0800
committerjohnnyr <thehdesk@gmail.com>2010-11-10 11:23:12 -0800
commit38afe46c0bf866547f1751f25912c28b4eb9a2e5 (patch)
treef0eb11c94184dec16c069eedc29eb5776bcbd22a /Tonokip_Firmware
parent85fe968aeb84a3d72be823a5018d01dac1635756 (diff)
Added Fan control
Diffstat (limited to 'Tonokip_Firmware')
-rw-r--r--Tonokip_Firmware/Tonokip_Firmware.pde22
1 files changed, 19 insertions, 3 deletions
diff --git a/Tonokip_Firmware/Tonokip_Firmware.pde b/Tonokip_Firmware/Tonokip_Firmware.pde
index 71d495b..0b12188 100644
--- a/Tonokip_Firmware/Tonokip_Firmware.pde
+++ b/Tonokip_Firmware/Tonokip_Firmware.pde
@@ -20,6 +20,8 @@
//RepRap M Codes
// M104 - Set target temp
// M105 - Read current temp
+// M106 - Fan on
+// M107 - Fan off
// M109 - Wait for current temp to reach target temp.
//Custom M Codes
@@ -301,6 +303,12 @@ inline void process_commands()
manage_heater();
}
break;
+ case 106: //M106 Fan On
+ digitalWrite(FAN_PIN, HIGH);
+ break;
+ case 107: //M107 Fan Off
+ digitalWrite(FAN_PIN, LOW);
+ break;
case 80: // M81 - ATX Power On
if(PS_ON_PIN > -1) pinMode(PS_ON_PIN,OUTPUT); //GND
break;
@@ -511,8 +519,16 @@ inline void manage_heater()
current_raw = analogRead(TEMP_0_PIN); // If using thermistor, when the heater is colder than targer temp, we get a higher analog reading than target,
if(USE_THERMISTOR) current_raw = 1023 - current_raw; // this switches it up so that the reading appears lower than target for the control logic.
- if(current_raw >= target_raw) digitalWrite(HEATER_0_PIN,LOW);
- else digitalWrite(HEATER_0_PIN,HIGH);
+ if(current_raw >= target_raw)
+ {
+ digitalWrite(HEATER_0_PIN,LOW);
+ digitalWrite(LED_PIN,LOW);
+ }
+ else
+ {
+ digitalWrite(HEATER_0_PIN,HIGH);
+ digitalWrite(LED_PIN,HIGH);
+ }
}
// Takes temperature value as input and returns corresponding analog value from RepRap thermistor temp table.
@@ -599,4 +615,4 @@ inline void kill(byte debug)
}
}
-inline void manage_inactivity(byte debug) { if( (millis()-previous_millis_cmd) > max_inactive_time ) if(max_inactive_time) kill(debug); }
+inline void manage_inactivity(byte debug) { if( (millis()-previous_millis_cmd) > max_inactive_time ) if(max_inactive_time) kill(debug); } \ No newline at end of file