aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Delmar Davis <don@suspectdevices.com>2012-08-17 12:47:12 -0700
committerDonald Delmar Davis <don@suspectdevices.com>2012-08-17 12:47:12 -0700
commit16e2e53c56ae4a41f54284feea2f1d747c8bbd9f (patch)
treeff427c04a79880f2a841177e9b58fb3de002dc4b
parent47a9b3983c862da951f6c3787d925a15a4b40881 (diff)
Getting there, adding file and date stuff next.
-rw-r--r--dumblogger/Utilities.cpp16
-rw-r--r--dumblogger/Utilities.h7
2 files changed, 19 insertions, 4 deletions
diff --git a/dumblogger/Utilities.cpp b/dumblogger/Utilities.cpp
index a67f461..dc16ca5 100644
--- a/dumblogger/Utilities.cpp
+++ b/dumblogger/Utilities.cpp
@@ -25,7 +25,16 @@
*-----------------------------------------------------------------------------*/
#include "Utilities.h"
-//find next unopened file.
+
+/*-----------------------------------------------------------------------------
+ * file handling
+ *----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------openNextFile()
+ * find next unopened file number.
+ *----------------------------------------------------------------------------*/
+
int openNextFile() {
dir_t p;//=&root;
int current;
@@ -51,7 +60,7 @@ int openNextFile() {
if (p.fileSize==0) {
p.name[0] = DIR_NAME_DELETED;
continue;
- //SdVolume::CacheFlush();
+
}
#endif
if (!strncmp("LOG", p.name, 3) && !strncmp("TXT", p.name+8, 3)) {
@@ -62,12 +71,13 @@ int openNextFile() {
current=atoi(numpart);
if ( current > max ) max=current;
}
- /*console.printf("DBG: %c%c%c%c%c%c%c%c.%c%c%c (%d)\r\n",
+ /*toConsole("DBG: %c%c%c%c%c%c%c%c.%c%c%c (%d)\r\n",
p.name[0],p.name[1],p.name[2],p.name[3],
p.name[4],p.name[5],p.name[6],p.name[7],
p.name[8],p.name[9],p.name[10],max);
*/
}
+ //SdVolume::CacheFlush(); to finish deleting files.
return max;
}
diff --git a/dumblogger/Utilities.h b/dumblogger/Utilities.h
index 219d26b..81f30e1 100644
--- a/dumblogger/Utilities.h
+++ b/dumblogger/Utilities.h
@@ -34,6 +34,7 @@
#include <SdFat.h>
#include <HardwareSPI.h>
#include <string.h>
+// move this to a project settings file.
#define BLU_LED 19
#define YEL_LED 18
@@ -41,10 +42,14 @@
#define LED_ON LOW
#define LED_OFF HIGH
+/*-----------------------------------------------------------------------------
+ * file handling
+ *----------------------------------------------------------------------------*/
+
extern Sd2Card card;
extern SdVolume volume;
extern SdFile root;
extern SdFile file;
-int openNextFile(void); \ No newline at end of file
+int openNextFile(void);