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

ultralcd.h 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. #ifndef __ULTRALCDH
  2. #define __ULTRALCDH
  3. #include "Configuration.h"
  4. #ifdef ULTRA_LCD
  5. void lcd_status();
  6. void lcd_init();
  7. void lcd_status(const char* message);
  8. void beep();
  9. void buttons_check();
  10. #define LCDSTATUSRIGHT
  11. #define LCD_UPDATE_INTERVAL 100
  12. #define STATUSTIMEOUT 15000
  13. #include "Configuration.h"
  14. #include <LiquidCrystal.h>
  15. extern LiquidCrystal lcd;
  16. //lcd display size
  17. #ifdef NEWPANEL
  18. //arduino pin witch triggers an piezzo beeper
  19. #define BEEPER 18
  20. #define LCD_PINS_RS 20
  21. #define LCD_PINS_ENABLE 17
  22. #define LCD_PINS_D4 16
  23. #define LCD_PINS_D5 21
  24. #define LCD_PINS_D6 5
  25. #define LCD_PINS_D7 6
  26. //buttons are directly attached
  27. #define BTN_EN1 40
  28. #define BTN_EN2 42
  29. #define BTN_ENC 19 //the click
  30. #define BLEN_C 2
  31. #define BLEN_B 1
  32. #define BLEN_A 0
  33. #define SDCARDDETECT 38
  34. #define EN_C (1<<BLEN_C)
  35. #define EN_B (1<<BLEN_B)
  36. #define EN_A (1<<BLEN_A)
  37. //encoder rotation values
  38. #define encrot0 0
  39. #define encrot1 2
  40. #define encrot2 3
  41. #define encrot3 1
  42. #define CLICKED (buttons&EN_C)
  43. #define BLOCK {blocking=millis()+blocktime;}
  44. #define CARDINSERTED (READ(SDCARDDETECT)==0)
  45. #else
  46. //arduino pin witch triggers an piezzo beeper
  47. #define BEEPER 18
  48. //buttons are attached to a shift register
  49. #define SHIFT_CLK 38
  50. #define SHIFT_LD 42
  51. #define SHIFT_OUT 40
  52. #define SHIFT_EN 17
  53. #define LCD_PINS_RS 16
  54. #define LCD_PINS_ENABLE 5
  55. #define LCD_PINS_D4 6
  56. #define LCD_PINS_D5 21
  57. #define LCD_PINS_D6 20
  58. #define LCD_PINS_D7 19
  59. //bits in the shift register that carry the buttons for:
  60. // left up center down right red
  61. #define BL_LE 7
  62. #define BL_UP 6
  63. #define BL_MI 5
  64. #define BL_DW 4
  65. #define BL_RI 3
  66. #define BL_ST 2
  67. #define BLEN_B 1
  68. #define BLEN_A 0
  69. //encoder rotation values
  70. #define encrot0 0
  71. #define encrot1 2
  72. #define encrot2 3
  73. #define encrot3 1
  74. //atomatic, do not change
  75. #define B_LE (1<<BL_LE)
  76. #define B_UP (1<<BL_UP)
  77. #define B_MI (1<<BL_MI)
  78. #define B_DW (1<<BL_DW)
  79. #define B_RI (1<<BL_RI)
  80. #define B_ST (1<<BL_ST)
  81. #define EN_B (1<<BLEN_B)
  82. #define EN_A (1<<BLEN_A)
  83. #define CLICKED ((buttons&B_MI)||(buttons&B_ST))
  84. #define BLOCK {blocking[BL_MI]=millis()+blocktime;blocking[BL_ST]=millis()+blocktime;}
  85. #endif
  86. // blocking time for recognizing a new keypress of one key, ms
  87. #define blocktime 500
  88. #define lcdslow 5
  89. enum MainStatus{Main_Status, Main_Menu, Main_Prepare, Main_Control, Main_SD};
  90. class MainMenu{
  91. public:
  92. MainMenu();
  93. void update();
  94. void getfilename(const uint8_t nr);
  95. uint8_t activeline;
  96. MainStatus status;
  97. uint8_t displayStartingRow;
  98. void showStatus();
  99. void showMainMenu();
  100. void showPrepare();
  101. void showControl();
  102. void showSD();
  103. bool force_lcd_update;
  104. int lastencoderpos;
  105. int8_t lineoffset;
  106. int8_t lastlineoffset;
  107. char filename[11];
  108. bool linechanging;
  109. };
  110. char *fillto(int8_t n,char *c);
  111. char *ftostr51(const float &x);
  112. char *ftostr31(const float &x);
  113. char *ftostr3(const float &x);
  114. #define LCD_MESSAGE(x) lcd_status(x);
  115. #define LCD_STATUS lcd_status()
  116. #else //no lcd
  117. #define LCD_STATUS
  118. #define LCD_MESSAGE(x)
  119. #endif
  120. #ifndef ULTIPANEL
  121. #define CLICKED false
  122. #define BLOCK ;
  123. #endif
  124. #endif //ULTRALCD