My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

ultralcd.h 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. #ifndef ULTRALCD_H
  2. #define ULTRALCD_H
  3. #include "Marlin.h"
  4. #ifdef ULTRA_LCD
  5. #include "language.h"
  6. #if LANGUAGE_CHOICE == 6
  7. #include "LiquidCrystalRus.h"
  8. #define LCD_CLASS LiquidCrystalRus
  9. #else
  10. #include <LiquidCrystal.h>
  11. #define LCD_CLASS LiquidCrystal
  12. #endif
  13. void lcd_status();
  14. void lcd_init();
  15. void lcd_status(const char* message);
  16. void beep();
  17. void buttons_init();
  18. void buttons_check();
  19. #define LCD_UPDATE_INTERVAL 100
  20. #define STATUSTIMEOUT 15000
  21. extern LCD_CLASS lcd;
  22. extern volatile char buttons; //the last checked buttons in a bit array.
  23. #ifdef NEWPANEL
  24. #define EN_C (1<<BLEN_C)
  25. #define EN_B (1<<BLEN_B)
  26. #define EN_A (1<<BLEN_A)
  27. #define CLICKED (buttons&EN_C)
  28. #define BLOCK {blocking=millis()+blocktime;}
  29. #else
  30. //atomatic, do not change
  31. #define B_LE (1<<BL_LE)
  32. #define B_UP (1<<BL_UP)
  33. #define B_MI (1<<BL_MI)
  34. #define B_DW (1<<BL_DW)
  35. #define B_RI (1<<BL_RI)
  36. #define B_ST (1<<BL_ST)
  37. #define EN_B (1<<BLEN_B)
  38. #define EN_A (1<<BLEN_A)
  39. #define CLICKED ((buttons&B_MI)||(buttons&B_ST))
  40. #define BLOCK {blocking[BL_MI]=millis()+blocktime;blocking[BL_ST]=millis()+blocktime;}
  41. #endif
  42. #if (SDCARDDETECT > -1)
  43. #ifdef SDCARDDETECTINVERTED
  44. #define CARDINSERTED (READ(SDCARDDETECT)!=0)
  45. #else
  46. #define CARDINSERTED (READ(SDCARDDETECT)==0)
  47. #endif //SDCARDTETECTINVERTED
  48. #else
  49. //If we don't have a card detect line, aways asume the card is inserted
  50. #define CARDINSERTED true
  51. #endif
  52. // blocking time for recognizing a new keypress of one key, ms
  53. #define blocktime 500
  54. #define lcdslow 5
  55. enum MainStatus{Main_Status, Main_Menu, Main_Prepare,Sub_PrepareMove, Main_Control, Main_SD,Sub_TempControl,Sub_MotionControl,Sub_RetractControl, Sub_PreheatPLASettings, Sub_PreheatABSSettings};
  56. class MainMenu{
  57. public:
  58. MainMenu();
  59. void update();
  60. int8_t activeline;
  61. MainStatus status;
  62. uint8_t displayStartingRow;
  63. void showStatus();
  64. void showMainMenu();
  65. void showPrepare();
  66. void showTune();
  67. void showControl();
  68. void showControlMotion();
  69. void showControlTemp();
  70. void showControlRetract();
  71. void showAxisMove();
  72. void showSD();
  73. void showPLAsettings();
  74. void showABSsettings();
  75. bool force_lcd_update;
  76. long lastencoderpos;
  77. int8_t lineoffset;
  78. int8_t lastlineoffset;
  79. bool linechanging;
  80. bool tune;
  81. private:
  82. FORCE_INLINE void updateActiveLines(const uint8_t &maxlines,volatile long &encoderpos)
  83. {
  84. if(linechanging) return; // an item is changint its value, do not switch lines hence
  85. lastlineoffset=lineoffset;
  86. long curencoderpos=encoderpos;
  87. force_lcd_update=false;
  88. if( (abs(curencoderpos-lastencoderpos)<lcdslow) )
  89. {
  90. lcd.setCursor(0,activeline);lcd.print((activeline+lineoffset)?' ':' ');
  91. if(curencoderpos<0)
  92. {
  93. lineoffset--;
  94. if(lineoffset<0) lineoffset=0;
  95. curencoderpos=lcdslow-1;
  96. }
  97. if(curencoderpos>(LCD_HEIGHT-1+1)*lcdslow)
  98. {
  99. lineoffset++;
  100. curencoderpos=(LCD_HEIGHT-1)*lcdslow;
  101. if(lineoffset>(maxlines+1-LCD_HEIGHT))
  102. lineoffset=maxlines+1-LCD_HEIGHT;
  103. if(curencoderpos>maxlines*lcdslow)
  104. curencoderpos=maxlines*lcdslow;
  105. }
  106. lastencoderpos=encoderpos=curencoderpos;
  107. activeline=curencoderpos/lcdslow;
  108. if(activeline<0) activeline=0;
  109. if(activeline>LCD_HEIGHT-1) activeline=LCD_HEIGHT-1;
  110. if(activeline>maxlines)
  111. {
  112. activeline=maxlines;
  113. curencoderpos=maxlines*lcdslow;
  114. }
  115. if(lastlineoffset!=lineoffset)
  116. force_lcd_update=true;
  117. lcd.setCursor(0,activeline);lcd.print((activeline+lineoffset)?'>':'\003');
  118. }
  119. }
  120. FORCE_INLINE void clearIfNecessary()
  121. {
  122. if(lastlineoffset!=lineoffset ||force_lcd_update)
  123. {
  124. force_lcd_update=true;
  125. lcd.clear();
  126. }
  127. }
  128. };
  129. //conversion routines, could need some overworking
  130. char *ftostr51(const float &x);
  131. char *ftostr52(const float &x);
  132. char *ftostr31(const float &x);
  133. char *ftostr3(const float &x);
  134. #define LCD_INIT lcd_init();
  135. #define LCD_MESSAGE(x) lcd_status(x);
  136. #define LCD_MESSAGEPGM(x) lcd_statuspgm(PSTR(x));
  137. #define LCD_ALERTMESSAGEPGM(x) lcd_alertstatuspgm(PSTR(x));
  138. #define LCD_STATUS lcd_status()
  139. #else //no lcd
  140. #define LCD_INIT
  141. #define LCD_STATUS
  142. #define LCD_MESSAGE(x)
  143. #define LCD_MESSAGEPGM(x)
  144. #define LCD_ALERTMESSAGEPGM(x)
  145. FORCE_INLINE void lcd_status() {};
  146. #define CLICKED false
  147. #define BLOCK ;
  148. #endif
  149. void lcd_statuspgm(const char* message);
  150. void lcd_alertstatuspgm(const char* message);
  151. char *ftostr3(const float &x);
  152. char *itostr2(const uint8_t &x);
  153. char *ftostr31(const float &x);
  154. char *ftostr32(const float &x);
  155. char *itostr31(const int &xx);
  156. char *itostr3(const int &xx);
  157. char *itostr4(const int &xx);
  158. char *ftostr51(const float &x);
  159. //TODO: These do not belong here.
  160. extern int plaPreheatHotendTemp;
  161. extern int plaPreheatHPBTemp;
  162. extern int plaPreheatFanSpeed;
  163. extern int absPreheatHotendTemp;
  164. extern int absPreheatHPBTemp;
  165. extern int absPreheatFanSpeed;
  166. #endif //ULTRALCD