From 76bbfb39ae3c46a874ace54b6d645810cc37d7ac Mon Sep 17 00:00:00 2001 From: midopple Date: Sun, 29 Jan 2012 00:18:21 +0100 Subject: New Version Sprinter V2 - Look Vorward Funktion - - Stepper Control with Timer 1 - SOFT PWM for Extruder heating --> Free Timer 1 - G2 / G3 Command for arc real arc - Baudrate 250 kbaud - M30 Command delete file on SD Card - Text moved to flash to free RAM - M203 Command for Temp debugging --- Sprinter/Configuration.h | 143 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 111 insertions(+), 32 deletions(-) (limited to 'Sprinter/Configuration.h') diff --git a/Sprinter/Configuration.h b/Sprinter/Configuration.h index b60db88..b054c73 100644 --- a/Sprinter/Configuration.h +++ b/Sprinter/Configuration.h @@ -9,11 +9,12 @@ // Gen6 = 5, // Sanguinololu up to 1.1 = 6 // Sanguinololu 1.2 and above = 62 +// Gen 7 @ 16MHZ only= 7 // Teensylu (at90usb) = 8 // Gen 3 Plus = 21 // gen 3 Monolithic Electronics = 22 // Gen3 PLUS for TechZone Gen3 Remix Motherboard = 23 -#define MOTHERBOARD 62 +#define MOTHERBOARD 62 //// Thermistor settings: // 1 is 100k thermistor @@ -26,14 +27,16 @@ #define THERMISTORHEATER 1 #define THERMISTORBED 1 -//// Calibration variables -// X, Y, Z, E steps per unit - Metric Prusa Mendel with Wade extruder: -float axis_steps_per_unit[] = {80, 80, 3200/1.25,700}; -// Metric Prusa Mendel with Makergear geared stepper extruder: -//float axis_steps_per_unit[] = {80,80,3200/1.25,1380}; +//// Calibration variables --> CHECK THIS VALUES FOR YOUR PRINTER !!! +// X, Y, Z, E steps per unit - Metric Prusa Mendel with Wade extruder and alu pulleys: +#define _AXIS_STEP_PER_UNIT {64, 64, 3200/1.25,766} + +// Metric Prusa Mendel with Makergear geared stepper extruder and printet pulleys: +//#define _AXIS_STEP_PER_UNIT {80,80,3200/1.25,1380} + // MakerGear Hybrid Prusa Mendel: // Z axis value is for .9 stepper(if you have 1.8 steppers for Z, you need to use 2272.7272) -//float axis_steps_per_unit[] = {104.987, 104.987, 4545.4544, 1487}; +//#define _AXIS_STEP_PER_UNIT {104.987, 104.987, 4545.4544, 1487} //// Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors @@ -45,17 +48,18 @@ const bool Y_ENDSTOP_INVERT = false; const bool Z_ENDSTOP_INVERT = false; // This determines the communication speed of the printer -#define BAUDRATE 115200 +//#define BAUDRATE 115200 +#define BAUDRATE 250000 // Comment out (using // at the start of the line) to disable SD support: #define SDSUPPORT -// Uncomment to make Sprinter run init.g from SD on boot -//#define SDINITFILE +// Uncomment to make run init.g from SD on boot +//#define SDINITFILE +//----------------------------------------------------------------------- //// ADVANCED SETTINGS - to tweak parameters - -#include "thermistortables.h" +//----------------------------------------------------------------------- // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 #define X_ENABLE_ON 0 @@ -70,10 +74,10 @@ const bool DISABLE_Z = true; const bool DISABLE_E = false; // Inverting axis direction -const bool INVERT_X_DIR = false; +const bool INVERT_X_DIR = true; const bool INVERT_Y_DIR = false; const bool INVERT_Z_DIR = true; -const bool INVERT_E_DIR = false; +const bool INVERT_E_DIR = true; //// ENDSTOP SETTINGS: // Sets direction of endstops when homing; 1=MAX, -1=MIN @@ -83,15 +87,19 @@ const bool INVERT_E_DIR = false; const bool min_software_endstops = false; //If true, axis won't move to coordinates less than zero. const bool max_software_endstops = true; //If true, axis won't move to coordinates greater than the defined lengths below. -const int X_MAX_LENGTH = 200; -const int Y_MAX_LENGTH = 200; -const int Z_MAX_LENGTH = 100; + +//Max Length for Prusa Mendel, check the ways of your axis and set this Values +const int X_MAX_LENGTH = 165; +const int Y_MAX_LENGTH = 181; +const int Z_MAX_LENGTH = 90; //// MOVEMENT SETTINGS const int NUM_AXIS = 4; // The axis order in all axis related arrays is X, Y, Z, E -float max_feedrate[] = {200000, 200000, 240, 500000}; -float homing_feedrate[] = {1500,1500,120}; -bool axis_relative_modes[] = {false, false, false, false}; + +#define _MAX_FEEDRATE {24000, 24000, 180, 2700} // (400,400,3,45) mm/sec --> Array Unit = mm / min +#define _HOMING_FEEDRATE {1500,1500,120} // ( 25, 25,2) mm/sec --> Array Unit = mm / min + +#define _AXIS_RELATIVE_MODES {false, false, false, false} // Min step delay in microseconds. If you are experiencing missing steps, try to raise the delay microseconds, but be aware this // If you enable this, make sure STEP_DELAY_RATIO is disabled. @@ -107,29 +115,88 @@ bool axis_relative_modes[] = {false, false, false, false}; //// Acceleration settings #ifdef RAMP_ACCELERATION // 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. -float max_start_speed_units_per_second[] = {25.0,25.0,0.2,10.0}; -long max_acceleration_units_per_sq_second[] = {1000,1000,50,10000}; // X, Y, Z and E max acceleration in mm/s^2 for printing moves or retracts -long max_travel_acceleration_units_per_sq_second[] = {500,500,50,500}; // X, Y, Z max acceleration in mm/s^2 for travel moves +#define _ACCELERATION 2000 // Normal acceleration mm/s^2 +#define _RETRACT_ACCELERATION 7000 // Normal acceleration mm/s^2 +#define _MAX_XY_JERK (20.0*60) +#define _MAX_Z_JERK (0.4*60) +#define _MAX_START_SPEED_UNITS_PER_SECOND {25.0,25.0,0.2,10.0} +#define _MAX_ACCELERATION_UNITS_PER_SQ_SECOND {500,500,50,500} // X, Y, Z and E max acceleration in mm/s^2 for printing moves or retracts +#define _MAX_TRAVEL_ACCELERATION_UNITS_PER_SQ_SECOND {500,500,50,500} // X, Y, Z max acceleration in mm/s^2 for travel moves #endif + // Machine UUID // This may be useful if you have multiple machines and wish to identify them by using the M115 command. // By default we set it to zeros. -char uuid[] = "00000000-0000-0000-0000-000000000000"; - +//#define _DEF_CHAR_UUID "00000000-0000-0000-0000-000000000000" +#define _DEF_CHAR_UUID "55841315-4681-1640-0000-260479000000" + + + +//----------------------------------------------------------------------- +//// Planner buffer Size +//----------------------------------------------------------------------- + +// The number of linear motions that can be in the plan at any give time +// if the SD Card need to much memory reduce the Values for Plannerpuffer (base of 2) +#ifdef SDSUPPORT + #define BLOCK_BUFFER_SIZE 16 + #define BLOCK_BUFFER_MASK 0x0f +#else + #define BLOCK_BUFFER_SIZE 16 + #define BLOCK_BUFFER_MASK 0x0f +#endif + +//----------------------------------------------------------------------- +//// SETTINGS FOR ARC FUNCTION (Command G2/G2) +//----------------------------------------------------------------------- + +// Arc interpretation settings: +//Step to split a cirrcle in small Lines +#define MM_PER_ARC_SEGMENT 1 +//After this count of steps a new SIN / COS caluclation is startet to correct the circle interpolation +#define N_ARC_CORRECTION 25 + +//----------------------------------------------------------------------- +//// HEATERCONTROL AND PID PARAMETERS +//----------------------------------------------------------------------- + +//Testfunction to adjust the Hotend temperatur in case of Printingspeed +//If the Printer print slow the Temp is going to AUTO_TEMP_MIN +//At the moment this Value dont change the targettemp from the Hotend +//The result of this function is only send with the Temperaturerequest to the host +//#define AUTOTEMP +#ifdef AUTOTEMP + #define AUTO_TEMP_MAX 240 + #define AUTO_TEMP_MIN 205 + #define AUTO_TEMP_FACTOR 0.025 + #define AUTOTEMP_OLDWEIGHT 0.98 +#endif //// AD595 THERMOCOUPLE SUPPORT UNTESTED... USE WITH CAUTION!!!! //// PID settings: // Uncomment the following line to enable PID support. This is untested and could be disastrous. Be careful. -//#define PIDTEMP 1 +#define PIDTEMP 1 #ifdef PIDTEMP +//Sanguinololu 1.2 and above, the PWM Output Hotend Timer 1 is used for the Hardware PWM +//but in this Software use Timer1 for the Stepperfunction so it is not possible to use the "analogWrite" function. +//This Soft PWM use Timer 2 with 400 Hz to drive the PWM for the hotend +#define PID_SOFT_PWM + +//Measure the MIN/MAX Value of the Hotend Temp and show it with +//Command M601 / Command M602 Reset the MIN/MAX Value +//#define DEBUG_HEATER_TEMP + +//PID Controler Settings #define PID_INTEGRAL_DRIVE_MAX 80 // too big, and heater will lag after changing temperature, too small and it might not compensate enough for long-term errors -#define PID_PGAIN 2560 //256 is 1.0 // value of X means that error of 1 degree is changing PWM duty by X, probably no need to go over 25 +#define PID_PGAIN 2048 //256 is 1.0 // value of X means that error of 1 degree is changing PWM duty by X, probably no need to go over 25 #define PID_IGAIN 64 //256 is 1.0 // value of X (e.g 0.25) means that each degree error over 1 sec (2 measurements) changes duty cycle by 2X (=0.5) units (verify?) -#define PID_DGAIN 4096 //256 is 1.0 // value of X means that around reached setpoint, each degree change over one measurement (half second) adjusts PWM by X units to compensate +#define PID_DGAIN 2048 //256 is 1.0 // value of X means that around reached setpoint, each degree change over one measurement (half second) adjusts PWM by X units to compensate + // magic formula 1, to get approximate "zero error" PWM duty. Take few measurements with low PWM duty and make linear fit to get the formula -#define HEATER_DUTY_FOR_SETPOINT(setpoint) ((int)((187L*(long)setpoint)>>8)-27) // for my makergear hot-end: linear fit {50,10},{60,20},{80,30},{105,50},{176,100},{128,64},{208,128} +// for my makergear hot-end: linear fit {50,10},{60,20},{80,30},{105,50},{176,100},{128,64},{208,128} +#define HEATER_DUTY_FOR_SETPOINT(setpoint) ((int)((187L*(long)setpoint)>>8)-27) // magic formula 2, to make led brightness approximately linear #define LED_PWM_FOR_BRIGHTNESS(brightness) ((64*brightness-1384)/(300-brightness)) #endif @@ -140,20 +207,23 @@ char uuid[] = "00000000-0000-0000-0000-000000000000"; // How often should the heater check for new temp readings, in milliseconds #define HEATER_CHECK_INTERVAL 500 #define BED_CHECK_INTERVAL 5000 + // Comment the following line to enable heat management during acceleration #define DISABLE_CHECK_DURING_ACC #ifndef DISABLE_CHECK_DURING_ACC // Uncomment the following line to disable heat management during moves //#define DISABLE_CHECK_DURING_MOVE #endif + // Uncomment the following line to disable heat management during travel moves (and extruder-only moves, eg: retracts), strongly recommended if you are missing steps mid print. // Probably this should remain commented if are using PID. // It also defines the max milliseconds interval after which a travel move is not considered so for the sake of this feature. #define DISABLE_CHECK_DURING_TRAVEL 1000 //// Temperature smoothing - only uncomment this if your temp readings are noisy (Gen6 without EvdZ's 5V hack) -//#define SMOOTHING +#define SMOOTHING //#define SMOOTHFACTOR 16 //best to use a power of two here - determines how many values are averaged together by the smoothing algorithm +#define SMOOTHFACTOR 2 //best to use a power of two here - determines how many values are averaged together by the smoothing algorithm //// Experimental watchdog and minimal temp // The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature @@ -188,13 +258,22 @@ char uuid[] = "00000000-0000-0000-0000-000000000000"; //#define CONTROLLERFAN_PIN 23 //Pin used for the fan to cool controller, comment out to disable this function #define CONTROLLERFAN_SEC 60 //How many seconds, after all motors were disabled, the fan should run + +//----------------------------------------------------------------------- +// DEBUGING +//----------------------------------------------------------------------- + + +//Uncomment this to see on the host if a wrong or unknown Command is recived +//Only for Testing !!! +//#define SEND_WRONG_CMD_INFO + // Uncomment the following line to enable debugging. You can better control debugging below the following line //#define DEBUG #ifdef DEBUG //#define DEBUG_PREPARE_MOVE //Enable this to debug prepare_move() function - //#define DEBUG_BRESENHAM //Enable this to debug the Bresenham algorithm //#define DEBUG_RAMP_ACCELERATION //Enable this to debug all constant acceleration info - //#define DEBUG_MOVE_TIME //Enable this to time each move and print the result + //#define DEBUG_MOVE_TIME //Enable this to time each move and print the result //#define DEBUG_HEAT_MGMT //Enable this to debug heat management. WARNING, this will cause axes to jitter! //#define DEBUG_DISABLE_CHECK_DURING_TRAVEL //Debug the namesake feature, see above in this file #endif -- cgit v1.2.1