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.

ultralcd.h 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. extern int preheatHotendTemp1,
  29. preheatBedTemp1,
  30. preheatFanSpeed1,
  31. preheatHotendTemp2,
  32. preheatBedTemp2,
  33. preheatFanSpeed2;
  34. int lcd_strlen(const char* s);
  35. int lcd_strlen_P(const char* s);
  36. void lcd_update();
  37. void lcd_init();
  38. bool lcd_hasstatus();
  39. void lcd_setstatus(const char* message, const bool persist=false);
  40. void lcd_setstatuspgm(const char* message, const uint8_t level=0);
  41. void lcd_setalertstatuspgm(const char* message);
  42. void lcd_reset_alert_level();
  43. bool lcd_detected(void);
  44. void lcd_kill_screen();
  45. void kill_screen(const char* lcd_msg);
  46. #if HAS_BUZZER
  47. void lcd_buzz(long duration, uint16_t freq);
  48. #endif
  49. #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
  50. void dontExpireStatus();
  51. #endif
  52. #if ENABLED(DOGLCD)
  53. extern int lcd_contrast;
  54. void set_lcd_contrast(int value);
  55. #elif ENABLED(SHOW_BOOTSCREEN)
  56. void bootscreen();
  57. #endif
  58. #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
  59. #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
  60. #define LCD_UPDATE_INTERVAL 100
  61. #define LCD_TIMEOUT_TO_STATUS 15000
  62. #if ENABLED(ULTIPANEL)
  63. #define BLEN_A 0
  64. #define BLEN_B 1
  65. // Encoder click is directly connected
  66. #if BUTTON_EXISTS(ENC)
  67. #define BLEN_C 2
  68. #define EN_C (_BV(BLEN_C))
  69. #endif
  70. #define EN_A (_BV(BLEN_A))
  71. #define EN_B (_BV(BLEN_B))
  72. #define EN_C (_BV(BLEN_C))
  73. extern volatile uint8_t buttons; //the last checked buttons in a bit array.
  74. void lcd_buttons_update();
  75. void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
  76. #if ENABLED(FILAMENT_CHANGE_FEATURE)
  77. void lcd_filament_change_show_message(FilamentChangeMessage message);
  78. #endif // FILAMENT_CHANGE_FEATURE
  79. #else
  80. inline void lcd_buttons_update() {}
  81. #endif
  82. #if ENABLED(FILAMENT_LCD_DISPLAY)
  83. extern millis_t previous_lcd_status_ms;
  84. #endif
  85. bool lcd_blink();
  86. #if ENABLED(REPRAPWORLD_KEYPAD) // is also ULTIPANEL and NEWPANEL
  87. #define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
  88. #define BLEN_REPRAPWORLD_KEYPAD_F3 0
  89. #define BLEN_REPRAPWORLD_KEYPAD_F2 1
  90. #define BLEN_REPRAPWORLD_KEYPAD_F1 2
  91. #define BLEN_REPRAPWORLD_KEYPAD_DOWN 3
  92. #define BLEN_REPRAPWORLD_KEYPAD_RIGHT 4
  93. #define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5
  94. #define BLEN_REPRAPWORLD_KEYPAD_UP 6
  95. #define BLEN_REPRAPWORLD_KEYPAD_LEFT 7
  96. #define EN_REPRAPWORLD_KEYPAD_F3 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F3))
  97. #define EN_REPRAPWORLD_KEYPAD_F2 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F2))
  98. #define EN_REPRAPWORLD_KEYPAD_F1 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F1))
  99. #define EN_REPRAPWORLD_KEYPAD_DOWN (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_DOWN))
  100. #define EN_REPRAPWORLD_KEYPAD_RIGHT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_RIGHT))
  101. #define EN_REPRAPWORLD_KEYPAD_MIDDLE (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_MIDDLE))
  102. #define EN_REPRAPWORLD_KEYPAD_UP (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_UP))
  103. #define EN_REPRAPWORLD_KEYPAD_LEFT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_LEFT))
  104. #define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F3)
  105. #define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F2)
  106. #define REPRAPWORLD_KEYPAD_MOVE_MENU (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F1)
  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. #define REPRAPWORLD_KEYPAD_PRESSED (buttons_reprapworld_keypad & ( \
  113. EN_REPRAPWORLD_KEYPAD_F3 | \
  114. EN_REPRAPWORLD_KEYPAD_F2 | \
  115. EN_REPRAPWORLD_KEYPAD_F1 | \
  116. EN_REPRAPWORLD_KEYPAD_DOWN | \
  117. EN_REPRAPWORLD_KEYPAD_RIGHT | \
  118. EN_REPRAPWORLD_KEYPAD_MIDDLE | \
  119. EN_REPRAPWORLD_KEYPAD_UP | \
  120. EN_REPRAPWORLD_KEYPAD_LEFT) \
  121. )
  122. #define LCD_CLICKED ((buttons & EN_C) || (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F1))
  123. #elif ENABLED(NEWPANEL)
  124. #define LCD_CLICKED (buttons & EN_C)
  125. #else
  126. #define LCD_CLICKED false
  127. #endif
  128. #else //no LCD
  129. inline void lcd_update() {}
  130. inline void lcd_init() {}
  131. inline bool lcd_hasstatus() { return false; }
  132. inline void lcd_setstatus(const char* message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
  133. inline void lcd_setstatuspgm(const char* message, const uint8_t level=0) { UNUSED(message); UNUSED(level); }
  134. inline void lcd_buttons_update() {}
  135. inline void lcd_reset_alert_level() {}
  136. inline bool lcd_detected(void) { return true; }
  137. #define LCD_MESSAGEPGM(x) NOOP
  138. #define LCD_ALERTMESSAGEPGM(x) NOOP
  139. #endif // ULTRA_LCD
  140. #endif // ULTRALCD_H