My Marlin configs for Fabrikator Mini and CTC i3 Pro B
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.

Marlin.h 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.
  2. // Licence: GPL
  3. #include <WProgram.h>
  4. #include "fastio.h"
  5. extern "C" void __cxa_pure_virtual();
  6. void __cxa_pure_virtual(){};
  7. void get_command();
  8. void process_commands();
  9. void manage_inactivity(byte debug);
  10. void manage_heater();
  11. int temp2analogu(int celsius, const short table[][2], int numtemps);
  12. float analog2tempu(int raw, const short table[][2], int numtemps);
  13. #ifdef HEATER_USES_THERMISTOR
  14. #define HEATERSOURCE 1
  15. #endif
  16. #ifdef BED_USES_THERMISTOR
  17. #define BEDSOURCE 1
  18. #endif
  19. #define temp2analogh( c ) temp2analogu((c),temptable,NUMTEMPS)
  20. #define analog2temp( c ) analog2tempu((c),temptable,NUMTEMPS)
  21. #if X_ENABLE_PIN > -1
  22. #define enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON)
  23. #define disable_x() WRITE(X_ENABLE_PIN,!X_ENABLE_ON)
  24. #else
  25. #define enable_x() ;
  26. #define disable_x() ;
  27. #endif
  28. #if Y_ENABLE_PIN > -1
  29. #define enable_y() WRITE(Y_ENABLE_PIN, Y_ENABLE_ON)
  30. #define disable_y() WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON)
  31. #else
  32. #define enable_y() ;
  33. #define disable_y() ;
  34. #endif
  35. #if Z_ENABLE_PIN > -1
  36. #define enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
  37. #define disable_z() WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON)
  38. #else
  39. #define enable_z() ;
  40. #define disable_z() ;
  41. #endif
  42. #if E_ENABLE_PIN > -1
  43. #define enable_e() WRITE(E_ENABLE_PIN, E_ENABLE_ON)
  44. #define disable_e() WRITE(E_ENABLE_PIN,!E_ENABLE_ON)
  45. #else
  46. #define enable_e() ;
  47. #define disable_e() ;
  48. #endif
  49. #define X_AXIS 0
  50. #define Y_AXIS 1
  51. #define Z_AXIS 2
  52. #define E_AXIS 3
  53. void FlushSerialRequestResend();
  54. void ClearToSend();
  55. void get_coordinates();
  56. void prepare_move();
  57. void linear_move(unsigned long steps_remaining[]);
  58. void do_step(int axis);
  59. void kill(byte debug);
  60. // This struct is used when buffering the setup for each linear movement "nominal" values are as specified in
  61. // the source g-code and may never actually be reached if acceleration management is active.
  62. typedef struct {
  63. // Fields used by the bresenham algorithm for tracing the line
  64. long steps_x, steps_y, steps_z, steps_e; // Step count along each axis
  65. long step_event_count; // The number of step events required to complete this block
  66. volatile long accelerate_until; // The index of the step event on which to stop acceleration
  67. volatile long decelerate_after; // The index of the step event on which to start decelerating
  68. volatile long acceleration_rate; // The acceleration rate used for acceleration calculation
  69. unsigned char direction_bits; // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h)
  70. long advance_rate;
  71. volatile long initial_advance;
  72. volatile long final_advance;
  73. float advance;
  74. // Fields used by the motion planner to manage acceleration
  75. float speed_x, speed_y, speed_z, speed_e; // Nominal mm/minute for each axis
  76. float nominal_speed; // The nominal speed for this block in mm/min
  77. float millimeters; // The total travel of this block in mm
  78. float entry_speed;
  79. // Settings for the trapezoid generator
  80. long nominal_rate; // The nominal step rate for this block in step_events/sec
  81. volatile long initial_rate; // The jerk-adjusted step rate at start of block
  82. volatile long final_rate; // The minimal rate at exit
  83. long acceleration; // acceleration mm/sec^2
  84. volatile char busy;
  85. } block_t;
  86. void check_axes_activity();
  87. void plan_init();
  88. void st_init();
  89. void tp_init();
  90. void plan_buffer_line(float x, float y, float z, float e, float feed_rate);
  91. void plan_set_position(float x, float y, float z, float e);
  92. void st_wake_up();
  93. void st_synchronize();