My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 <stdio.h>
  7. #include <math.h>
  8. #if ARDUINO >= 100
  9. #include "Arduino.h"
  10. #else
  11. #include "WProgram.h"
  12. #endif
  13. #include "fastio.h"
  14. #include <avr/pgmspace.h>
  15. #include "Configuration.h"
  16. #include "MarlinSerial.h"
  17. #define FORCE_INLINE __attribute__((always_inline)) inline
  18. //#define SERIAL_ECHO(x) Serial << "echo: " << x;
  19. //#define SERIAL_ECHOLN(x) Serial << "echo: "<<x<<endl;
  20. //#define SERIAL_ERROR(x) Serial << "Error: " << x;
  21. //#define SERIAL_ERRORLN(x) Serial << "Error: " << x<<endl;
  22. //#define SERIAL_PROTOCOL(x) Serial << x;
  23. //#define SERIAL_PROTOCOLLN(x) Serial << x<<endl;
  24. //this is a unfinsihed attemp to removes a lot of warning messages, see:
  25. // http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=57011
  26. //typedef char prog_char PROGMEM;
  27. // //#define PSTR (s ) ((const PROGMEM char *)(s))
  28. // //# define MYPGM(s) (__extension__({static prog_char __c[] = (s); &__c[0];}))
  29. // //#define MYPGM(s) ((const prog_char *g PROGMEM=s))
  30. // //#define MYPGM(s) PSTR(s)
  31. #define MYPGM(s) (__extension__({static char __c[] __attribute__((__progmem__)) = (s); &__c[0];})) //This is the normal behaviour
  32. //#define MYPGM(s) (__extension__({static prog_char __c[] = (s); &__c[0];})) //this does not work but hides the warnings
  33. #define SERIAL_PROTOCOL(x) MSerial.print(x);
  34. #define SERIAL_PROTOCOLPGM(x) serialprintPGM(MYPGM(x));
  35. #define SERIAL_PROTOCOLLN(x) {MSerial.print(x);MSerial.write('\n');}
  36. #define SERIAL_PROTOCOLLNPGM(x) {serialprintPGM(MYPGM(x));MSerial.write('\n');}
  37. const prog_char errormagic[] PROGMEM ="Error:";
  38. const prog_char echomagic[] PROGMEM ="echo:";
  39. #define SERIAL_ERROR_START serialprintPGM(errormagic);
  40. #define SERIAL_ERROR(x) SERIAL_PROTOCOL(x)
  41. #define SERIAL_ERRORPGM(x) SERIAL_PROTOCOLPGM(x)
  42. #define SERIAL_ERRORLN(x) SERIAL_PROTOCOLLN(x)
  43. #define SERIAL_ERRORLNPGM(x) SERIAL_PROTOCOLLNPGM(x)
  44. #define SERIAL_ECHO_START serialprintPGM(echomagic);
  45. #define SERIAL_ECHO(x) SERIAL_PROTOCOL(x)
  46. #define SERIAL_ECHOPGM(x) SERIAL_PROTOCOLPGM(x)
  47. #define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x)
  48. #define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x)
  49. #define SERIAL_ECHOPAIR(name,value) {SERIAL_ECHOPGM(name);SERIAL_ECHO(value);}
  50. //things to write to serial from Programmemory. saves 400 to 2k of RAM.
  51. #define SerialprintPGM(x) serialprintPGM(MYPGM(x))
  52. FORCE_INLINE void serialprintPGM(const char *str)
  53. {
  54. char ch=pgm_read_byte(str);
  55. while(ch)
  56. {
  57. MSerial.write(ch);
  58. ch=pgm_read_byte(++str);
  59. }
  60. }
  61. void get_command();
  62. void process_commands();
  63. void manage_inactivity(byte debug);
  64. #if X_ENABLE_PIN > -1
  65. #define enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON)
  66. #define disable_x() WRITE(X_ENABLE_PIN,!X_ENABLE_ON)
  67. #else
  68. #define enable_x() ;
  69. #define disable_x() ;
  70. #endif
  71. #if Y_ENABLE_PIN > -1
  72. #define enable_y() WRITE(Y_ENABLE_PIN, Y_ENABLE_ON)
  73. #define disable_y() WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON)
  74. #else
  75. #define enable_y() ;
  76. #define disable_y() ;
  77. #endif
  78. #if Z_ENABLE_PIN > -1
  79. #define enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
  80. #define disable_z() WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON)
  81. #else
  82. #define enable_z() ;
  83. #define disable_z() ;
  84. #endif
  85. #if E_ENABLE_PIN > -1
  86. #define enable_e() WRITE(E_ENABLE_PIN, E_ENABLE_ON)
  87. #define disable_e() WRITE(E_ENABLE_PIN,!E_ENABLE_ON)
  88. #else
  89. #define enable_e() ;
  90. #define disable_e() ;
  91. #endif
  92. enum AxisEnum {X_AXIS=0, Y_AXIS=1, Z_AXIS=2, E_AXIS=3};
  93. void FlushSerialRequestResend();
  94. void ClearToSend();
  95. void get_coordinates();
  96. void prepare_move();
  97. void kill();
  98. void enquecommand(const char *cmd); //put an ascii command at the end of the current buffer.
  99. void prepare_arc_move(char isclockwise);
  100. #ifndef CRITICAL_SECTION_START
  101. #define CRITICAL_SECTION_START unsigned char _sreg = SREG; cli();
  102. #define CRITICAL_SECTION_END SREG = _sreg;
  103. #endif //CRITICAL_SECTION_START
  104. extern float homing_feedrate[];
  105. extern bool axis_relative_modes[];
  106. extern float current_position[NUM_AXIS] ;
  107. extern float add_homeing[3];
  108. #endif