Procházet zdrojové kódy

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

daid303 před 12 roky
rodič
revize
6c51fe5039
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. 2
    2
      Marlin/cardreader.h

+ 2
- 2
Marlin/cardreader.h Zobrazit soubor

@@ -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

Loading…
Zrušit
Uložit