My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

cardreader.h 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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)?(char)n:'\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. #endif //SDSUPPORT
  44. #endif