My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #ifndef __CARDREADERH
  2. #define __CARDREADERH
  3. #ifdef SDSUPPORT
  4. #include "SdFile.h"
  5. enum LsAction {LS_SerialPrint,LS_Count,LS_GetFilename};
  6. class CardReader
  7. {
  8. public:
  9. CardReader();
  10. void initsd();
  11. void write_command(char *buf);
  12. //files auto[0-9].g on the sd card are performed in a row
  13. //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
  14. void checkautostart(bool x);
  15. void openFile(char* name,bool read);
  16. void closefile();
  17. void release();
  18. void startFileprint();
  19. void pauseSDPrint();
  20. void getStatus();
  21. void printingHasFinished();
  22. void getfilename(const uint8_t nr);
  23. uint16_t getnrfilenames();
  24. void ls();
  25. void chdir(const char * relpath);
  26. void updir();
  27. FORCE_INLINE bool eof() { return sdpos>=filesize ;};
  28. FORCE_INLINE int16_t get() { sdpos = file.curPosition();return (int16_t)file.read();};
  29. FORCE_INLINE void setIndex(long index) {sdpos = index;file.seekSet(index);};
  30. FORCE_INLINE uint8_t percentDone(){if(!sdprinting) return 0; if(filesize) return sdpos*100/filesize; else return 0;};
  31. FORCE_INLINE char* getWorkDirName(){workDir.getFilename(filename);return filename;};
  32. public:
  33. bool saving;
  34. bool sdprinting ;
  35. bool cardOK ;
  36. char filename[11];
  37. bool filenameIsDir;
  38. int lastnr; //last number of the autostart;
  39. private:
  40. SdFile root,*curDir,workDir,workDirParent,workDirParentParent;
  41. Sd2Card card;
  42. SdVolume volume;
  43. SdFile file;
  44. uint32_t filesize;
  45. //int16_t n;
  46. unsigned long autostart_atmillis;
  47. uint32_t sdpos ;
  48. bool autostart_stilltocheck; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware.
  49. LsAction lsAction; //stored for recursion.
  50. int16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory.
  51. char* diveDirName;
  52. void lsDive(const char *prepend,SdFile parent);
  53. };
  54. #else
  55. #define dir_t bool
  56. class CardReader
  57. {
  58. public:
  59. FORCE_INLINE CardReader(){};
  60. FORCE_INLINE static void initsd(){};
  61. FORCE_INLINE static void write_command(char *buf){};
  62. FORCE_INLINE static void checkautostart(bool x) {};
  63. FORCE_INLINE static void openFile(char* name,bool read){};
  64. FORCE_INLINE static void closefile() {};
  65. FORCE_INLINE static void release(){};
  66. FORCE_INLINE static void startFileprint(){};
  67. FORCE_INLINE static void startFilewrite(char *name){};
  68. FORCE_INLINE static void pauseSDPrint(){};
  69. FORCE_INLINE static void getStatus(){};
  70. FORCE_INLINE static void selectFile(char* name){};
  71. FORCE_INLINE static void getfilename(const uint8_t nr){};
  72. FORCE_INLINE static uint8_t getnrfilenames(){return 0;};
  73. FORCE_INLINE static void ls() {};
  74. FORCE_INLINE static bool eof() {return true;};
  75. FORCE_INLINE static char get() {return 0;};
  76. FORCE_INLINE static void setIndex(){};
  77. FORCE_INLINE uint8_t percentDone(){return 0;};
  78. };
  79. #endif //SDSUPPORT
  80. #endif