Configuration.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. #ifndef CONFIGURATION_H
  2. #define CONFIGURATION_H
  3. // BASIC SETTINGS: select your board type, thermistor type, axis scaling, and endstop configuration
  4. //// The following define selects which electronics board you have. Please choose the one that matches your setup
  5. // MEGA/RAMPS up to 1.2 = 3,
  6. // RAMPS 1.3/1.4 = 33
  7. // Gen6 = 5,
  8. // Sanguinololu up to 1.1 = 6
  9. // Sanguinololu 1.2 and above = 62
  10. // Gen 7 @ 16MHZ only= 7
  11. // Gen 7 @ 20MHZ only= 71
  12. // Teensylu (at90usb) = 8
  13. // Printrboard Rev. B (ATMEGA90USB1286) = 9
  14. // Gen 3 Plus = 21
  15. // gen 3 Monolithic Electronics = 22
  16. // Gen3 PLUS for TechZone Gen3 Remix Motherboard = 23
  17. #define MOTHERBOARD 33
  18. //// Thermistor settings:
  19. // 1 is 100k thermistor
  20. // 2 is 200k thermistor
  21. // 3 is mendel-parts thermistor
  22. // 4 is 10k thermistor
  23. // 5 is ParCan supplied 104GT-2 100K
  24. // 6 is 100K Thermistor (B57540G0104F000)(Mixshop)
  25. // 7 is 100k Honeywell thermistor 135-104LAG-J01(Mixshop)
  26. #define THERMISTORHEATER 7
  27. #define THERMISTORBED 7
  28. //// Calibration variables
  29. // X, Y, Z, E steps per unit - Metric Prusa Mendel with Wade extruder:
  30. //#define _AXIS_STEP_PER_UNIT {80, 80, 3200/1.25,450}
  31. //X, Y, Z, E steps per unit - Mix G1:
  32. #define _AXIS_STEP_PER_UNIT {80.92, 78.17, 3250.89/1.25,127.1}
  33. // Metric Prusa Mendel with Makergear geared stepper extruder:
  34. //#define _AXIS_STEP_PER_UNIT {80,80,3200/1.25,1380}
  35. // MakerGear Hybrid Prusa Mendel:
  36. // Z axis value is for .9 stepper(if you have 1.8 steppers for Z, you need to use 2272.7272)
  37. //#define _AXIS_STEP_PER_UNIT {104.987, 104.987, 4545.4544, 1487}
  38. //// Endstop Settings
  39. #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
  40. // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
  41. //If your axes are only moving in one direction, make sure the endstops are connected properly.
  42. //If your axes move in one direction ONLY when the endstops are triggered, set [XYZ]_ENDSTOP_INVERT to true here:
  43. const bool X_ENDSTOP_INVERT = false;
  44. //const bool X_ENDSTOP_INVERT = true;
  45. //const bool Y_ENDSTOP_INVERT = true;
  46. const bool Y_ENDSTOP_INVERT = false;
  47. const bool Z_ENDSTOP_INVERT = false;
  48. // This determines the communication speed of the printer
  49. #define BAUDRATE 115200
  50. //#define BAUDRATE 250000
  51. // Comment out (using // at the start of the line) to disable SD support:
  52. //#define SDSUPPORT
  53. // Uncomment to make run init.g from SD on boot
  54. //#define SDINITFILE
  55. //Only work with Atmega1284 you need +1 kb ram
  56. //#define SD_FAST_XFER_AKTIV
  57. //-----------------------------------------------------------------------
  58. //// STORE SETTINGS TO EEPROM
  59. //-----------------------------------------------------------------------
  60. // the microcontroller can store settings in the EEPROM
  61. // M500 - stores paramters in EEPROM
  62. // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
  63. // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
  64. // M503 - Print settings
  65. // define this to enable eeprom support
  66. //#define USE_EEPROM_SETTINGS
  67. // to disable EEPROM Serial responses and decrease program space by ~1000 byte: comment this out:
  68. // please keep turned on if you can.
  69. //#define PRINT_EEPROM_SETTING
  70. //-----------------------------------------------------------------------
  71. //// ARC Function (G2/G3 Command)
  72. //-----------------------------------------------------------------------
  73. //Uncomment to aktivate the arc (circle) function (G2/G3 Command)
  74. //Without SD function an ARC function the used Flash is smaller 31 kb
  75. #define USE_ARC_FUNCTION
  76. //-----------------------------------------------------------------------
  77. //// ADVANCED SETTINGS - to tweak parameters
  78. //-----------------------------------------------------------------------
  79. #ifdef SDSUPPORT
  80. #ifdef SD_FAST_XFER_AKTIV
  81. //Fast transfer chunk size (> 1024 is unstable, change at your own risk).
  82. #define SD_FAST_XFER_CHUNK_SIZE 1024
  83. #endif
  84. #endif
  85. //-----------------------------------------------------------------------
  86. // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
  87. //-----------------------------------------------------------------------
  88. #define X_ENABLE_ON 0
  89. #define Y_ENABLE_ON 0
  90. #define Z_ENABLE_ON 0
  91. #define E_ENABLE_ON 0
  92. //Uncomment if you have problems with a stepper driver enabeling too late, this will also set how many microseconds delay there will be after enabeling the driver
  93. //#define DELAY_ENABLE 15
  94. //-----------------------------------------------------------------------
  95. // Disables axis when it's not being used.
  96. //-----------------------------------------------------------------------
  97. const bool DISABLE_X = false;
  98. const bool DISABLE_Y = false;
  99. const bool DISABLE_Z = true;
  100. const bool DISABLE_E = false;
  101. //-----------------------------------------------------------------------
  102. // Inverting axis direction
  103. //-----------------------------------------------------------------------
  104. //const bool INVERT_X_DIR = false;
  105. const bool INVERT_X_DIR = true;
  106. const bool INVERT_Y_DIR = false;
  107. //const bool INVERT_Z_DIR = true;
  108. const bool INVERT_Z_DIR = false;
  109. const bool INVERT_E_DIR = false;
  110. //-----------------------------------------------------------------------
  111. //// ENDSTOP SETTINGS:
  112. //-----------------------------------------------------------------------
  113. // Sets direction of endstops when homing; 1=MAX, -1=MIN
  114. #define X_HOME_DIR -1
  115. #define Y_HOME_DIR -1
  116. #define Z_HOME_DIR -1
  117. //#define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
  118. const bool min_software_endstops = false; //If true, axis won't move to coordinates less than zero.
  119. const bool max_software_endstops = true; //If true, axis won't move to coordinates greater than the defined lengths below.
  120. //-----------------------------------------------------------------------
  121. //Max Length for Prusa Mendel, check the ways of your axis and set this Values
  122. //-----------------------------------------------------------------------
  123. const int X_MAX_LENGTH = 500;
  124. const int Y_MAX_LENGTH = 500;
  125. const int Z_MAX_LENGTH = 500;
  126. //-----------------------------------------------------------------------
  127. //// MOVEMENT SETTINGS
  128. //-----------------------------------------------------------------------
  129. const int NUM_AXIS = 4; // The axis order in all axis related arrays is X, Y, Z, E
  130. #define _MAX_FEEDRATE {400, 400, 4, 45} // (mm/sec)
  131. #define _HOMING_FEEDRATE {2000,2000,200} // (mm/min) !!
  132. #define _AXIS_RELATIVE_MODES {false, false, false, false}
  133. #define MAX_STEP_FREQUENCY 30000 // Max step frequency
  134. //-----------------------------------------------------------------------
  135. //// Not used at the Moment
  136. //-----------------------------------------------------------------------
  137. // Min step delay in microseconds. If you are experiencing missing steps, try to raise the delay microseconds, but be aware this
  138. // If you enable this, make sure STEP_DELAY_RATIO is disabled.
  139. //#define STEP_DELAY_MICROS 1
  140. // Step delay over interval ratio. If you are still experiencing missing steps, try to uncomment the following line, but be aware this
  141. // If you enable this, make sure STEP_DELAY_MICROS is disabled. (except for Gen6: both need to be enabled.)
  142. //#define STEP_DELAY_RATIO 0.25
  143. ///Oscillation reduction. Forces x,y,or z axis to be stationary for ## ms before allowing axis to switch direcitons. Alternative method to prevent skipping steps. Uncomment the line below to activate.
  144. //#define RAPID_OSCILLATION_REDUCTION
  145. #ifdef RAPID_OSCILLATION_REDUCTION
  146. long min_time_before_dir_change = 30; //milliseconds
  147. #endif
  148. //-----------------------------------------------------------------------
  149. //// Acceleration settings
  150. //-----------------------------------------------------------------------
  151. // 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.
  152. #define _ACCELERATION 1000 // Axis Normal acceleration mm/s^2
  153. #define _RETRACT_ACCELERATION 2000 // Extruder Normal acceleration mm/s^2
  154. #define _MAX_XY_JERK 20.0
  155. #define _MAX_Z_JERK 0.4
  156. //#define _MAX_START_SPEED_UNITS_PER_SECOND {25.0,25.0,0.2,10.0}
  157. #define _MAX_ACCELERATION_UNITS_PER_SQ_SECOND {5000,5000,50,5000} // X, Y, Z and E max acceleration in mm/s^2 for printing moves or retracts
  158. // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end
  159. // of the buffer and all stops. This should not be much greater than zero and should only be changed
  160. // if unwanted behavior is observed on a user's machine when running at very slow speeds.
  161. #define MINIMUM_PLANNER_SPEED 2.0 // (mm/sec)
  162. #define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate
  163. #define DEFAULT_MINTRAVELFEEDRATE 0.0
  164. // If defined the movements slow down when the look ahead buffer is only half full
  165. #define SLOWDOWN
  166. const int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
  167. //-----------------------------------------------------------------------
  168. // Machine UUID
  169. //-----------------------------------------------------------------------
  170. // This may be useful if you have multiple machines and wish to identify them by using the M115 command.
  171. // By default we set it to zeros.
  172. #define _DEF_CHAR_UUID "00000000-0000-0000-0000-000000000000"
  173. //-----------------------------------------------------------------------
  174. //// Planner buffer Size
  175. //-----------------------------------------------------------------------
  176. // The number of linear motions that can be in the plan at any give time
  177. // if the SD Card need to much memory reduce the Values for Plannerpuffer (base of 2)
  178. #ifdef SDSUPPORT
  179. #define BLOCK_BUFFER_SIZE 16
  180. #define BLOCK_BUFFER_MASK 0x0f
  181. #else
  182. #define BLOCK_BUFFER_SIZE 16
  183. #define BLOCK_BUFFER_MASK 0x0f
  184. #endif
  185. //-----------------------------------------------------------------------
  186. //// SETTINGS FOR ARC FUNCTION (Command G2/G2)
  187. //-----------------------------------------------------------------------
  188. // Arc interpretation settings:
  189. //Step to split a cirrcle in small Lines
  190. #define MM_PER_ARC_SEGMENT 1
  191. //After this count of steps a new SIN / COS caluclation is startet to correct the circle interpolation
  192. #define N_ARC_CORRECTION 25
  193. //-----------------------------------------------------------------------
  194. //// HEATERCONTROL AND PID PARAMETERS
  195. //-----------------------------------------------------------------------
  196. //Testfunction to adjust the Hotend temperatur in case of Printingspeed
  197. //If the Printer print slow the Temp is going to AUTO_TEMP_MIN
  198. //At the moment this Value dont change the targettemp from the Hotend
  199. //The result of this function is only send with the Temperaturerequest to the host
  200. //#define AUTOTEMP
  201. #ifdef AUTOTEMP
  202. #define AUTO_TEMP_MAX 240
  203. #define AUTO_TEMP_MIN 205
  204. #define AUTO_TEMP_FACTOR 0.025
  205. #define AUTOTEMP_OLDWEIGHT 0.98
  206. #endif
  207. //// AD595 THERMOCOUPLE SUPPORT UNTESTED... USE WITH CAUTION!!!!
  208. //// PID settings:
  209. // Uncomment the following line to enable PID support. This is untested and could be disastrous. Be careful.
  210. #define PIDTEMP 1
  211. #ifdef PIDTEMP
  212. //Sanguinololu 1.2 and above, the PWM Output Hotend Timer 1 is used for the Hardware PWM
  213. //but in this Software use Timer1 for the Stepperfunction so it is not possible to use the "analogWrite" function.
  214. //This Soft PWM use Timer 2 with 400 Hz to drive the PWM for the hotend
  215. #define PID_SOFT_PWM
  216. //Measure the MIN/MAX Value of the Hotend Temp and show it with
  217. //Command M601 / Command M602 Reset the MIN/MAX Value
  218. //#define DEBUG_HEATER_TEMP
  219. //PID Controler Settings
  220. #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
  221. #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
  222. #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?)
  223. #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
  224. // 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
  225. // for my makergear hot-end: linear fit {50,10},{60,20},{80,30},{105,50},{176,100},{128,64},{208,128}
  226. #define HEATER_DUTY_FOR_SETPOINT(setpoint) ((int)((187L*(long)setpoint)>>8)-27)
  227. // magic formula 2, to make led brightness approximately linear
  228. #define LED_PWM_FOR_BRIGHTNESS(brightness) ((64*brightness-1384)/(300-brightness))
  229. #endif
  230. // Change this value (range 1-255) to limit the current to the nozzle
  231. #define HEATER_CURRENT 255
  232. // How often should the heater check for new temp readings, in milliseconds
  233. #define HEATER_CHECK_INTERVAL 500
  234. #define BED_CHECK_INTERVAL 5000
  235. // Comment the following line to enable heat management during acceleration
  236. #define DISABLE_CHECK_DURING_ACC
  237. #ifndef DISABLE_CHECK_DURING_ACC
  238. // Uncomment the following line to disable heat management during moves
  239. //#define DISABLE_CHECK_DURING_MOVE
  240. #endif
  241. // 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.
  242. // Probably this should remain commented if are using PID.
  243. // It also defines the max milliseconds interval after which a travel move is not considered so for the sake of this feature.
  244. #define DISABLE_CHECK_DURING_TRAVEL 1000
  245. //// Temperature smoothing - only uncomment this if your temp readings are noisy (Gen6 without EvdZ's 5V hack)
  246. //#define SMOOTHING
  247. //#define SMOOTHFACTOR 16 //best to use a power of two here - determines how many values are averaged together by the smoothing algorithm
  248. //// Experimental watchdog and minimal temp
  249. // The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
  250. // If the temperature has not increased at the end of that period, the target temperature is set to zero. It can be reset with another M104/M109
  251. //#define WATCHPERIOD 5000 //5 seconds
  252. // Actual temperature must be close to target for this long before M109 returns success
  253. //#define TEMP_RESIDENCY_TIME 20 // (seconds)
  254. //#define TEMP_HYSTERESIS 5 // (C°) range of +/- temperatures considered "close" to the target one
  255. //// The minimal temperature defines the temperature below which the heater will not be enabled
  256. #define MINTEMP 5
  257. //// Experimental max temp
  258. // When temperature exceeds max temp, your heater will be switched off.
  259. // This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure!
  260. // You should use MINTEMP for thermistor short/failure protection.
  261. #define MAXTEMP 275
  262. // Select one of these only to define how the nozzle temp is read.
  263. #define HEATER_USES_THERMISTOR
  264. //#define HEATER_USES_AD595
  265. //#define HEATER_USES_MAX6675
  266. // Select one of these only to define how the bed temp is read.
  267. #define BED_USES_THERMISTOR
  268. //#define BED_USES_AD595
  269. //This is for controlling a fan to cool down the stepper drivers
  270. //it will turn on when any driver is enabled
  271. //and turn off after the set amount of seconds from last driver being disabled again
  272. //#define CONTROLLERFAN_PIN 23 //Pin used for the fan to cool controller, comment out to disable this function
  273. #define CONTROLLERFAN_SEC 60 //How many seconds, after all motors were disabled, the fan should run
  274. //-----------------------------------------------------------------------
  275. // DEBUGING
  276. //-----------------------------------------------------------------------
  277. //Uncomment this to see on the host if a wrong or unknown Command is recived
  278. //Only for Testing !!!
  279. //#define SEND_WRONG_CMD_INFO
  280. // Uncomment the following line to enable debugging. You can better control debugging below the following line
  281. //#define DEBUG
  282. #ifdef DEBUG
  283. //#define DEBUG_PREPARE_MOVE //Enable this to debug prepare_move() function
  284. //#define DEBUG_MOVE_TIME //Enable this to time each move and print the result
  285. //#define DEBUG_HEAT_MGMT //Enable this to debug heat management. WARNING, this will cause axes to jitter!
  286. //#define DEBUG_DISABLE_CHECK_DURING_TRAVEL //Debug the namesake feature, see above in this file
  287. #endif
  288. #endif