{"action":"created","issue":{"url":"https://api.github.com/repos/Traumflug/Teacup_Firmware/issues/104","labels_url":"https://api.github.com/repos/Traumflug/Teacup_Firmware/issues/104/labels{/name}","comments_url":"https://api.github.com/repos/Traumflug/Teacup_Firmware/issues/104/comments","events_url":"https://api.github.com/repos/Traumflug/Teacup_Firmware/issues/104/events","html_url":"https://github.com/Traumflug/Teacup_Firmware/issues/104","id":47893637,"number":104,"title":"Implement SD card handling","user":{"login":"Traumflug","id":318581,"avatar_url":"https://avatars.githubusercontent.com/u/318581?v=3","gravatar_id":"","url":"https://api.github.com/users/Traumflug","html_url":"https://github.com/Traumflug","followers_url":"https://api.github.com/users/Traumflug/followers","following_url":"https://api.github.com/users/Traumflug/following{/other_user}","gists_url":"https://api.github.com/users/Traumflug/gists{/gist_id}","starred_url":"https://api.github.com/users/Traumflug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Traumflug/subscriptions","organizations_url":"https://api.github.com/users/Traumflug/orgs","repos_url":"https://api.github.com/users/Traumflug/repos","events_url":"https://api.github.com/users/Traumflug/events{/privacy}","received_events_url":"https://api.github.com/users/Traumflug/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":53,"created_at":"2014-11-05T21:59:15Z","updated_at":"2015-07-08T21:42:12Z","closed_at":null,"body":"If you pull regularly, you might have noticed a new sdcard2 branch. This is for implementing handling an SD card. I reviewed and wrote the code carefully, but I have no such hardware, so I rely on your testing.\r\n\r\nOther than the 3.5 years old(!) sdcard branch it uses not FatFs, but Petit FatFs. This didn't exist back in 2011 and is a slimmed down version of FatFs. Slimmed down, like it can't handle file metadata and can handle one file at a time only, which is entirely sufficient for our needs.\r\n\r\nCurrent status is, [M21 - M25](http://reprap.org/wiki/G-code#M20:_List_SD_card) implemented, so you should be able to open an existing file and print from it. To enable this stuff, define something like this in your config.h:\r\n\r\n    #define SD_CARD_SELECT_PIN    DIO15\r\n    #define SD_CARD_DETECT_PIN    DIO16\r\n\r\nThe latter only if you actually have a SD card detect pin. Pin names have to match your actual hardware, of course.\r\n\r\nThe only supported filesystem is currently FAT16. Expanding to also FAT12 and FAT32 shouldn't be difficult, there are flags in pff_conf.h. Implementing file writing will be a bit more difficult, but I guess I'll do that as soon as reading is known to work.\r\n\r\nThe nice thing is, all this stuff currently chimes in at only 3156 bytes, so Teacup still easily fits into ATmega 328's. Not defining a select pin entirely removes all the SD card support, not a single extra byte if you don't need such stuff."},"comment":{"url":"https://api.github.com/repos/Traumflug/Teacup_Firmware/issues/comments/119739823","html_url":"https://github.com/Traumflug/Teacup_Firmware/issues/104#issuecomment-119739823","issue_url":"https://api.github.com/repos/Traumflug/Teacup_Firmware/issues/104","id":119739823,"user":{"login":"phord","id":123908,"avatar_url":"https://avatars.githubusercontent.com/u/123908?v=3","gravatar_id":"","url":"https://api.github.com/users/phord","html_url":"https://github.com/phord","followers_url":"https://api.github.com/users/phord/followers","following_url":"https://api.github.com/users/phord/following{/other_user}","gists_url":"https://api.github.com/users/phord/gists{/gist_id}","starred_url":"https://api.github.com/users/phord/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phord/subscriptions","organizations_url":"https://api.github.com/users/phord/orgs","repos_url":"https://api.github.com/users/phord/repos","events_url":"https://api.github.com/users/phord/events{/privacy}","received_events_url":"https://api.github.com/users/phord/received_events","type":"User","site_admin":false},"created_at":"2015-07-08T21:42:12Z","updated_at":"2015-07-08T21:42:12Z","body":"I quite forgot I did this.  :-)   I was in China adjusting to jet lag at the time.  I will go revisit this and see if I can make it more palatable."}}