Permalink
Browse files

Merge pull request #1 from Crash1/I2C_LCD

Added temp table #10 for RepRapPro Huxley with 4.7K resistor on hot end ...
  • Loading branch information...
malx122 committed Feb 6, 2012
2 parents d8f314b + b549373 commit 636cc5e7dd4ded4c17d437d95aef995ae121271d
Showing with 188 additions and 5 deletions.
  1. +6 −3 Marlin/Configuration.h
  2. +145 −2 Marlin/Marlin.pde
  3. +37 −0 Marlin/thermistortables.h
View
@@ -44,15 +44,16 @@
//===========================================================================
//// Thermistor settings:
-// 1 is 100k thermistor
+// 1 is 100k thermistor /xmas huxley hot end with 4.7K resistor
// 2 is 200k thermistor
// 3 is mendel-parts thermistor
// 4 is 10k thermistor
// 5 is ParCan supplied 104GT-2 100K
// 6 is EPCOS 100k
// 7 is 100k Honeywell thermistor 135-104LAG-J01
-// 8 is reprappro xmas huxley (RS thermistor 198-961)
-// 9 is reprappro xmas huxley (100k EPCOS)
+// 8 is reprappro xmas huxley hot end (RS thermistor 198-961)
+// 9 is reprappro xmas huxley bed with 10K resistor (100k EPCOS)
+// 10 is reprappro xmas huxley hot end with 4.7K resistor (RS thermistor 198-961)
#define THERMISTORHEATER_0 8
//#define THERMISTORHEATER_1 1
@@ -187,6 +188,8 @@
//===========================================================================
//=============================Mechanical Settings===========================
//===========================================================================
+#define PROBE_PIN 29 //A2
+#define Z_INCREMENT .0040 //Probe Movement Increment - 1 Full step on Huxley = 1/250
// Endstop Settings
View
@@ -195,6 +195,73 @@ static uint8_t tmp_extruder;
//===========================================================================
//=============================ROUTINES=============================
//===========================================================================
+//Crash1 - Probes bed at least twice until distances are similar then takes average of 2
+float Probe_Bed(float x_pos, float y_pos) { //returns Probed Z average height
+ float ProbeDepth[6], ProbeDepthAvg;
+ if (PROBE_PIN > -1 && Z_HOME_DIR==-1){
+ saved_feedrate = feedrate;
+
+ destination[Z_AXIS] = 3; //* Z_HOME_DIR; //Lift over bed for initial Move
+ feedrate = homing_feedrate[Z_AXIS];
+ prepare_move();
+
+ //Move to Probe Coordinates, Use current Position if none given
+ if (x_pos < 0) {destination[X_AXIS] = current_position[X_AXIS];}
+ else {destination[X_AXIS] = x_pos;}
+ if (y_pos < 0) {destination[Y_AXIS] = current_position[Y_AXIS];}
+ else {destination[Y_AXIS] = y_pos;}
+ feedrate = 7500; // 500 is way too slow- WTF - max_feedrate[X_AXIS]; //homing_feedrate[X_AXIS]; //250;
+ prepare_move();
+
+ destination[Z_AXIS] = .75; //* Z_HOME_DIR; //move close to Z Home - bed should be within .75mm of level
+ feedrate = homing_feedrate[Z_AXIS];
+ prepare_move();
+
+ //Plunge down final distance slowly until bed breaks contact and pin true
+ //*******************************************************************************************Bed Loop*************************************
+ for(int8_t i=0; i < 2 ; i++) { //probe 2 or more times to get repeatable reading
+ //2DO If bed currently true then it is stuck - need to do something smart here.
+ int z = 0;
+ while(READ(PROBE_PIN) == false && z < 500){ //if it takes more than 500 steps then something is wrong
+ destination[Z_AXIS] = current_position[Z_AXIS] - Z_INCREMENT; //* Z_HOME_DIR;
+ feedrate = homing_feedrate[Z_AXIS];
+ prepare_move();
+ z++;
+ }
+ //move up in small increments until switch makes
+ z = 0;
+ while(READ(PROBE_PIN) == true && z < 200){ //if it takes more than 100 steps then bed is likely stuck - still need to error on this to stop process
+ destination[Z_AXIS] = current_position[Z_AXIS] + Z_INCREMENT; //* Z_HOME_DIR;
+ feedrate = homing_feedrate[Z_AXIS];
+ prepare_move();
+ z++;
+ }
+//**************************************************************************************************************************************************
+ //if Z is 200 here then we have a stuck bed and it will keep on advancing upward. So send hot end toward Zstop to try to unstick.
+ if (z == 200) {
+ SERIAL_ECHOLN("Poking Stuck Bed:");
+ destination[Z_AXIS] = 1; feedrate = homing_feedrate[Z_AXIS]; prepare_move();
+ destination[Z_AXIS] = .2; feedrate = homing_feedrate[Z_AXIS]; prepare_move();
+ destination[Z_AXIS] = 1; feedrate = homing_feedrate[Z_AXIS]; prepare_move();
+ i--; //Throw out this meaningless probe
+ z == 0;
+ }
+ //*************************************************************************************************************
+ ProbeDepth[i]= current_position[Z_AXIS];
+ if (i == 1 ) {
+ if (abs(ProbeDepth[i] - ProbeDepth[i - 1]) > .02) { //keep going until readings match to avoid sticky bed
+ SERIAL_ECHO("Probing again - difference:"); SERIAL_ECHOLN(abs(ProbeDepth[i] - ProbeDepth[i - 1]));
+ i--; i--; //Throw out both that don't match because we don't know which one is accurate
+ }
+ }
+ feedrate = 0;
+ } //end probe loop
+ }
+ ProbeDepthAvg = (ProbeDepth[0] + ProbeDepth[1]) / 2;
+ SERIAL_ECHO("Z="); SERIAL_ECHOLN(ProbeDepthAvg);
+ return ProbeDepthAvg;
+ }
+//Crash1 END Add Probe Bed Function
void get_arc_coordinates();
@@ -241,6 +308,12 @@ void setup_photpin()
#endif
#endif
}
+void setup_probepin()
+{
+ #if PROBE_PIN > -1
+ SET_INPUT(PROBE_PIN);
+ #endif
+}
void setup()
{
MSerial.begin(BAUDRATE);
@@ -278,12 +351,12 @@ void setup()
#endif
buzzer_init();
setup_photpin();
+ setup_probepin();
#ifdef ULTRA_LCD
lcd_init();
#endif
}
-
void loop()
{
@@ -639,7 +712,77 @@ FORCE_INLINE void process_commands()
previous_millis_cmd = millis();
endstops_hit_on_purpose();
break;
- case 90: // G90
+/*Crash1 - G29 to Probe and stop on Bed
+G29 will probe bed at least twice at 3 points and take an average. G30 will probe bed at it's current location.
+Z stop should be set slightly below bed height. Solder stub wire to each hole in huxley bed and attach a ring terminal under spring.
+Wire bed probe to A2 on Melzi and duplicate cap/resistor circuit in schematic.
+
+Use something like this in the start.gcode file:
+G29 ;Probe bed for Z height
+G92 Z0 ;Set Z to Probed Depth
+G1 Z5 F200 ;Lift Z out of way
+*/
+ case 29:
+ float Probe_Avg, Point1, Point2, Point3;
+ Point1 = Probe_Bed(15, 15);
+ Point2 = Probe_Bed(15, Y_MAX_LENGTH - 15);
+ Point3 = Probe_Bed(X_MAX_LENGTH - 15, Y_MAX_LENGTH/2) ;
+ Probe_Avg = (Point1 + Point2 + Point3) / 3;
+ destination[2] = Probe_Avg;
+ feedrate = homing_feedrate[Z_AXIS];
+ prepare_move();
+ SERIAL_ECHOLN("**************************************");
+ SERIAL_ECHO("Point1 ="); SERIAL_ECHOLN(Point1);
+ SERIAL_ECHO("Point2 ="); SERIAL_ECHOLN(Point2);
+ SERIAL_ECHO("Point3 ="); SERIAL_ECHOLN(Point3);
+ SERIAL_ECHO("Probed Average="); SERIAL_ECHOLN(Probe_Avg);
+ SERIAL_ECHOLN("**************************************");
+ break;
+
+ case 30: //Probe Single Point and then lift 1mm
+ float Point;
+ Point = Probe_Bed(-1,-1);
+ destination[2] = Point +1;
+ feedrate = homing_feedrate[Z_AXIS];
+ prepare_move();
+ SERIAL_ECHOLN("**************************************");
+ SERIAL_ECHO("Probed Z="); SERIAL_ECHOLN(Point);
+ break;
+//Old Sprinter Code
+/* case 29: //G29 to probe and stop
+ saved_feedrate = feedrate;
+ if (PROBE_PIN > -1 && Z_HOME_DIR==-1){
+ current_position[2] = 0;
+ destination[2] = 1.5 * Z_MAX_LENGTH * Z_HOME_DIR;
+ feedrate = homing_feedrate[2];
+ prepare_move();
+
+ //move up in small increments until switch makes
+ int z=0;
+ current_position[2] = 0;
+ SERIAL_ECHO_START;
+ SERIAL_ECHO("ZProbe=");
+ SERIAL_ECHOLN(READ(PROBE_PIN));
+ while(READ(PROBE_PIN) == true && z<400){
+ SERIAL_ECHO("ZProbeLoop=");
+ SERIAL_ECHO(z);
+ SERIAL_ECHO(" Status=");
+ SERIAL_ECHOLN(READ(PROBE_PIN));
+ destination[2] = current_position[2] - Z_INCREMENT * Z_HOME_DIR;
+ prepare_move();
+ z++;
+ }
+ SERIAL_ECHO("Z=");
+ SERIAL_ECHOLN(current_position[2]);
+ //current_position[2] = (Z_HOME_DIR == -1) ? 0 : Z_MAX_LENGTH;
+ //destination[2] = current_position[2];
+ feedrate = 0;
+ }
+ break;
+ */
+ //Crash1 End G29 Probe
+
+ case 90: // G90
relative_mode = false;
break;
case 91: // G91
View
@@ -381,6 +381,43 @@ const short temptable_9[][2] PROGMEM = {
};
#endif
+// Crash1
+// ./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=4700 --beta=3960 --max-adc=1023
+#if (THERMISTORHEATER_0 == 10) || (THERMISTORHEATER_1 == 10) || (THERMISTORHEATER_2 == 10) || (THERMISTORBED == 10) // 198-961 Xmas Huxley Hotend 4.7K resistor
+const short temptable_10[][2] PROGMEM = {
+ {1*OVERSAMPLENR, 929},
+ {36*OVERSAMPLENR, 299},
+ {71*OVERSAMPLENR, 246},
+ {106*OVERSAMPLENR, 217},
+ {141*OVERSAMPLENR, 198},
+ {176*OVERSAMPLENR, 184},
+ {211*OVERSAMPLENR, 173},
+ {246*OVERSAMPLENR, 163},
+ {281*OVERSAMPLENR, 154},
+ {316*OVERSAMPLENR, 147},
+ {351*OVERSAMPLENR, 140},
+ {386*OVERSAMPLENR, 134},
+ {421*OVERSAMPLENR, 128},
+ {456*OVERSAMPLENR, 122},
+ {491*OVERSAMPLENR, 117},
+ {526*OVERSAMPLENR, 112},
+ {561*OVERSAMPLENR, 107},
+ {596*OVERSAMPLENR, 102},
+ {631*OVERSAMPLENR, 97},
+ {666*OVERSAMPLENR, 91},
+ {701*OVERSAMPLENR, 86},
+ {736*OVERSAMPLENR, 81},
+ {771*OVERSAMPLENR, 76},
+ {806*OVERSAMPLENR, 70},
+ {841*OVERSAMPLENR, 63},
+ {876*OVERSAMPLENR, 56},
+ {911*OVERSAMPLENR, 48},
+ {946*OVERSAMPLENR, 38},
+ {981*OVERSAMPLENR, 23},
+ {1016*OVERSAMPLENR, 0}
+ };
+#endif
+
#define _TT_NAME(_N) temptable_ ## _N
#define TT_NAME(_N) _TT_NAME(_N)

0 comments on commit 636cc5e

Please sign in to comment.