My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

ultralcd.h 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
  27. extern bool lcd_external_control;
  28. #if ENABLED(G26_MESH_VALIDATION)
  29. void lcd_chirp();
  30. #endif
  31. #endif
  32. #define BUTTON_EXISTS(BN) (defined(BTN_## BN) && BTN_## BN >= 0)
  33. #define BUTTON_PRESSED(BN) !READ(BTN_## BN)
  34. extern int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
  35. int16_t lcd_strlen(const char* s);
  36. int16_t lcd_strlen_P(const char* s);
  37. void lcd_update();
  38. void lcd_init();
  39. bool lcd_hasstatus();
  40. void lcd_setstatus(const char* message, const bool persist=false);
  41. void lcd_setstatusPGM(const char* message, const int8_t level=0);
  42. void lcd_setalertstatusPGM(const char* message);
  43. void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...);
  44. void lcd_reset_alert_level();
  45. void lcd_kill_screen();
  46. void kill_screen(const char* lcd_msg);
  47. bool lcd_detected(void);
  48. extern uint8_t lcdDrawUpdate;
  49. inline void lcd_refresh() { lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; }
  50. #if HAS_BUZZER
  51. void lcd_buzz(long duration, uint16_t freq);
  52. #endif
  53. #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
  54. void dontExpireStatus();
  55. #endif
  56. #if ENABLED(ADC_KEYPAD)
  57. uint8_t get_ADC_keyValue();
  58. #endif
  59. #if ENABLED(DOGLCD)
  60. extern uint16_t lcd_contrast;
  61. void set_lcd_contrast(const uint16_t value);
  62. #endif
  63. #if ENABLED(SHOW_BOOTSCREEN)
  64. void lcd_bootscreen();
  65. #endif
  66. #define LCD_UPDATE_INTERVAL 100
  67. #if ENABLED(ULTIPANEL)
  68. #define BLEN_A 0
  69. #define BLEN_B 1
  70. // Encoder click is directly connected
  71. #if BUTTON_EXISTS(ENC)
  72. #define BLEN_C 2
  73. #endif
  74. #define EN_A (_BV(BLEN_A))
  75. #define EN_B (_BV(BLEN_B))
  76. #define EN_C (_BV(BLEN_C))
  77. extern volatile uint8_t buttons; // The last-checked buttons in a bit array.
  78. void lcd_buttons_update();
  79. void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
  80. void lcd_completion_feedback(const bool good=true);
  81. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  82. void lcd_advanced_pause_show_message(const AdvancedPauseMessage message);
  83. #endif // ADVANCED_PAUSE_FEATURE
  84. #else
  85. inline void lcd_buttons_update() {}
  86. #endif
  87. #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
  88. extern millis_t previous_lcd_status_ms;
  89. #endif
  90. bool lcd_blink();
  91. #if ENABLED(REPRAPWORLD_KEYPAD) // is also ULTIPANEL and NEWPANEL
  92. #define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
  93. #define BLEN_REPRAPWORLD_KEYPAD_F3 0
  94. #define BLEN_REPRAPWORLD_KEYPAD_F2 1
  95. #define BLEN_REPRAPWORLD_KEYPAD_F1 2
  96. #define BLEN_REPRAPWORLD_KEYPAD_DOWN 3
  97. #define BLEN_REPRAPWORLD_KEYPAD_RIGHT 4
  98. #define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5
  99. #define BLEN_REPRAPWORLD_KEYPAD_UP 6
  100. #define BLEN_REPRAPWORLD_KEYPAD_LEFT 7
  101. #define EN_REPRAPWORLD_KEYPAD_F3 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F3))
  102. #define EN_REPRAPWORLD_KEYPAD_F2 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F2))
  103. #define EN_REPRAPWORLD_KEYPAD_F1 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F1))
  104. #define EN_REPRAPWORLD_KEYPAD_DOWN (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_DOWN))
  105. #define EN_REPRAPWORLD_KEYPAD_RIGHT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_RIGHT))
  106. #define EN_REPRAPWORLD_KEYPAD_MIDDLE (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_MIDDLE))
  107. #define EN_REPRAPWORLD_KEYPAD_UP (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_UP))
  108. #define EN_REPRAPWORLD_KEYPAD_LEFT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_LEFT))
  109. #define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F3)
  110. #define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F2)
  111. #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN)
  112. #define REPRAPWORLD_KEYPAD_MOVE_X_RIGHT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT)
  113. #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP)
  114. #define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT)
  115. #if ENABLED(ADC_KEYPAD)
  116. #define KEYPAD_HOME EN_REPRAPWORLD_KEYPAD_F1
  117. #define KEYPAD_EN_C EN_REPRAPWORLD_KEYPAD_MIDDLE
  118. #else
  119. #define KEYPAD_HOME EN_REPRAPWORLD_KEYPAD_MIDDLE
  120. #define KEYPAD_EN_C EN_REPRAPWORLD_KEYPAD_F1
  121. #endif
  122. #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad & KEYPAD_HOME)
  123. #define REPRAPWORLD_KEYPAD_MOVE_MENU (buttons_reprapworld_keypad & KEYPAD_EN_C)
  124. #if BUTTON_EXISTS(ENC)
  125. #define LCD_CLICKED ((buttons & EN_C) || REPRAPWORLD_KEYPAD_MOVE_MENU)
  126. #else
  127. #define LCD_CLICKED REPRAPWORLD_KEYPAD_MOVE_MENU
  128. #endif
  129. #define REPRAPWORLD_KEYPAD_PRESSED (buttons_reprapworld_keypad & ( \
  130. EN_REPRAPWORLD_KEYPAD_F3 | \
  131. EN_REPRAPWORLD_KEYPAD_F2 | \
  132. EN_REPRAPWORLD_KEYPAD_F1 | \
  133. EN_REPRAPWORLD_KEYPAD_DOWN | \
  134. EN_REPRAPWORLD_KEYPAD_RIGHT | \
  135. EN_REPRAPWORLD_KEYPAD_MIDDLE | \
  136. EN_REPRAPWORLD_KEYPAD_UP | \
  137. EN_REPRAPWORLD_KEYPAD_LEFT) \
  138. )
  139. #elif ENABLED(NEWPANEL)
  140. #define LCD_CLICKED (buttons & EN_C)
  141. #else
  142. #define LCD_CLICKED false
  143. #endif
  144. #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
  145. bool is_lcd_clicked();
  146. #endif
  147. #if ENABLED(LCD_SET_PROGRESS_MANUALLY) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD))
  148. extern uint8_t progress_bar_percent;
  149. #endif
  150. #else // no LCD
  151. inline void lcd_update() {}
  152. inline void lcd_init() {}
  153. inline bool lcd_hasstatus() { return false; }
  154. inline void lcd_setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
  155. inline void lcd_setstatusPGM(const char* const message, const int8_t level=0) { UNUSED(message); UNUSED(level); }
  156. inline void lcd_setalertstatusPGM(const char* message) { UNUSED(message); }
  157. inline void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { UNUSED(level); UNUSED(fmt); }
  158. inline void lcd_buttons_update() {}
  159. inline void lcd_reset_alert_level() {}
  160. inline bool lcd_detected() { return true; }
  161. inline void lcd_refresh() {}
  162. #endif // ULTRA_LCD
  163. #define LCD_MESSAGEPGM(x) lcd_setstatusPGM(PSTR(x))
  164. #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatusPGM(PSTR(x))
  165. void lcd_reset_status();
  166. #if ENABLED(AUTO_BED_LEVELING_UBL)
  167. void lcd_mesh_edit_setup(float initial);
  168. float lcd_mesh_edit();
  169. void lcd_z_offset_edit_setup(float);
  170. float lcd_z_offset_edit();
  171. #endif
  172. #if ENABLED(DELTA_AUTO_CALIBRATION) && !HAS_BED_PROBE
  173. float lcd_probe_pt(const float &rx, const float &ry);
  174. #endif
  175. #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
  176. void lcd_reselect_last_file();
  177. #endif
  178. #endif // ULTRALCD_H