My Marlin configs for Fabrikator Mini and CTC i3 Pro B
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

cardreader.h 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef __CARDREADERH
  2. #define __CARDREADERH
  3. #ifdef SDSUPPORT
  4. #include "SdFat.h"
  5. class CardReader
  6. {
  7. public:
  8. CardReader();
  9. void initsd();
  10. void write_command(char *buf);
  11. //files auto[0-9].g on the sd card are performed in a row
  12. //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
  13. void checkautostart(bool x);
  14. void closefile();
  15. void release();
  16. void startFileprint();
  17. void startFilewrite(char *name);
  18. void pauseSDPrint();
  19. void getStatus();
  20. void selectFile(char* name);
  21. void getfilename(const uint8_t nr);
  22. uint8_t getnrfilenames();
  23. inline void ls() {root.ls();};
  24. inline bool eof() { sdpos = file.curPosition();return sdpos>=filesize ;};
  25. inline char get() { int16_t n = file.read(); return (n==-1)?'\n':(char)n;};
  26. inline void setIndex(long index) {sdpos = index;file.seekSet(index);};
  27. public:
  28. bool saving;
  29. bool sdprinting ;
  30. bool cardOK ;
  31. char filename[11];
  32. private:
  33. SdFile root;
  34. Sd2Card card;
  35. SdVolume volume;
  36. SdFile file;
  37. uint32_t filesize;
  38. //int16_t n;
  39. unsigned long autostart_atmillis;
  40. uint32_t sdpos ;
  41. bool autostart_stilltocheck; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware.
  42. };
  43. #else
  44. class CardReader
  45. {
  46. public:
  47. inline CardReader(){};
  48. inline static void initsd(){};
  49. inline static void write_command(char *buf){};
  50. inline static void checkautostart(bool x) {};
  51. inline static void closefile() {};
  52. inline static void release(){};
  53. inline static void startFileprint(){};
  54. inline static void startFilewrite(char *name){};
  55. inline static void pauseSDPrint(){};
  56. inline static void getStatus(){};
  57. inline static void selectFile(char* name){};
  58. inline static void getfilename(const uint8_t nr){};
  59. inline static uint8_t getnrfilenames(){return 0;};
  60. inline static void ls() {};
  61. inline static bool eof() {return true;};
  62. inline static char get() {return 0;};
  63. inline static void setIndex(){};
  64. };
  65. #endif //SDSUPPORT
  66. #endif