From 3d831090283ede2c7ea1ed8112efc2b9d47f8571 Mon Sep 17 00:00:00 2001 From: Daid Date: Wed, 29 Feb 2012 15:33:23 +0100 Subject: [PATCH] Fixed general 16x2 LCD build without SD support. --- Marlin/cardreader.h | 34 +++------------------------------- Marlin/ultralcd.h | 8 +++----- Marlin/ultralcd.pde | 14 ++++++++++---- 3 files changed, 16 insertions(+), 40 deletions(-) diff --git a/Marlin/cardreader.h b/Marlin/cardreader.h index 67fe58a90a..55fa786d7b 100644 --- a/Marlin/cardreader.h +++ b/Marlin/cardreader.h @@ -64,39 +64,11 @@ private: char* diveDirName; void lsDive(const char *prepend,SdFile parent); }; - +#define IS_SD_PRINTING (card.sdprinting) #else -#define dir_t bool -class CardReader -{ -public: - FORCE_INLINE CardReader(){}; - - FORCE_INLINE static void initsd(){}; - FORCE_INLINE static void write_command(char *buf){}; - - FORCE_INLINE static void checkautostart(bool x) {}; - - FORCE_INLINE static void openFile(char* name,bool read){}; - FORCE_INLINE static void closefile() {}; - FORCE_INLINE static void release(){}; - FORCE_INLINE static void startFileprint(){}; - FORCE_INLINE static void startFilewrite(char *name){}; - FORCE_INLINE static void pauseSDPrint(){}; - FORCE_INLINE static void getStatus(){}; - - FORCE_INLINE static void selectFile(char* name){}; - FORCE_INLINE static void getfilename(const uint8_t nr){}; - FORCE_INLINE static uint8_t getnrfilenames(){return 0;}; - +#define IS_SD_PRINTING (false) - FORCE_INLINE static void ls() {}; - FORCE_INLINE static bool eof() {return true;}; - FORCE_INLINE static char get() {return 0;}; - FORCE_INLINE static void setIndex(){}; - FORCE_INLINE uint8_t percentDone(){return 0;}; -}; #endif //SDSUPPORT -#endif \ No newline at end of file +#endif diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index c4392d26fc..253149cbba 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -129,6 +129,7 @@ //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); @@ -142,10 +143,8 @@ #define LCD_MESSAGE(x) #define LCD_MESSAGEPGM(x) FORCE_INLINE void lcd_status() {}; -#endif - -#ifndef ULTIPANEL - #define CLICKED false + + #define CLICKED false #define BLOCK ; #endif @@ -160,4 +159,3 @@ char *itostr3(const int &xx); char *itostr4(const int &xx); char *ftostr51(const float &x); #endif //ULTRALCD - diff --git a/Marlin/ultralcd.pde b/Marlin/ultralcd.pde index 54b7012848..8a059a1b7f 100644 --- a/Marlin/ultralcd.pde +++ b/Marlin/ultralcd.pde @@ -12,7 +12,9 @@ extern volatile bool feedmultiplychanged; extern volatile int extrudemultiply; extern long position[4]; +#ifdef SDSUPPORT extern CardReader card; +#endif //=========================================================================== //=============================public variables============================ @@ -480,7 +482,11 @@ void MainMenu::showPrepare() MENUITEM( lcdprintPGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ; break; case ItemP_autostart: - MENUITEM( lcdprintPGM(MSG_AUTOSTART) , BLOCK;card.lastnr=0;card.setroot();card.checkautostart(true);beepshort(); ) ; + MENUITEM( lcdprintPGM(MSG_AUTOSTART) , BLOCK; +#ifdef SDSUPPORT + card.lastnr=0;card.setroot();card.checkautostart(true); +#endif + beepshort(); ) ; break; case ItemP_disstep: MENUITEM( lcdprintPGM(MSG_DISABLE_STEPPERS) , BLOCK;enquecommand("M84");beepshort(); ) ; @@ -1629,7 +1635,7 @@ void MainMenu::showControlMotion() if(linechanging) { if(encoderpos<5) encoderpos=5; - if(encoderpos>99999) encoderpos=99999; + if(encoderpos>32000) encoderpos=32000;//TODO: This is a problem, encoderpos is 16bit, but steps_per_unit for e can be wel over 800 lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0)); } @@ -1957,7 +1963,7 @@ void MainMenu::showMainMenu() #endif if(tune) { - if(!(movesplanned() ||card.sdprinting)) + if(!(movesplanned() || IS_SD_PRINTING)) { force_lcd_update=true; tune=false; @@ -1965,7 +1971,7 @@ void MainMenu::showMainMenu() } else { - if(movesplanned() ||card.sdprinting) + if(movesplanned() || IS_SD_PRINTING) { force_lcd_update=true; tune=true;