Browse Source

Make card filename `const`

Fixes warning in filename_wldsd
Petr Ledvina 5 years ago
parent
commit
baddf38dbc
3 changed files with 9 additions and 9 deletions
  1. 1 1
      Firmware/Marlin_main.cpp
  2. 5 5
      Firmware/cardreader.cpp
  3. 3 3
      Firmware/cardreader.h

+ 1 - 1
Firmware/Marlin_main.cpp

@@ -8082,7 +8082,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_
 	int ix = 0;
 	int iy = 0;
 
-	char* filename_wldsd = "wldsd.txt";
+	const char* filename_wldsd = "wldsd.txt";
 	char data_wldsd[70];
 	char numb_wldsd[10];
 

+ 5 - 5
Firmware/cardreader.cpp

@@ -258,7 +258,7 @@ void CardReader::pauseSDPrint()
 }
 
 
-void CardReader::openLogFile(char* name)
+void CardReader::openLogFile(const char* name)
 {
   logging = true;
   openFile(name, false);
@@ -289,7 +289,7 @@ void CardReader::getAbsFilename(char *t)
     t[0]=0;
 }
 
-void CardReader::openFile(char* name,bool read, bool replace_current/*=true*/)
+void CardReader::openFile(const char* name,bool read, bool replace_current/*=true*/)
 {
   if(!cardOK)
     return;
@@ -341,7 +341,7 @@ void CardReader::openFile(char* name,bool read, bool replace_current/*=true*/)
  
   SdFile myDir;
   curDir=&root;
-  char *fname=name;
+  const char *fname=name;
   
   char *dirname_start,*dirname_end;
   if(name[0]=='/')
@@ -429,7 +429,7 @@ void CardReader::openFile(char* name,bool read, bool replace_current/*=true*/)
   
 }
 
-void CardReader::removeFile(char* name)
+void CardReader::removeFile(const char* name)
 {
   if(!cardOK)
     return;
@@ -439,7 +439,7 @@ void CardReader::removeFile(char* name)
   
   SdFile myDir;
   curDir=&root;
-  char *fname=name;
+  const char *fname=name;
   
   char *dirname_start,*dirname_end;
   if(name[0]=='/')

+ 3 - 3
Firmware/cardreader.h

@@ -19,9 +19,9 @@ public:
   //this is to delay autostart and hence the initialisaiton of the sd card to some seconds after the normal init, so the device is available quick after a reset
 
   void checkautostart(bool x); 
-  void openFile(char* name,bool read,bool replace_current=true);
-  void openLogFile(char* name);
-  void removeFile(char* name);
+  void openFile(const char* name,bool read,bool replace_current=true);
+  void openLogFile(const char* name);
+  void removeFile(const char* name);
   void closefile(bool store_location=false);
   void release();
   void startFileprint();