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

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