Sfoglia il codice sorgente

A few constants where they belong

Scott Lahteine 10 anni fa
parent
commit
b726511a3b
4 ha cambiato i file con 12 aggiunte e 10 eliminazioni
  1. 2
    2
      Marlin/Marlin_main.cpp
  2. 3
    1
      Marlin/SdFatConfig.h
  3. 5
    5
      Marlin/cardreader.cpp
  4. 2
    2
      Marlin/cardreader.h

+ 2
- 2
Marlin/Marlin_main.cpp Vedi File

429
     //this is dangerous if a mixing of serial and this happens
429
     //this is dangerous if a mixing of serial and this happens
430
     strcpy(&(cmdbuffer[bufindw][0]),cmd);
430
     strcpy(&(cmdbuffer[bufindw][0]),cmd);
431
     SERIAL_ECHO_START;
431
     SERIAL_ECHO_START;
432
-    SERIAL_ECHOPGM("enqueing \"");
432
+    SERIAL_ECHOPGM(MSG_Enqueing);
433
     SERIAL_ECHO(cmdbuffer[bufindw]);
433
     SERIAL_ECHO(cmdbuffer[bufindw]);
434
     SERIAL_ECHOLNPGM("\"");
434
     SERIAL_ECHOLNPGM("\"");
435
     bufindw= (bufindw + 1)%BUFSIZE;
435
     bufindw= (bufindw + 1)%BUFSIZE;
444
     //this is dangerous if a mixing of serial and this happens
444
     //this is dangerous if a mixing of serial and this happens
445
     strcpy_P(&(cmdbuffer[bufindw][0]),cmd);
445
     strcpy_P(&(cmdbuffer[bufindw][0]),cmd);
446
     SERIAL_ECHO_START;
446
     SERIAL_ECHO_START;
447
-    SERIAL_ECHOPGM("enqueing \"");
447
+    SERIAL_ECHOPGM(MSG_Enqueing);
448
     SERIAL_ECHO(cmdbuffer[bufindw]);
448
     SERIAL_ECHO(cmdbuffer[bufindw]);
449
     SERIAL_ECHOLNPGM("\"");
449
     SERIAL_ECHOLNPGM("\"");
450
     bufindw= (bufindw + 1)%BUFSIZE;
450
     bufindw= (bufindw + 1)%BUFSIZE;

+ 3
- 1
Marlin/SdFatConfig.h Vedi File

113
  */
113
  */
114
 /** Number of VFAT entries used. Every entry has 13 UTF-16 characters */
114
 /** Number of VFAT entries used. Every entry has 13 UTF-16 characters */
115
 #define MAX_VFAT_ENTRIES (2)
115
 #define MAX_VFAT_ENTRIES (2)
116
+/** Number of UTF-16 characters per entry */
117
+#define FILENAME_LENGTH 13
116
 /** Total size of the buffer used to store the long filenames */
118
 /** Total size of the buffer used to store the long filenames */
117
-#define LONG_FILENAME_LENGTH (13*MAX_VFAT_ENTRIES+1)
119
+#define LONG_FILENAME_LENGTH (FILENAME_LENGTH*MAX_VFAT_ENTRIES+1)
118
 #endif  // SdFatConfig_h
120
 #endif  // SdFatConfig_h
119
 
121
 
120
 
122
 

+ 5
- 5
Marlin/cardreader.cpp Vedi File

60
     if( DIR_IS_SUBDIR(&p) && lsAction!=LS_Count && lsAction!=LS_GetFilename) // hence LS_SerialPrint
60
     if( DIR_IS_SUBDIR(&p) && lsAction!=LS_Count && lsAction!=LS_GetFilename) // hence LS_SerialPrint
61
     {
61
     {
62
 
62
 
63
-      char path[13*2];
64
-      char lfilename[13];
63
+      char path[FILENAME_LENGTH*2];
64
+      char lfilename[FILENAME_LENGTH];
65
       createFilename(lfilename,p);
65
       createFilename(lfilename,p);
66
       
66
       
67
       path[0]=0;
67
       path[0]=0;
235
     while(*t!=0 && cnt< MAXPATHNAMELENGTH) 
235
     while(*t!=0 && cnt< MAXPATHNAMELENGTH) 
236
     {t++;cnt++;}  //crawl counter forward.
236
     {t++;cnt++;}  //crawl counter forward.
237
   }
237
   }
238
-  if(cnt<MAXPATHNAMELENGTH-13)
238
+  if(cnt<MAXPATHNAMELENGTH-FILENAME_LENGTH)
239
     file.getFilename(t);
239
     file.getFilename(t);
240
   else
240
   else
241
     t[0]=0;
241
     t[0]=0;
305
       //SERIAL_ECHO("end  :");SERIAL_ECHOLN((int)(dirname_end-name));
305
       //SERIAL_ECHO("end  :");SERIAL_ECHOLN((int)(dirname_end-name));
306
       if(dirname_end>0 && dirname_end>dirname_start)
306
       if(dirname_end>0 && dirname_end>dirname_start)
307
       {
307
       {
308
-        char subdirname[13];
308
+        char subdirname[FILENAME_LENGTH];
309
         strncpy(subdirname, dirname_start, dirname_end-dirname_start);
309
         strncpy(subdirname, dirname_start, dirname_end-dirname_start);
310
         subdirname[dirname_end-dirname_start]=0;
310
         subdirname[dirname_end-dirname_start]=0;
311
         SERIAL_ECHOLN(subdirname);
311
         SERIAL_ECHOLN(subdirname);
401
       //SERIAL_ECHO("end  :");SERIAL_ECHOLN((int)(dirname_end-name));
401
       //SERIAL_ECHO("end  :");SERIAL_ECHOLN((int)(dirname_end-name));
402
       if(dirname_end>0 && dirname_end>dirname_start)
402
       if(dirname_end>0 && dirname_end>dirname_start)
403
       {
403
       {
404
-        char subdirname[13];
404
+        char subdirname[FILENAME_LENGTH];
405
         strncpy(subdirname, dirname_start, dirname_end-dirname_start);
405
         strncpy(subdirname, dirname_start, dirname_end-dirname_start);
406
         subdirname[dirname_end-dirname_start]=0;
406
         subdirname[dirname_end-dirname_start]=0;
407
         SERIAL_ECHOLN(subdirname);
407
         SERIAL_ECHOLN(subdirname);

+ 2
- 2
Marlin/cardreader.h Vedi File

52
   bool logging;
52
   bool logging;
53
   bool sdprinting ;  
53
   bool sdprinting ;  
54
   bool cardOK ;
54
   bool cardOK ;
55
-  char filename[13];
55
+  char filename[FILENAME_LENGTH];
56
   char longFilename[LONG_FILENAME_LENGTH];
56
   char longFilename[LONG_FILENAME_LENGTH];
57
   bool filenameIsDir;
57
   bool filenameIsDir;
58
   int lastnr; //last number of the autostart;
58
   int lastnr; //last number of the autostart;
63
   SdVolume volume;
63
   SdVolume volume;
64
   SdFile file;
64
   SdFile file;
65
   #define SD_PROCEDURE_DEPTH 1
65
   #define SD_PROCEDURE_DEPTH 1
66
-  #define MAXPATHNAMELENGTH (13*MAX_DIR_DEPTH+MAX_DIR_DEPTH+1)
66
+  #define MAXPATHNAMELENGTH (FILENAME_LENGTH*MAX_DIR_DEPTH+MAX_DIR_DEPTH+1)
67
   uint8_t file_subcall_ctr;
67
   uint8_t file_subcall_ctr;
68
   uint32_t filespos[SD_PROCEDURE_DEPTH];
68
   uint32_t filespos[SD_PROCEDURE_DEPTH];
69
   char filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH];
69
   char filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH];

Loading…
Annulla
Salva