Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 2:8587554a1f52, committed 2015-07-11
- Comitter:
- jont
- Date:
- Sat Jul 11 17:32:02 2015 +0000
- Parent:
- 1:d22102484ea1
- Child:
- 3:ba7863bdf478
- Commit message:
- Added extra error count functions
Changed in this revision
--- a/ninelocks_logger_core/ninelocks_logger_core.cpp Fri Jul 10 21:00:42 2015 +0000
+++ b/ninelocks_logger_core/ninelocks_logger_core.cpp Sat Jul 11 17:32:02 2015 +0000
@@ -22,6 +22,8 @@
in
long seconds - a timestamp of some sort
char entryType an arbritry flag to label records with
+
+You implement version in your own class
*/
void NineLoggerCore::do_journal(long seconds, char entryType)
{
@@ -29,14 +31,13 @@
logrec.ad1 = 0;
logrec.ad2 = 0;
logrec.ad3 = 0;
- logrec.ad4 =0;
+ logrec.ad4 = 0;
logrec.ad5 = 0;
logrec.ad6 = 0;
logrec.count = 0;
logrec.count2 = 0;
- // logrec.count = counter_reed.read();
- // logrec.count2 = counter_reed2.read();
- // logrec.temperature = read_thermo();
+
+ logrec.temperature = 0;;
logrec.timestamp = seconds;
logrec.record_type = entryType;
log_buffer.RingWriteToBuffer(logrec);
@@ -45,8 +46,12 @@
/*=====================================================================================*/
// Write event to the logfile
/*=====================================================================================*/
+/*
+ in reality whats here is a reminder, you override this in your own class
+*/
bool NineLoggerCore::flush_buffered_journal_events()
{
+ /*
int remain = 0;
remain = log_buffer.ring_count();
if (remain <=0 ) {
@@ -81,6 +86,7 @@
}
// printf("Closing File...\n");
fclose(fp);
+ */
return true;
}
@@ -104,4 +110,20 @@
int NineLoggerCore::get_overrun_count(){
return overrun_count;
- }
\ No newline at end of file
+ }
+
+/*=====================================================================*/
+// see how many times we have had write erros
+/*=====================================================================*/
+int NineLoggerCore::get_write_error_count(){
+ return write_error_count;
+
+ }
+
+ /*=====================================================================*/
+// see how much buffer was used
+/*=====================================================================*/
+int NineLoggerCore::get_max_fill(){
+ return max_buffer_use;
+
+ }
\ No newline at end of file
--- a/ninelocks_logger_core/ninelocks_logger_core.h Fri Jul 10 21:00:42 2015 +0000
+++ b/ninelocks_logger_core/ninelocks_logger_core.h Sat Jul 11 17:32:02 2015 +0000
@@ -12,15 +12,23 @@
bool flush_buffered_journal_events();
void setfilename(char* filename);
int get_overrun_count();
+ int get_write_error_count();
+ int get_max_fill(); //see how much of ring buffer got used at worse
+ // virtual bool write_error_log() { return true; }
// void flash(int n);
- char journallog_filename[nl_name_length];
+
private:
- // DigitalOut _pin;
+
protected:
-Serial * _pc;
- JRecordRing log_buffer; //where the timed logs get sent to
- int overrun_count;
+ char journallog_filename[nl_name_length]; //name of log file
+ Serial * _pc; //if we pass in a serial port then we write out debug messages
+ // and if we dont, then guess what, we dont!
+ JRecordRing log_buffer; //where the timed samples get sent to a ring buffer of records
+ int overrun_count; //counts how many times we ran out of storage room
+ //which implies we dont have big enough buffer :-)
+ int write_error_count;
+ int max_buffer_use; //how much of buffer was used at worse.
};