From 30ce8eb1b4d8f57811b8202b93aa41883fe9a282 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Sun, 14 Jun 2015 17:38:46 +0200 Subject: [PATCH] SD card: remove the demonstration code. We're about to do some real stuff ... --- mendel.c | 45 --------------------------------------------- pff_conf.h | 2 +- 2 files changed, 1 insertion(+), 46 deletions(-) diff --git a/mendel.c b/mendel.c index 759cf73..23cbf76 100644 --- a/mendel.c +++ b/mendel.c @@ -265,51 +265,6 @@ int main (void) #endif init(); - #ifdef SD - // This demonstrates SD card reading. It simply lists the top level - // directory over and over again. This demo will go away as soon as we - // have the G-code implementations to do something useful in place. - #include "delay.h" - - while (1) { - FATFS sdfile; - FRESULT res; - - if ((res = pf_mount(&sdfile)) == FR_OK) - serial_writestr_P(PSTR("SD card mounted successfully.\n")); - else { - serial_writestr_P(PSTR("Mounting SD card failed :-/\n")); - delay_ms(10); - if (res == FR_NOT_READY) - serial_writestr_P(PSTR("No medium or hardware error.\n")); - else if (res == FR_DISK_ERR) - serial_writestr_P(PSTR("Error while reading.\n")); - else if (res == FR_NO_FILESYSTEM) - serial_writestr_P(PSTR("No valid FAT partition.\n")); - } - - // Inspired by http://elm-chan.org/fsw/ff/pf/readdir.html. - FILINFO fno; - DIR dir; - char* path ="/"; - - res = pf_opendir(&dir, path); - if (res == FR_OK) { - for (;;) { - res = pf_readdir(&dir, &fno); - if (res != FR_OK || fno.fname[0] == 0) - break; - serial_writestr((uint8_t *)path); - serial_writestr((uint8_t *)fno.fname); - serial_writechar('\n'); - delay_ms(2); // Time for sending the characters. - } - } - delay_ms(5000); - } - - #endif - // main loop for (;;) { diff --git a/pff_conf.h b/pff_conf.h index 59ec26b..dd4d1f2 100644 --- a/pff_conf.h +++ b/pff_conf.h @@ -11,7 +11,7 @@ /---------------------------------------------------------------------------*/ #define _USE_READ 1 /* Enable pf_read() function */ -#define _USE_DIR 1 /* Enable pf_opendir() and pf_readdir() function */ +#define _USE_DIR 0 /* Enable pf_opendir() and pf_readdir() function */ #define _USE_LSEEK 0 /* Enable pf_lseek() function */ #define _USE_WRITE 0 /* Enable pf_write() function */