Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Revision:
116:8099b754fbb4
Parent:
114:554fa3a956b4
Child:
119:b3d7699d0eb0
--- a/SnEventFrame.cpp	Fri Dec 04 02:57:12 2015 +0000
+++ b/SnEventFrame.cpp	Tue May 03 02:01:35 2016 +0000
@@ -10,6 +10,10 @@
 const uint8_t     SnEventFrame::kIOVers = 2;   // MUST BE INCREASED if any member var changes (==> also if kNchans, etc. change!)
 #elif CHIPBOARD==SST4CH_1GHz
 const uint8_t     SnEventFrame::kIOVers = 3;   // MUST BE INCREASED if any member var changes (==> also if kNchans, etc. change!)
+#elif CHIPBOARD==SST4CH512
+const uint8_t     SnEventFrame::kIOVers = 4;   // MUST BE INCREASED if any member var changes (==> also if kNchans, etc. change!)
+#elif CHIPBOARD==SST4CH512_1GHz
+const uint8_t     SnEventFrame::kIOVers = 5;   // MUST BE INCREASED if any member var changes (==> also if kNchans, etc. change!)
 #else
 #error CHIPBOARD value not accounted for in event frame i/o version.
 #endif
@@ -46,7 +50,7 @@
         b.s       = SnBitUtils::ReadFrom(b.s, fCRC);
 
 #if CHIPBOARD!=ATWD4CH
-        const uint16_t nstopBytes = GetStopBytesForIOVers(Rv);
+        const uint16_t nstopBytes = GetStopBytesForIOVersBufferSafe(Rv);
         if (Rv>1) {
             b.s   = SnBitUtils::ReadFrom(b.s, fStop, nstopBytes);
         }
@@ -86,13 +90,21 @@
     b.s           = SnBitUtils::WriteTo(b.s, fCRC);
 
 #if CHIPBOARD!=ATWD4CH
-    const uint16_t nstopBytes = GetStopBytesForIOVers(kIOVers);
+    const uint16_t nstopBytes = GetStopBytesForIOVersBufferSafe(kIOVers);
     if (kIOVers>1) {
         // we test kIOVers rather than the CHIPBOARD #define in order
         // to ensure that the i/o version is the ONLY variable that determines
         // what the event looks like in a file or communication.
         // this is the only way to ensure readability going forward.
+#ifdef DEBUG
+        printf("kNstopBytes=%hu, nstopBytes=%hu, kIOVers=%hhu\r\n",
+            kNstopBytes, nstopBytes, kIOVers);
+        char* x = b.s;
+#endif
         b.s       = SnBitUtils::WriteTo(b.s, fStop, nstopBytes);
+#ifdef DEBUG
+        printf("wrote %d stop bytes\r\n", b.s - x);
+#endif
     }
 #endif