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.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #ifndef __MARLINH
  2. #define __MARLINH
  3. // Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.
  4. // Licence: GPL
  5. #define HardwareSerial_h // trick to disable the standard HWserial
  6. #include <WProgram.h>
  7. #include "fastio.h"
  8. #include <avr/pgmspace.h>
  9. #include "Configuration.h"
  10. #include "MarlinSerial.h"
  11. #define FORCE_INLINE __attribute__((always_inline)) inline
  12. //#define SERIAL_ECHO(x) Serial << "echo: " << x;
  13. //#define SERIAL_ECHOLN(x) Serial << "echo: "<<x<<endl;
  14. //#define SERIAL_ERROR(x) Serial << "Error: " << x;
  15. //#define SERIAL_ERRORLN(x) Serial << "Error: " << x<<endl;
  16. //#define SERIAL_PROTOCOL(x) Serial << x;
  17. //#define SERIAL_PROTOCOLLN(x) Serial << x<<endl;
  18. #define SERIAL_PROTOCOL(x) MSerial.print(x);
  19. #define SERIAL_PROTOCOLPGM(x) serialprintPGM(PSTR(x));
  20. #define SERIAL_PROTOCOLLN(x) {MSerial.print(x);MSerial.write('\n');}
  21. #define SERIAL_PROTOCOLLNPGM(x) {serialprintPGM(PSTR(x));MSerial.write('\n');}
  22. const char errormagic[] PROGMEM ="Error:";
  23. const char echomagic[] PROGMEM ="echo:";
  24. #define SERIAL_ERROR_START serialprintPGM(errormagic);
  25. #define SERIAL_ERROR(x) SERIAL_PROTOCOL(x)
  26. #define SERIAL_ERRORPGM(x) SERIAL_PROTOCOLPGM(x)
  27. #define SERIAL_ERRORLN(x) SERIAL_PROTOCOLLN(x)
  28. #define SERIAL_ERRORLNPGM(x) SERIAL_PROTOCOLLNPGM(x)
  29. #define SERIAL_ECHO_START serialprintPGM(echomagic);
  30. #define SERIAL_ECHO(x) SERIAL_PROTOCOL(x)
  31. #define SERIAL_ECHOPGM(x) SERIAL_PROTOCOLPGM(x)
  32. #define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x)
  33. #define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x)
  34. #define SERIAL_ECHOPAIR(name,value) {SERIAL_ECHOPGM(name);SERIAL_ECHO(value);}
  35. //things to write to serial from Programmemory. saves 400 to 2k of RAM.
  36. #define SerialprintPGM(x) serialprintPGM(PSTR(x))
  37. FORCE_INLINE void serialprintPGM(const char *str)
  38. {
  39. char ch=pgm_read_byte(str);
  40. while(ch)
  41. {
  42. MSerial.write(ch);
  43. ch=pgm_read_byte(++str);
  44. }
  45. }
  46. void get_command();
  47. void process_commands();
  48. void manage_inactivity(byte debug);
  49. #if X_ENABLE_PIN > -1
  50. #define enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON)
  51. #define disable_x() WRITE(X_ENABLE_PIN,!X_ENABLE_ON)
  52. #else
  53. #define enable_x() ;
  54. #define disable_x() ;
  55. #endif
  56. #if Y_ENABLE_PIN > -1
  57. #define enable_y() WRITE(Y_ENABLE_PIN, Y_ENABLE_ON)
  58. #define disable_y() WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON)
  59. #else
  60. #define enable_y() ;
  61. #define disable_y() ;
  62. #endif
  63. #if Z_ENABLE_PIN > -1
  64. #define enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
  65. #define disable_z() WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON)
  66. #else
  67. #define enable_z() ;
  68. #define disable_z() ;
  69. #endif
  70. #if E_ENABLE_PIN > -1
  71. #define enable_e() WRITE(E_ENABLE_PIN, E_ENABLE_ON)
  72. #define disable_e() WRITE(E_ENABLE_PIN,!E_ENABLE_ON)
  73. #else
  74. #define enable_e() ;
  75. #define disable_e() ;
  76. #endif
  77. enum AxisEnum {X_AXIS=0, Y_AXIS=1, Z_AXIS=2, E_AXIS=3};
  78. void FlushSerialRequestResend();
  79. void ClearToSend();
  80. void get_coordinates();
  81. void prepare_move();
  82. void kill();
  83. void enquecommand(const char *cmd); //put an ascii command at the end of the current buffer.
  84. void prepare_arc_move(char isclockwise);
  85. #ifndef CRITICAL_SECTION_START
  86. #define CRITICAL_SECTION_START unsigned char _sreg = SREG; cli();
  87. #define CRITICAL_SECTION_END SREG = _sreg;
  88. #endif //CRITICAL_SECTION_START
  89. extern float homing_feedrate[];
  90. extern bool axis_relative_modes[];
  91. extern float current_position[NUM_AXIS] ;
  92. extern float add_homeing[3];
  93. #endif