diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 67091c7172..6660da6c5a 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1,6 +1,23 @@ #ifndef __CONFIGURATION_H #define __CONFIGURATION_H +// Uncomment ONE of the next three lines - the one for your RepRap machine +//#define REPRAPPRO_HUXLEY +#define REPRAPPRO_MENDEL +//#define REPRAPPRO_WALLACE + +#ifndef REPRAPPRO_HUXLEY +#ifndef REPRAPPRO_MENDEL +#ifndef REPRAPPRO_WALLACE +#error Uncomment one of #define REPRAPPRO_HUXLEY, REPRAPPRO_MENDEL or REPRAPPRO_WALLACE at the start of the file Configuration.h +#endif +#endif +#endif + +// Uncomment this if you are experimenting, know what you are doing, and want to switch off some safety +// features, e.g. allow extrude at low temperature etc. +//#define DEVELOPING + // This configurtion file contains the basic settings. // Advanced settings can be found in Configuration_adv.h // BASIC SETTINGS: select your board type, temperature sensor type, axis scaling, and endstop configuration @@ -8,8 +25,8 @@ //User specified version info of THIS file to display in [Pronterface, etc] terminal window during startup. //Implementation of an idea by Prof Braino to inform user that any changes made //to THIS file by the user have been successfully uploaded into firmware. -#define STRING_VERSION_CONFIG_H "2012-05-22-1" //Personal revision number for changes to THIS file. -#define STRING_CONFIG_H_AUTHOR "eMAKER" //Who made the changes. +#define STRING_VERSION_CONFIG_H "2012-06-03-1" //Personal revision number for changes to THIS file. +#define STRING_CONFIG_H_AUTHOR "RepRapPro" //Who made the changes. // This determines the communication speed of the printer #define BAUDRATE 250000 @@ -26,15 +43,59 @@ // Gen6 = 5 // Gen6 deluxe = 51 // Sanguinololu 1.2 and above = 62 +// Melzi 63 // Ultimaker = 7 // Teensylu = 8 // Gen3+ =9 -#define MOTHERBOARD 62 +#define MOTHERBOARD 63 //=========================================================================== //=============================Thermal Settings ============================ //=========================================================================== +// Set this if you want to define the constants in the thermistor circuit +// and work out temperatures algebraically - added by AB. +#define COMPUTE_THERMISTORS + +#ifdef COMPUTE_THERMISTORS + +// See http://en.wikipedia.org/wiki/Thermistor#B_or_.CE.B2_parameter_equation + +// BETA is the B value +// RS is the value of the series resistor in ohms +// R_INF is R0.exp(-BETA/T0), where R0 is the thermistor resistance at T0 (T0 is in kelvin) +// Normally T0 is 298.15K (25 C). If you write that expression in brackets in the #define the compiler +// should compute it for you (i.e. it won't need to be calculated at run time). + +// If the A->D converter has a range of 0..1023 and the measured voltage is V (between 0 and 1023) +// then the thermistor resistance, R = V.RS/(1023 - V) +// and the temperature, T = BETA/ln(R/R_INF) +// To get degrees celsius (instead of kelvin) add -273.15 to T + +// This DOES assume that all extruders use the same thermistor type. + +#define ABS_ZERO -273.15 +#define AD_RANGE 16383 + +// RS 198-961 +#define E_BETA 3960.0 +#define E_RS 4700.0 +#define E_R_INF ( 100000.0*exp(-E_BETA/298.15) ) + +// RS 484-0149; EPCOS B57550G103J +#define BED_BETA 3480.0 +#define BED_RS 4700.0 +#define BED_R_INF ( 10000.0*exp(-BED_BETA/298.15) ) + +#define BED_USES_THERMISTOR +#define HEATER_0_USES_THERMISTOR +//#define HEATER_1_USES_THERMISTOR +//#define HEATER_2_USES_THERMISTOR + +#endif + + + //// Temperature sensor settings: // -2 is thermocouple with MAX6675 (only for sensor 0) // -1 is thermocouple with AD595 @@ -103,7 +164,7 @@ // #define DEFAULT_Ki 0.1 // #define DEFAULT_Kd 12 -// RepRapPro Huxley +// RepRapPro Huxley + Mendel #define DEFAULT_Kp 3.0 #define DEFAULT_Ki (2*PID_dT) #define DEFAULT_Kd (80/PID_dT) @@ -114,11 +175,13 @@ // #define DEFAULT_Kd (440/PID_dT) #endif // PIDTEMP +#ifndef DEVELOPING //this prevents dangerous Extruder moves, i.e. if the temperature is under the limit //can be software-disabled for whatever purposes by #define PREVENT_DANGEROUS_EXTRUDE #define EXTRUDE_MINTEMP 170 #define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances. +#endif //=========================================================================== //=============================Mechanical Settings=========================== @@ -159,9 +222,6 @@ const bool Z_ENDSTOPS_INVERTING = false; // set to true to invert the logic of t #define min_software_endstops true //If true, axis won't move to coordinates less than zero. #define max_software_endstops true //If true, axis won't move to coordinates greater than the defined lengths below. -#define X_MAX_LENGTH 250 //155 for v2 -#define Y_MAX_LENGTH 200 //150 for v2 -#define Z_MAX_LENGTH 140 // The position of the homing switches. Use MAX_LENGTH * -0.5 if the center should be 0, 0, 0 #define X_HOME_POS 0 @@ -170,15 +230,36 @@ const bool Z_ENDSTOPS_INVERTING = false; // set to true to invert the logic of t //// MOVEMENT SETTINGS #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E + +#ifdef REPRAPPRO_MENDEL + +#define X_MAX_LENGTH 210 +#define Y_MAX_LENGTH 210 +#define Z_MAX_LENGTH 100 #define HOMING_FEEDRATE {10*60, 10*60, 1*60, 0} // set the homing speeds (mm/min) -#define FAST_HOME_FEEDRATE {80*60, 80*60, 3*60, 0} // set the homing speeds (mm/min) +#define FAST_HOME_FEEDRATE {50*60, 50*60, 1*60, 0} // set the homing speeds (mm/min) +#define DEFAULT_MAX_FEEDRATE {500, 500, 3, 45} +#define DEFAULT_MAX_FEEDRATE {300, 300, 3, 45} // (mm/sec) +#define DEFAULT_MAX_ACCELERATION {800,800,30,250} // X, Y, Z, E maximum start speed for accelerated moves. E default values + +#else + +#define X_MAX_LENGTH 150 +#define Y_MAX_LENGTH 148 +#define Z_MAX_LENGTH 100 +#define HOMING_FEEDRATE {10*60, 10*60, 1*60, 0} // set the homing speeds (mm/min) +#define FAST_HOME_FEEDRATE {80*60, 80*60, 4*60, 0} // set the homing speeds (mm/min) +#define DEFAULT_MAX_FEEDRATE {500, 500, 5, 45} // (mm/sec) +#define DEFAULT_MAX_FEEDRATE {500, 500, 5, 45} // (mm/sec) +#define DEFAULT_MAX_ACCELERATION {1000,1000,50,250} // X, Y, Z, E maximum start speed for accelerated moves. E default values + +#endif + // default settings #define DEFAULT_AXIS_STEPS_PER_UNIT {91.4286, 91.4286,4000,875} // default steps per unit for ultimaker -//#define DEFAULT_AXIS_STEPS_PER_UNIT {80,80,4571.429,850} -#define DEFAULT_MAX_FEEDRATE {500, 500, 5, 45} // (mm/sec) -#define DEFAULT_MAX_ACCELERATION {1000,1000,50,1000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot. + #define DEFAULT_ACCELERATION 1000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves #define DEFAULT_RETRACT_ACCELERATION 1000 // X, Y, Z and E max acceleration in mm/s^2 for r retracts diff --git a/Marlin/pins.h b/Marlin/pins.h index 2d7b1fbf70..26c69e39a2 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -624,6 +624,63 @@ #endif +/**************************************************************************************** +* Melzi pin assignment +* +****************************************************************************************/ +#if MOTHERBOARD == 63 +#define KNOWN_BOARD 1 +#ifndef __AVR_ATmega644P__ +#ifndef __AVR_ATmega1284P__ +#error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu. +#endif +#endif + +#define X_STEP_PIN 15 +#define X_DIR_PIN 21 +#define X_MIN_PIN 18 +#define X_MAX_PIN -2 + +#define Y_STEP_PIN 22 +#define Y_DIR_PIN 23 +#define Y_MIN_PIN 19 +#define Y_MAX_PIN -1 + +#define Z_STEP_PIN 3 +#define Z_DIR_PIN 2 +#define Z_MIN_PIN 20 +#define Z_MAX_PIN -1 + +#define E0_STEP_PIN 1 +#define E0_DIR_PIN 0 + +#define LED_PIN 27 + +#define FAN_PIN 4 + +#define PS_ON_PIN -1 +#define KILL_PIN -1 + +#define HEATER_0_PIN 13 // (extruder) +#define HEATER_1_PIN -1 +#define HEATER_2_PIN -1 + +#define HEATER_BED_PIN 12 // bed (change to 10 for gate pin of MOSFET on heated bed) +#define X_ENABLE_PIN 14 +#define Y_ENABLE_PIN 14 +#define Z_ENABLE_PIN 26 +#define E0_ENABLE_PIN 14 + +#define TEMP_0_PIN 7 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 33 extruder) +#define TEMP_1_PIN -1 +#define TEMP_2_PIN -1 +#define TEMP_BED_PIN 6 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 34 bed) +#define SDPOWER -1 +#define SDSS 31 + +#endif + + #if MOTHERBOARD == 7 #define KNOWN_BOARD diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 84b551e008..dcc491616f 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -376,6 +376,30 @@ void manage_heater() } #define PGM_RD_W(x) (short)pgm_read_word(&x) + +#ifdef COMPUTE_THERMISTORS +// Use algebra to work out temperatures, not tables +// NB - this assumes all extruders use the same thermistor type. +int temp2analogi(int celsius, const float& beta, const float& rs, const float& r_inf) +{ + float r = r_inf*exp(beta/(celsius - ABS_ZERO)); + return AD_RANGE - (int)(0.5 + AD_RANGE*r/(r + rs)); +} + +float analog2tempi(int raw, const float& beta, const float& rs, const float& r_inf) +{ + float rawf = (float)(AD_RANGE - raw); + return ABS_ZERO + beta/log( (rawf*rs/(AD_RANGE - rawf))/r_inf ); +} + +int temp2analog(int celsius, uint8_t e) { return temp2analogi(celsius, E_BETA, E_RS, E_R_INF); } +int temp2analogBed(int celsius) { return temp2analogi(celsius, BED_BETA, BED_RS, BED_R_INF); } +float analog2temp(int raw, uint8_t e) { return analog2tempi(raw, E_BETA, E_RS, E_R_INF); } +float analog2tempBed(int raw) { return analog2tempi(raw, BED_BETA, BED_RS, BED_R_INF); } + +#else + + // Takes hot end temperature value as input and returns corresponding raw value. // For a thermistor, it uses the RepRap thermistor temp table. // This is needed because PID in hydra firmware hovers around a given analog value, not a temp value. @@ -531,6 +555,8 @@ float analog2tempBed(int raw) { #endif } +#endif + void tp_init() { // Finish init of mult extruder arrays