Browse Source

A few constants where they belong

pull/1/head
Scott Lahteine 10 years ago
parent
commit
b726511a3b
  1. 4
      Marlin/Marlin_main.cpp
  2. 4
      Marlin/SdFatConfig.h
  3. 10
      Marlin/cardreader.cpp
  4. 4
      Marlin/cardreader.h

4
Marlin/Marlin_main.cpp

@ -429,7 +429,7 @@ void enquecommand(const char *cmd)
//this is dangerous if a mixing of serial and this happens //this is dangerous if a mixing of serial and this happens
strcpy(&(cmdbuffer[bufindw][0]),cmd); strcpy(&(cmdbuffer[bufindw][0]),cmd);
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPGM("enqueing \""); SERIAL_ECHOPGM(MSG_Enqueing);
SERIAL_ECHO(cmdbuffer[bufindw]); SERIAL_ECHO(cmdbuffer[bufindw]);
SERIAL_ECHOLNPGM("\""); SERIAL_ECHOLNPGM("\"");
bufindw= (bufindw + 1)%BUFSIZE; bufindw= (bufindw + 1)%BUFSIZE;
@ -444,7 +444,7 @@ void enquecommand_P(const char *cmd)
//this is dangerous if a mixing of serial and this happens //this is dangerous if a mixing of serial and this happens
strcpy_P(&(cmdbuffer[bufindw][0]),cmd); strcpy_P(&(cmdbuffer[bufindw][0]),cmd);
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPGM("enqueing \""); SERIAL_ECHOPGM(MSG_Enqueing);
SERIAL_ECHO(cmdbuffer[bufindw]); SERIAL_ECHO(cmdbuffer[bufindw]);
SERIAL_ECHOLNPGM("\""); SERIAL_ECHOLNPGM("\"");
bufindw= (bufindw + 1)%BUFSIZE; bufindw= (bufindw + 1)%BUFSIZE;

4
Marlin/SdFatConfig.h

@ -113,8 +113,10 @@ uint8_t const SOFT_SPI_SCK_PIN = 13;
*/ */
/** Number of VFAT entries used. Every entry has 13 UTF-16 characters */ /** Number of VFAT entries used. Every entry has 13 UTF-16 characters */
#define MAX_VFAT_ENTRIES (2) #define MAX_VFAT_ENTRIES (2)
/** Number of UTF-16 characters per entry */
#define FILENAME_LENGTH 13
/** Total size of the buffer used to store the long filenames */ /** Total size of the buffer used to store the long filenames */
#define LONG_FILENAME_LENGTH (13*MAX_VFAT_ENTRIES+1) #define LONG_FILENAME_LENGTH (FILENAME_LENGTH*MAX_VFAT_ENTRIES+1)
#endif // SdFatConfig_h #endif // SdFatConfig_h

10
Marlin/cardreader.cpp

@ -60,8 +60,8 @@ void CardReader::lsDive(const char *prepend,SdFile parent)
if( DIR_IS_SUBDIR(&p) && lsAction!=LS_Count && lsAction!=LS_GetFilename) // hence LS_SerialPrint if( DIR_IS_SUBDIR(&p) && lsAction!=LS_Count && lsAction!=LS_GetFilename) // hence LS_SerialPrint
{ {
char path[13*2]; char path[FILENAME_LENGTH*2];
char lfilename[13]; char lfilename[FILENAME_LENGTH];
createFilename(lfilename,p); createFilename(lfilename,p);
path[0]=0; path[0]=0;
@ -235,7 +235,7 @@ void CardReader::getAbsFilename(char *t)
while(*t!=0 && cnt< MAXPATHNAMELENGTH) while(*t!=0 && cnt< MAXPATHNAMELENGTH)
{t++;cnt++;} //crawl counter forward. {t++;cnt++;} //crawl counter forward.
} }
if(cnt<MAXPATHNAMELENGTH-13) if(cnt<MAXPATHNAMELENGTH-FILENAME_LENGTH)
file.getFilename(t); file.getFilename(t);
else else
t[0]=0; t[0]=0;
@ -305,7 +305,7 @@ void CardReader::openFile(char* name,bool read, bool replace_current/*=true*/)
//SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name)); //SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name));
if(dirname_end>0 && dirname_end>dirname_start) if(dirname_end>0 && dirname_end>dirname_start)
{ {
char subdirname[13]; char subdirname[FILENAME_LENGTH];
strncpy(subdirname, dirname_start, dirname_end-dirname_start); strncpy(subdirname, dirname_start, dirname_end-dirname_start);
subdirname[dirname_end-dirname_start]=0; subdirname[dirname_end-dirname_start]=0;
SERIAL_ECHOLN(subdirname); SERIAL_ECHOLN(subdirname);
@ -401,7 +401,7 @@ void CardReader::removeFile(char* name)
//SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name)); //SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name));
if(dirname_end>0 && dirname_end>dirname_start) if(dirname_end>0 && dirname_end>dirname_start)
{ {
char subdirname[13]; char subdirname[FILENAME_LENGTH];
strncpy(subdirname, dirname_start, dirname_end-dirname_start); strncpy(subdirname, dirname_start, dirname_end-dirname_start);
subdirname[dirname_end-dirname_start]=0; subdirname[dirname_end-dirname_start]=0;
SERIAL_ECHOLN(subdirname); SERIAL_ECHOLN(subdirname);

4
Marlin/cardreader.h

@ -52,7 +52,7 @@ public:
bool logging; bool logging;
bool sdprinting ; bool sdprinting ;
bool cardOK ; bool cardOK ;
char filename[13]; char filename[FILENAME_LENGTH];
char longFilename[LONG_FILENAME_LENGTH]; char longFilename[LONG_FILENAME_LENGTH];
bool filenameIsDir; bool filenameIsDir;
int lastnr; //last number of the autostart; int lastnr; //last number of the autostart;
@ -63,7 +63,7 @@ private:
SdVolume volume; SdVolume volume;
SdFile file; SdFile file;
#define SD_PROCEDURE_DEPTH 1 #define SD_PROCEDURE_DEPTH 1
#define MAXPATHNAMELENGTH (13*MAX_DIR_DEPTH+MAX_DIR_DEPTH+1) #define MAXPATHNAMELENGTH (FILENAME_LENGTH*MAX_DIR_DEPTH+MAX_DIR_DEPTH+1)
uint8_t file_subcall_ctr; uint8_t file_subcall_ctr;
uint32_t filespos[SD_PROCEDURE_DEPTH]; uint32_t filespos[SD_PROCEDURE_DEPTH];
char filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH]; char filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH];

Loading…
Cancel
Save