From 2834739ac308c79a5ddb0746bdfacbad950c6f45 Mon Sep 17 00:00:00 2001 From: Davis Devasia Date: Sat, 24 Dec 2016 12:58:17 +0530 Subject: [PATCH] Avoid the folder, if creating db fails (Silently!) Creating the database inside the /db/ folder fails silently and returns -1 as reading for every entry. Create the database in the root folder and it works perfect. --- examples/EDB_SDCARD/EDB_SDCARD.ino | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/examples/EDB_SDCARD/EDB_SDCARD.ino b/examples/EDB_SDCARD/EDB_SDCARD.ino index f3bb525..311fa76 100644 --- a/examples/EDB_SDCARD/EDB_SDCARD.ino +++ b/examples/EDB_SDCARD/EDB_SDCARD.ino @@ -24,7 +24,7 @@ // operations will return EDB_OUT_OF_RANGE for all records outside the usable range. #define RECORDS_TO_CREATE 10 -char* db_name = "/db/edb_test.db"; +char* db_name = "edb_test.db"; File dbFile; // Arbitrary record definition for this table. @@ -73,12 +73,6 @@ void setup() return; } - // Check dir for db files - if (!SD.exists("/db")) { - Serial.println("Dir for Db files does not exist, creating..."); - SD.mkdir("/db"); - } - if (SD.exists(db_name)) { dbFile = SD.open(db_name, FILE_WRITE);