浏览代码

getter function for filesize

PavelSindler 7 年之前
父节点
当前提交
026e3ecaac
共有 3 个文件被更改,包括 7 次插入7 次删除
  1. 2 2
      Firmware/cardreader.cpp
  2. 1 2
      Firmware/cardreader.h
  3. 4 3
      Firmware/ultralcd.cpp

+ 2 - 2
Firmware/cardreader.cpp

@@ -501,9 +501,9 @@ void CardReader::removeFile(char* name)
   
 }
 
-void CardReader::getFileSize()
+uint32_t CardReader::getFileSize()
 {
-	public_fileSize = filesize;
+	return filesize;
 }
 
 void CardReader::getStatus()

+ 1 - 2
Firmware/cardreader.h

@@ -27,7 +27,7 @@ public:
   void release();
   void startFileprint();
   void pauseSDPrint();
-  void getFileSize();
+  uint32_t getFileSize();
   void getStatus();
   void printingHasFinished();
 
@@ -70,7 +70,6 @@ public:
   bool cardOK ;
   char filename[13];
   uint16_t creationTime, creationDate;
-  uint32_t public_fileSize;
   char longFilename[LONG_FILENAME_LENGTH];
   bool filenameIsDir;
   int lastnr; //last number of the autostart;

+ 4 - 3
Firmware/ultralcd.cpp

@@ -4967,10 +4967,11 @@ static void menu_action_function(menuFunc_t data) {
 
 static bool check_file(const char* filename) {
 	bool result = false;
+	uint32_t filesize;
 	card.openFile(filename, true);
-	card.getFileSize();
-	if (card.public_fileSize > END_FILE_SECTION) {
-		card.setIndex((card.public_fileSize) - END_FILE_SECTION);
+	filesize = card.getFileSize();
+	if (fileSize > END_FILE_SECTION) {
+		card.setIndex(filesize - END_FILE_SECTION);
 	}
 
 	while (!card.eof() && !result) {