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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #ifndef ULTRALCD_H
  23. #define ULTRALCD_H
  24. #include "Marlin.h"
  25. #if ENABLED(ULTRA_LCD)
  26. #define BUTTON_EXISTS(BN) (defined(BTN_## BN) && BTN_## BN >= 0)
  27. #define BUTTON_PRESSED(BN) !READ(BTN_## BN)
  28. int lcd_strlen(const char* s);
  29. int lcd_strlen_P(const char* s);
  30. void lcd_update();
  31. void lcd_init();
  32. bool lcd_hasstatus();
  33. void lcd_setstatus(const char* message, const bool persist=false);
  34. void lcd_setstatuspgm(const char* message, const uint8_t level=0);
  35. void lcd_setalertstatuspgm(const char* message);
  36. void lcd_reset_alert_level();
  37. bool lcd_detected(void);
  38. #if ENABLED(LCD_USE_I2C_BUZZER)
  39. void lcd_buzz(long duration, uint16_t freq);
  40. #endif
  41. #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
  42. void dontExpireStatus();
  43. #endif
  44. #if ENABLED(DOGLCD)
  45. extern int lcd_contrast;
  46. void set_lcd_contrast(int value);
  47. #elif ENABLED(SHOW_BOOTSCREEN)
  48. void bootscreen();
  49. #endif
  50. #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
  51. #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
  52. #define LCD_UPDATE_INTERVAL 100
  53. #define LCD_TIMEOUT_TO_STATUS 15000
  54. #if ENABLED(ULTIPANEL)
  55. extern volatile uint8_t buttons; //the last checked buttons in a bit array.
  56. void lcd_buttons_update();
  57. void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
  58. bool lcd_clicked();
  59. void lcd_ignore_click(bool b=true);
  60. #if ENABLED(FILAMENT_CHANGE_FEATURE)
  61. enum FilamentChangeMessage {
  62. FILAMENT_CHANGE_MESSAGE_INIT,
  63. FILAMENT_CHANGE_MESSAGE_UNLOAD,
  64. FILAMENT_CHANGE_MESSAGE_INSERT,
  65. FILAMENT_CHANGE_MESSAGE_LOAD,
  66. FILAMENT_CHANGE_MESSAGE_EXTRUDE,
  67. FILAMENT_CHANGE_MESSAGE_OPTION,
  68. FILAMENT_CHANGE_MESSAGE_RESUME,
  69. FILAMENT_CHANGE_MESSAGE_STATUS
  70. };
  71. void lcd_filament_change_show_message(FilamentChangeMessage message);
  72. #endif // FILAMENT_CHANGE_FEATURE
  73. #else
  74. FORCE_INLINE void lcd_buttons_update() {}
  75. #endif
  76. extern int plaPreheatHotendTemp;
  77. extern int plaPreheatHPBTemp;
  78. extern int plaPreheatFanSpeed;
  79. extern int absPreheatHotendTemp;
  80. extern int absPreheatHPBTemp;
  81. extern int absPreheatFanSpeed;
  82. extern bool wait_for_heatup;
  83. #if ENABLED(FILAMENT_LCD_DISPLAY)
  84. extern millis_t previous_lcd_status_ms;
  85. #endif
  86. bool lcd_blink();
  87. #if ENABLED(REPRAPWORLD_KEYPAD)
  88. #define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
  89. #define BLEN_REPRAPWORLD_KEYPAD_F3 0
  90. #define BLEN_REPRAPWORLD_KEYPAD_F2 1
  91. #define BLEN_REPRAPWORLD_KEYPAD_F1 2
  92. #define BLEN_REPRAPWORLD_KEYPAD_DOWN 3
  93. #define BLEN_REPRAPWORLD_KEYPAD_RIGHT 4
  94. #define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5
  95. #define BLEN_REPRAPWORLD_KEYPAD_UP 6
  96. #define BLEN_REPRAPWORLD_KEYPAD_LEFT 7
  97. #define EN_REPRAPWORLD_KEYPAD_F3 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F3))
  98. #define EN_REPRAPWORLD_KEYPAD_F2 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F2))
  99. #define EN_REPRAPWORLD_KEYPAD_F1 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F1))
  100. #define EN_REPRAPWORLD_KEYPAD_DOWN (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_DOWN))
  101. #define EN_REPRAPWORLD_KEYPAD_RIGHT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_RIGHT))
  102. #define EN_REPRAPWORLD_KEYPAD_MIDDLE (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_MIDDLE))
  103. #define EN_REPRAPWORLD_KEYPAD_UP (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_UP))
  104. #define EN_REPRAPWORLD_KEYPAD_LEFT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_LEFT))
  105. #define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F3)
  106. #define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F2)
  107. #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN)
  108. #define REPRAPWORLD_KEYPAD_MOVE_X_RIGHT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT)
  109. #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_MIDDLE)
  110. #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP)
  111. #define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT)
  112. #endif // REPRAPWORLD_KEYPAD
  113. #if ENABLED(NEWPANEL)
  114. #define EN_C (_BV(BLEN_C))
  115. #define EN_B (_BV(BLEN_B))
  116. #define EN_A (_BV(BLEN_A))
  117. #if ENABLED(REPRAPWORLD_KEYPAD)
  118. #define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
  119. #else
  120. #define LCD_CLICKED (buttons&EN_C)
  121. #endif
  122. #else //!NEWPANEL
  123. //atomic, do not change
  124. #define B_LE (_BV(BL_LE))
  125. #define B_UP (_BV(BL_UP))
  126. #define B_MI (_BV(BL_MI))
  127. #define B_DW (_BV(BL_DW))
  128. #define B_RI (_BV(BL_RI))
  129. #define B_ST (_BV(BL_ST))
  130. #define EN_B (_BV(BLEN_B))
  131. #define EN_A (_BV(BLEN_A))
  132. #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
  133. #endif //!NEWPANEL
  134. #else //no LCD
  135. FORCE_INLINE void lcd_update() {}
  136. FORCE_INLINE void lcd_init() {}
  137. FORCE_INLINE bool lcd_hasstatus() { return false; }
  138. FORCE_INLINE void lcd_setstatus(const char* message, const bool persist=false) {UNUSED(message); UNUSED(persist);}
  139. FORCE_INLINE void lcd_setstatuspgm(const char* message, const uint8_t level=0) {UNUSED(message); UNUSED(level);}
  140. FORCE_INLINE void lcd_buttons_update() {}
  141. FORCE_INLINE void lcd_reset_alert_level() {}
  142. FORCE_INLINE bool lcd_detected(void) { return true; }
  143. #define LCD_MESSAGEPGM(x) NOOP
  144. #define LCD_ALERTMESSAGEPGM(x) NOOP
  145. #endif //ULTRA_LCD
  146. char* itostr2(const uint8_t& x);
  147. char* itostr3sign(const int& x);
  148. char* itostr3(const int& x);
  149. char* itostr3left(const int& x);
  150. char* itostr4sign(const int& x);
  151. char* ftostr3(const float& x);
  152. char* ftostr4sign(const float& x);
  153. char* ftostr41sign(const float& x);
  154. char* ftostr32(const float& x);
  155. char* ftostr43sign(const float& x, char plus=' ');
  156. char* ftostr12ns(const float& x);
  157. char* ftostr5rj(const float& x);
  158. char* ftostr51sign(const float& x);
  159. char* ftostr52sign(const float& x);
  160. char* ftostr52sp(const float& x); // remove zero-padding from ftostr32
  161. #endif //ULTRALCD_H