My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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() { return sdpos>=filesize ;};
  25. inline int16_t get() { sdpos = file.curPosition();return (int16_t)file.read();};
  26. inline void setIndex(long index) {sdpos = index;file.seekSet(index);};
  27. inline uint8_t percentDone(){if(!sdprinting) return 0; if(filesize) return sdpos*100/filesize; else return 0;};
  28. public:
  29. bool saving;
  30. bool sdprinting ;
  31. bool cardOK ;
  32. char filename[11];
  33. private:
  34. SdFile root;
  35. Sd2Card card;
  36. SdVolume volume;
  37. SdFile file;
  38. uint32_t filesize;
  39. //int16_t n;
  40. unsigned long autostart_atmillis;
  41. uint32_t sdpos ;
  42. bool autostart_stilltocheck; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware.
  43. };
  44. #else
  45. class CardReader
  46. {
  47. public:
  48. inline CardReader(){};
  49. inline static void initsd(){};
  50. inline static void write_command(char *buf){};
  51. inline static void checkautostart(bool x) {};
  52. inline static void closefile() {};
  53. inline static void release(){};
  54. inline static void startFileprint(){};
  55. inline static void startFilewrite(char *name){};
  56. inline static void pauseSDPrint(){};
  57. inline static void getStatus(){};
  58. inline static void selectFile(char* name){};
  59. inline static void getfilename(const uint8_t nr){};
  60. inline static uint8_t getnrfilenames(){return 0;};
  61. inline static void ls() {};
  62. inline static bool eof() {return true;};
  63. inline static char get() {return 0;};
  64. inline static void setIndex(){};
  65. };
  66. #endif //SDSUPPORT
  67. #endif