aboutsummaryrefslogtreecommitdiff
path: root/datalog.h
diff options
context:
space:
mode:
Diffstat (limited to 'datalog.h')
-rw-r--r--datalog.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/datalog.h b/datalog.h
index 96a3dfd..8f7bd81 100644
--- a/datalog.h
+++ b/datalog.h
@@ -68,4 +68,26 @@ public:
Serial.println("# flushed");
}
}
+
+ bool serialCommand(const String &tag, const String &command) {
+ if (command == "log") {
+ Serial.print(tag);Serial.println(" begin");
+
+ uint8_t buffer[1024];
+ logfile.flush();
+ int remaining = logfile.position();
+ logfile.seek(0);
+ while (remaining > 0) {
+ int bytesRead = logfile.read(buffer, 1024);
+ Serial.write(buffer, bytesRead);
+ remaining -= bytesRead;
+ }
+
+ Serial.print(tag);Serial.println(" end");
+
+ return true;
+ }
+
+ return false;
+ }
};