From 6c51fe50396a8cb619a1b3a3b67ab5b1023d9dd0 Mon Sep 17 00:00:00 2001 From: daid303 Date: Mon, 3 Dec 2012 11:35:36 +0100 Subject: [PATCH] Fix the bug where the SD percentage calculation is wrong when the file is larger then 42MB --- Marlin/cardreader.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/cardreader.h b/Marlin/cardreader.h index e5c8443f5e..679cbbcd79 100644 --- a/Marlin/cardreader.h +++ b/Marlin/cardreader.h @@ -38,7 +38,7 @@ public: FORCE_INLINE bool eof() { return sdpos>=filesize ;}; FORCE_INLINE int16_t get() { sdpos = file.curPosition();return (int16_t)file.read();}; FORCE_INLINE void setIndex(long index) {sdpos = index;file.seekSet(index);}; - FORCE_INLINE uint8_t percentDone(){if(!sdprinting) return 0; if(filesize) return sdpos*100/filesize; else return 0;}; + FORCE_INLINE uint8_t percentDone(){if(!sdprinting) return 0; if(filesize) return sdpos/((filesize+99)/100); else return 0;}; FORCE_INLINE char* getWorkDirName(){workDir.getFilename(filename);return filename;}; public: @@ -73,4 +73,4 @@ private: #define IS_SD_PRINTING (false) #endif //SDSUPPORT -#endif +#endif