summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Tonokip_Firmware/BedThermistorTable_100k.h2
-rw-r--r--Tonokip_Firmware/BedThermistorTable_200k.h2
-rw-r--r--Tonokip_Firmware/ThermistorTable_100k.h2
-rw-r--r--Tonokip_Firmware/ThermistorTable_200k.h2
-rw-r--r--Tonokip_Firmware/ThermistorTable_mendelparts.h63
-rw-r--r--Tonokip_Firmware/Tonokip_Firmware.pde84
-rw-r--r--Tonokip_Firmware/configuration.h3
7 files changed, 87 insertions, 71 deletions
diff --git a/Tonokip_Firmware/BedThermistorTable_100k.h b/Tonokip_Firmware/BedThermistorTable_100k.h
index f607f4e..84bc607 100644
--- a/Tonokip_Firmware/BedThermistorTable_100k.h
+++ b/Tonokip_Firmware/BedThermistorTable_100k.h
@@ -15,7 +15,7 @@
// max adc: 1023
#define BNUMTEMPS 61
-short bedtemptable[BNUMTEMPS][2] = {
+const short bedtemptable[BNUMTEMPS][2] = {
{ 23 , 300 },
{ 25 , 295 },
{ 27 , 290 },
diff --git a/Tonokip_Firmware/BedThermistorTable_200k.h b/Tonokip_Firmware/BedThermistorTable_200k.h
index 79c9ea4..3d96aa3 100644
--- a/Tonokip_Firmware/BedThermistorTable_200k.h
+++ b/Tonokip_Firmware/BedThermistorTable_200k.h
@@ -15,7 +15,7 @@
// max adc: 1023
#define BNUMTEMPS 20
-short bedtemptable[BNUMTEMPS][2] = {
+const short bedtemptable[BNUMTEMPS][2] = {
{1, 848},
{54, 275},
{107, 228},
diff --git a/Tonokip_Firmware/ThermistorTable_100k.h b/Tonokip_Firmware/ThermistorTable_100k.h
index 3762b6a..d0698b2 100644
--- a/Tonokip_Firmware/ThermistorTable_100k.h
+++ b/Tonokip_Firmware/ThermistorTable_100k.h
@@ -15,7 +15,7 @@
// max adc: 1023
#define NUMTEMPS 61
-short temptable[NUMTEMPS][2] = {
+const short temptable[NUMTEMPS][2] = {
{ 23 , 300 },
{ 25 , 295 },
{ 27 , 290 },
diff --git a/Tonokip_Firmware/ThermistorTable_200k.h b/Tonokip_Firmware/ThermistorTable_200k.h
index ef68b5f..4142eb2 100644
--- a/Tonokip_Firmware/ThermistorTable_200k.h
+++ b/Tonokip_Firmware/ThermistorTable_200k.h
@@ -15,7 +15,7 @@
// max adc: 1023
#define NUMTEMPS 20
-short temptable[NUMTEMPS][2] = {
+const short temptable[NUMTEMPS][2] = {
{1, 848},
{54, 275},
{107, 228},
diff --git a/Tonokip_Firmware/ThermistorTable_mendelparts.h b/Tonokip_Firmware/ThermistorTable_mendelparts.h
index 68766ad..9e65b85 100644
--- a/Tonokip_Firmware/ThermistorTable_mendelparts.h
+++ b/Tonokip_Firmware/ThermistorTable_mendelparts.h
@@ -2,31 +2,44 @@
#define THERMISTORTABLE_H_
//thermistor table for mendel-parts thermistor
-
-#define NUMTEMPS 20
-short temptable[NUMTEMPS][2] = {
- {1, 827},
- {54, 253},
- {107, 207},
- {160, 182},
- {213, 165},
- {266, 152},
- {319, 141},
- {372, 132},
- {425, 123},
- {478, 115},
- {531, 107},
- {584, 100},
- {637, 93},
- {690, 86},
- {743, 78},
- {796, 70},
- {849, 61},
- {902, 49},
- {955, 34},
- {1008, 3}
-};
+// Standardized R/T characteristic no. 8404
+ // RS thermistor 484-0183; EPCOS NTC
+ // Mendel-Parts thermistor G540 / G550
+ // Optimized for 100...300C working range.
+ // Max range: -20...300C
+ // Max reading error on Gen 6 electronics: ~+5%, -3% in 100 - 300C range.
+
+#define NUMTEMPS 28
+const short temptable[NUMTEMPS][2] = {
+ {1,864},
+ {21,300},
+ {25,290},
+ {29,280},
+ {33,270},
+ {39,260},
+ {46,250},
+ {54,240},
+ {64,230},
+ {75,220},
+ {90,210},
+ {107,200},
+ {128,190},
+ {154,180},
+ {184,170},
+ {221,160},
+ {265,150},
+ {316,140},
+ {375,130},
+ {441,120},
+ {513,110},
+ {588,100},
+ {734,80},
+ {856,60},
+ {938,40},
+ {986,20},
+ {1008,0},
+ {1018,-20}
+ };
#endif
-
diff --git a/Tonokip_Firmware/Tonokip_Firmware.pde b/Tonokip_Firmware/Tonokip_Firmware.pde
index 587d648..8765267 100644
--- a/Tonokip_Firmware/Tonokip_Firmware.pde
+++ b/Tonokip_Firmware/Tonokip_Firmware.pde
@@ -48,7 +48,6 @@
// M84 - Disable steppers until next move,
// or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout.
// M85 - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
-// M86 - If Endstop is Not Activated then Abort Print. Specify X and/or Y
// M92 - Set axis_steps_per_unit - same syntax as G92
// M115 - Capabilities string
// M140 - Set bed target temp
@@ -297,11 +296,14 @@ void loop()
buflen = (buflen-1);
bufindr = (bufindr + 1)%BUFSIZE;
}
-
- manage_heater();
-
- manage_inactivity(1); //shutdown if not receiving any new commands
-}
+ //check heater every n milliseconds
+ if((millis() - previous_millis_heater) >= HEATER_CHECK_INTERVAL ) {
+ manage_heater();
+ previous_millis_heater = millis();
+
+ manage_inactivity(1);
+ }
+ }
inline void get_command()
@@ -463,8 +465,13 @@ inline void process_commands()
codenum = 0;
if(code_seen('P')) codenum = code_value(); // milliseconds to wait
if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait
- previous_millis_heater = millis(); // keep track of when we started waiting
- while((millis() - previous_millis_heater) < codenum ) manage_heater(); //manage heater until time is up
+ codenum += millis(); // keep track of when we started waiting
+ while(millis() < codenum ){
+ if((millis() - previous_millis_heater) >= HEATER_CHECK_INTERVAL ) {
+ manage_heater();
+ previous_millis_heater = millis();
+ }
+ }
break;
case 28: //G28 Home all Axis one at a time
saved_feedrate = feedrate;
@@ -692,23 +699,26 @@ inline void process_commands()
watchmillis = 0;
}
#endif
- previous_millis_heater = millis();
+ codenum = millis();
while(current_raw < target_raw) {
- if( (millis() - previous_millis_heater) > 1000 ) //Print Temp Reading every 1 second while heating up.
+ if( (millis() - codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
{
Serial.print("T:");
Serial.println( analog2temp(current_raw) );
- previous_millis_heater = millis();
+ codenum = millis();
+ }
+ if((millis() - previous_millis_heater) >= HEATER_CHECK_INTERVAL ) {
+ manage_heater();
+ previous_millis_heater = millis();
}
- manage_heater();
}
break;
case 190: // M190 - Wait bed for heater to reach target.
#if TEMP_1_PIN > -1
if (code_seen('S')) target_bed_raw = temp2analog(code_value());
- previous_millis_heater = millis();
+ codenum = millis();
while(current_bed_raw < target_bed_raw) {
- if( (millis()-previous_millis_heater) > 1000 ) //Print Temp Reading every 1 second while heating up.
+ if( (millis()-codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
{
tt=analog2temp(current_raw);
Serial.print("T:");
@@ -717,9 +727,12 @@ inline void process_commands()
Serial.print( tt );
Serial.print(" B:");
Serial.println( analog2temp(current_bed_raw) );
- previous_millis_heater = millis();
+ codenum = millis();
+ }
+ if((millis() - previous_millis_heater) >= HEATER_CHECK_INTERVAL ) {
+ manage_heater();
+ previous_millis_heater = millis();
}
- manage_heater();
}
#endif
break;
@@ -756,10 +769,6 @@ inline void process_commands()
code_seen('S');
max_inactive_time = code_value() * 1000;
break;
- case 86: // M86 If Endstop is Not Activated then Abort Print
- if(code_seen('X')) if( digitalRead(X_MIN_PIN) == ENDSTOPS_INVERTING ) kill(3);
- if(code_seen('Y')) if( digitalRead(Y_MIN_PIN) == ENDSTOPS_INVERTING ) kill(4);
- break;
case 92: // M92
if(code_seen('X')) x_steps_per_unit = code_value();
if(code_seen('Y')) y_steps_per_unit = code_value();
@@ -1069,8 +1078,8 @@ void linear_move(unsigned long x_steps_remaining, unsigned long y_steps_remainin
//move until no more steps remain
while(x_steps_remaining + y_steps_remaining + z_steps_remaining + e_steps_remaining > 0) {
- //If more that 50ms have passed since previous heating check, adjust temp
- if((millis() - previous_millis_heater) >= 50 ) {
+ //If more that HEATER_CHECK_INTERVAL ms have passed since previous heating check, adjust temp
+ if((millis() - previous_millis_heater) >= HEATER_CHECK_INTERVAL ) {
manage_heater();
previous_millis_heater = millis();
@@ -1380,9 +1389,8 @@ inline void manage_heater()
target_raw = 0;
#endif
#ifdef MAXTEMP
- if(current_raw > maxttemp) {
- // We are too hot. Emergency brake to protect hotend
- kill(5);
+ if(current_raw >= maxttemp) {
+ target_raw = 0;
}
#endif
#if (TEMP_0_PIN > -1) || defined (HEATER_USES_MAX66675)
@@ -1568,11 +1576,16 @@ float analog2tempBed(int raw) {
#endif
}
-inline void kill(byte debug)
+inline void kill()
{
- if(HEATER_0_PIN > -1) digitalWrite(HEATER_0_PIN,LOW);
+ #if TEMP_0_PIN > -1
+ target_raw=0;
+ digitalWrite(HEATER_0_PIN,LOW);
+ #endif
+ #if TEMP_1_PIN > -1
+ target_bed_raw=0;
if(HEATER_1_PIN > -1) digitalWrite(HEATER_1_PIN,LOW);
-
+ #endif
disable_x();
disable_y();
disable_z();
@@ -1580,22 +1593,9 @@ inline void kill(byte debug)
if(PS_ON_PIN > -1) pinMode(PS_ON_PIN,INPUT);
- while(1)
- {
- switch(debug)
- {
- case 1: Serial.print("Inactivity Shutdown, Last Line: "); break;
- 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
- }
}
inline void manage_inactivity(byte debug) {
-if( (millis()-previous_millis_cmd) > max_inactive_time ) if(max_inactive_time) kill(debug);
+if( (millis()-previous_millis_cmd) > max_inactive_time ) if(max_inactive_time) kill();
if( (millis()-previous_millis_cmd) > stepper_inactive_time ) if(stepper_inactive_time) { disable_x(); disable_y(); disable_z(); disable_e(); }
}
diff --git a/Tonokip_Firmware/configuration.h b/Tonokip_Firmware/configuration.h
index c83c63e..eab2e46 100644
--- a/Tonokip_Firmware/configuration.h
+++ b/Tonokip_Firmware/configuration.h
@@ -50,6 +50,9 @@ float min_constant_speed_units = 2; // the minimum units of an accelerated move
#define PID_DGAIN 100 //100 is 1.0
#endif
+//How often should the heater check for new temp readings, in milliseconds
+#define HEATER_CHECK_INTERVAL 50
+
//Experimental temperature smoothing - only uncomment this if your temp readings are noisy
//#define SMOOTHING 1
//#define SMOOTHFACTOR 16 //best to use a power of two here - determines how many values are averaged together by the smoothing algorithm