浏览代码

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

daid303 12 年前
父节点
当前提交
6c51fe5039
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2
    2
      Marlin/cardreader.h

+ 2
- 2
Marlin/cardreader.h 查看文件

@@ -38,7 +38,7 @@ public:
38 38
   FORCE_INLINE bool eof() { return sdpos>=filesize ;};
39 39
   FORCE_INLINE int16_t get() {  sdpos = file.curPosition();return (int16_t)file.read();};
40 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 42
   FORCE_INLINE char* getWorkDirName(){workDir.getFilename(filename);return filename;};
43 43
 
44 44
 public:
@@ -73,4 +73,4 @@ private:
73 73
 #define IS_SD_PRINTING (false)
74 74
 
75 75
 #endif //SDSUPPORT
76
-#endif
76
+#endif

正在加载...
取消
保存