No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config.h 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #ifndef _CONFIG_H_
  2. #define _CONFIG_H_
  3. /***************************************
  4. ********** Firmware Settings **********
  5. ***************************************/
  6. #define FIRMWARE_VERSION "0.1"
  7. #define LED_BLINK_INTERVAL 1000
  8. #define DEBOUNCE_DELAY 50
  9. #define ENCODER_CLICK_BEEP_FREQ 2000
  10. #define ENCODER_CLICK_BEEP_TIME 50
  11. #define HOMING_BEEP_FREQ 3000
  12. #define HOMING_BEEP_TIME 100
  13. #define KILL_BEEP_FREQ 3000
  14. #define KILL_BEEP_TIME 100
  15. #define KILL_BEEP_REPEAT 5
  16. /***************************************
  17. ********** Hardware Settings **********
  18. ***************************************/
  19. #define AXIS_COUNT 4
  20. #define X_AXIS 0
  21. #define Y_AXIS 1
  22. #define Z_AXIS 2
  23. #define E_AXIS 3
  24. // xy steps per mm
  25. #define XY_BELT_PITCH 2.0
  26. #define XY_PULLEY_TEETH 40.0
  27. #define XY_MICRO_STEPS 16.0
  28. #define XY_MOTOR_STEPS_PER_REV (200.0 * XY_MICRO_STEPS)
  29. #define XY_STEPS_PER_MM (XY_MOTOR_STEPS_PER_REV / XY_PULLEY_TEETH / XY_BELT_PITCH)
  30. // z steps per mm
  31. #define Z_ROD_PITCH 2.0
  32. #define Z_MICRO_STEPS 16.0
  33. #define Z_MOTOR_STEPS_PER_REV (200.0 * Z_MICRO_STEPS)
  34. #define Z_STEPS_PER_MM (Z_MOTOR_STEPS_PER_REV / Z_ROD_PITCH)
  35. // e steps per mm
  36. // 1/2 turn of output is movement range
  37. // gear box factor 3:1 output:input
  38. // 3/2 turns of motor equals 100% movement
  39. // (16 * 200) = 3200 steps for motor turn
  40. // 3200 * 3 / 2 = 4800 steps for 3/2 turn
  41. // 4800 / 100 = 48 steps for one percent of movement
  42. #define GEARBOX_MULT 3
  43. #define OUTPUT_TURN_DIV 2
  44. #define E_MICRO_STEPS 16.0
  45. #define E_MOTOR_STEPS_PER_REV (200.0 * E_MICRO_STEPS)
  46. #define E_STEPS_PER_PERCENT (E_MOTOR_STEPS_PER_REV * GEARBOX_MULT / OUTPUT_TURN_DIV / 100.0)
  47. // travel lengths
  48. #define X_AXIS_MIN -5.0 // in mm
  49. #define X_AXIS_MAX 260.0 // in mm
  50. #define Y_AXIS_MIN -5.0 // in mm
  51. #define Y_AXIS_MAX 360.0 // in mm
  52. #define Z_AXIS_MIN 0.0 // TODO in mm
  53. #define Z_AXIS_MAX 100.0 // TODO in mm
  54. #define E_AXIS_MIN 0.0 // in mm
  55. #define E_AXIS_MAX 6.0 // in mm
  56. // 0 degree = 0 percent = pi = 0mm
  57. // 180 degree = 100 percent = 2pi = 6mm
  58. // (cos(pi + x / 100 * pi) + 1) / 2 * 6mm
  59. #define E_PERCENT_TO_MM(x) ((cos(PI + (x * PI / 100.0)) + 1.0) / 2.0 * E_AXIS_MAX)
  60. #define E_MM_TO_PERCENT(x) ((acos((x * 2.0 / E_AXIS_MAX) - 1.0) - PI) * 100.0 / PI)
  61. // maximum speeds
  62. #define XY_MAX_SPEED 50.0 // in mm/s --> 50mm/s = 2000steps/s
  63. #define Z_MAX_SPEED 1.2 // in mm/s --> 20mm/s = 32000steps/s
  64. #define E_MAX_SPEED 30.0 // in percent/s --> 50%/s = 2400steps/s
  65. // homing speeds
  66. #define XY_FAST_HOME_SPEED 25.0 // in mm/s
  67. #define XY_SLOW_HOME_SPEED 5.0 // in mm/s
  68. #define Z_FAST_HOME_SPEED 5.0 // in mm/s
  69. #define Z_SLOW_HOME_SPEED 1.0 // in mm/s
  70. #define E_FAST_HOME_SPEED 10.0 // in percent/s
  71. #define E_SLOW_HOME_SPEED 2.0 // in percent/s
  72. // accelerations
  73. #define XY_MAX_ACCEL 100.0 // in mm/s^2
  74. #define Z_MAX_ACCEL 50.0 // in mm/s^2
  75. #define E_MAX_ACCEL 1000.0 // in percent/s^2
  76. // axis movement directions (1.0 normal, -1.0 inverted)
  77. #define X_AXIS_MOVEMENT_DIR 1.0
  78. #define Y_AXIS_MOVEMENT_DIR 1.0
  79. #define Z_AXIS_MOVEMENT_DIR 1.0
  80. #define E_AXIS_MOVEMENT_DIR 1.0
  81. // homing back-off
  82. #define XY_BACK_OFF_DISTANCE 5.0 // in mm
  83. #define Z_BACK_OFF_DISTANCE 2.0 // in mm
  84. #define E_BACK_OFF_DISTANCE 1.0 // in mm
  85. #define XY_HOME_BACK_OFF_TIME (XY_BACK_OFF_DISTANCE / XY_FAST_HOME_SPEED * 1000)
  86. #define Z_HOME_BACK_OFF_TIME (Z_BACK_OFF_DISTANCE / Z_FAST_HOME_SPEED * 1000)
  87. #define E_HOME_BACK_OFF_TIME (E_BACK_OFF_DISTANCE / E_FAST_HOME_SPEED * 1000)
  88. // epsilon around expected endstop position where we dont abort on hits
  89. // if you need to increase this value, try to reduce play in your axis
  90. #define X_AXIS_EPSILON 1.0
  91. #define Y_AXIS_EPSILON 1.0
  92. #define Z_AXIS_EPSILON 1.0
  93. #define E_AXIS_EPSILON 1.0
  94. #define ENCODER_RPM_VALUE_FACTOR 2.0
  95. #define IDLE_TIMEOUT (5UL * 60UL * 1000UL) // ms, 0 to disable
  96. // TimerOne freq for steppers
  97. #define XY_MAX_HZ (XY_MAX_SPEED * XY_STEPS_PER_MM)
  98. #define Z_MAX_HZ (Z_MAX_SPEED * Z_STEPS_PER_MM)
  99. #define E_MAX_HZ (E_MAX_SPEED * E_STEPS_PER_PERCENT)
  100. #define MAX_SAMPLE_FREQ 2500
  101. #endif // _CONFIG_H_