diff -r 000000000000 -r 2c8ba1964db7 ultralcd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ultralcd.h Sat Nov 07 13:23:07 2015 +0100 @@ -0,0 +1,165 @@ +#ifndef ULTRALCD_H +#define ULTRALCD_H +#include "Marlin.h" +#ifdef ULTRA_LCD + #include + void lcd_status(); + void lcd_init(); + void lcd_status(const char* message); + void beep(); + void buttons_init(); + void buttons_check(); + + #define LCD_UPDATE_INTERVAL 100 + #define STATUSTIMEOUT 15000 + extern LiquidCrystal lcd; + extern volatile char buttons; //the last checked buttons in a bit array. + + #ifdef NEWPANEL + #define EN_C (1< -1) + #ifdef SDCARDDETECTINVERTED + #define CARDINSERTED (READ(SDCARDDETECT)!=0) + #else + #define CARDINSERTED (READ(SDCARDDETECT)==0) + #endif + #endif //SDCARDTETECTINVERTED + + #else + + //atomatic, do not change + #define B_LE (1<(LCD_HEIGHT-1+1)*lcdslow) + { + lineoffset++; + curencoderpos=(LCD_HEIGHT-1)*lcdslow; + if(lineoffset>(maxlines+1-LCD_HEIGHT)) + lineoffset=maxlines+1-LCD_HEIGHT; + if(curencoderpos>maxlines*lcdslow) + curencoderpos=maxlines*lcdslow; + } + lastencoderpos=encoderpos=curencoderpos; + activeline=curencoderpos/lcdslow; + if(activeline<0) activeline=0; + if(activeline>LCD_HEIGHT-1) activeline=LCD_HEIGHT-1; + if(activeline>maxlines) + { + activeline=maxlines; + curencoderpos=maxlines*lcdslow; + } + if(lastlineoffset!=lineoffset) + force_lcd_update=true; + lcd.setCursor(0,activeline);lcd.print((activeline+lineoffset)?'>':'\003'); + } + } + + FORCE_INLINE void clearIfNecessary() + { + if(lastlineoffset!=lineoffset ||force_lcd_update) + { + force_lcd_update=true; + lcd.clear(); + } + } + }; + + //conversion routines, could need some overworking + char *ftostr51(const float &x); + char *ftostr52(const float &x); + char *ftostr31(const float &x); + char *ftostr3(const float &x); + + + #define LCD_INIT lcd_init(); + #define LCD_MESSAGE(x) lcd_status(x); + #define LCD_MESSAGEPGM(x) lcd_statuspgm(MYPGM(x)); + #define LCD_STATUS lcd_status() +#else //no lcd + #define LCD_INIT + #define LCD_STATUS + #define LCD_MESSAGE(x) + #define LCD_MESSAGEPGM(x) + FORCE_INLINE void lcd_status() {}; + + #define CLICKED false + #define BLOCK ; +#endif + +void lcd_statuspgm(const char* message); + +char *ftostr3(const float &x); +char *itostr2(const uint8_t &x); +char *ftostr31(const float &x); +char *ftostr32(const float &x); +char *itostr31(const int &xx); +char *itostr3(const int &xx); +char *itostr4(const int &xx); +char *ftostr51(const float &x); +#endif //ULTRALCD