Browse Source

Fix the bug where the SD percentage calculation is wrong when the file is larger then 42MB

daid303 12 years ago
parent
commit
6c51fe5039
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      Marlin/cardreader.h

+ 2
- 2
Marlin/cardreader.h View File

38
   FORCE_INLINE bool eof() { return sdpos>=filesize ;};
38
   FORCE_INLINE bool eof() { return sdpos>=filesize ;};
39
   FORCE_INLINE int16_t get() {  sdpos = file.curPosition();return (int16_t)file.read();};
39
   FORCE_INLINE int16_t get() {  sdpos = file.curPosition();return (int16_t)file.read();};
40
   FORCE_INLINE void setIndex(long index) {sdpos = index;file.seekSet(index);};
40
   FORCE_INLINE void setIndex(long index) {sdpos = index;file.seekSet(index);};
41
-  FORCE_INLINE uint8_t percentDone(){if(!sdprinting) return 0; if(filesize) return sdpos*100/filesize; else return 0;};
41
+  FORCE_INLINE uint8_t percentDone(){if(!sdprinting) return 0; if(filesize) return sdpos/((filesize+99)/100); else return 0;};
42
   FORCE_INLINE char* getWorkDirName(){workDir.getFilename(filename);return filename;};
42
   FORCE_INLINE char* getWorkDirName(){workDir.getFilename(filename);return filename;};
43
 
43
 
44
 public:
44
 public:
73
 #define IS_SD_PRINTING (false)
73
 #define IS_SD_PRINTING (false)
74
 
74
 
75
 #endif //SDSUPPORT
75
 #endif //SDSUPPORT
76
-#endif
76
+#endif

Loading…
Cancel
Save