Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Revision:
15:f2569d8e4176
Parent:
13:7a1fb885a8e4
Child:
16:744ce85aede2
--- a/SnCommWin.cpp	Tue Aug 21 02:19:35 2012 +0000
+++ b/SnCommWin.cpp	Fri Aug 31 02:09:09 2012 +0000
@@ -27,32 +27,39 @@
     printf("SnCommWin::SendData\r\n");
 #endif
     ECommWinResult res = kUndefFail;
-    if (conf.IsSendingAllFiles()) {
+    if ( (GetCommType() != SnConfigFrame::kIrid) ||
+         (conf.IsForcingSBDdata()) ) {
+         // only send large amounts if we're not communicating by Iridum,
+         // or if we are being forced to send the data over SBD
+        if (conf.IsSendingAllFiles()) {
 #ifdef DEBUG
-        printf("sending all files\r\n");
+            printf("sending all files\r\n");
 #endif
-        res = SnSDUtils::SendAllFiles(this, timeout, 
-                                      genBuf, bsize, conf, evt, pow,
-                                      handshakeTimeout);
-    } else {
-        if (conf.GetCommSendData()==0) {
+            res = SnSDUtils::SendAllFiles(this, timeout, 
+                                          genBuf, bsize, conf, evt, pow,
+                                          handshakeTimeout);
+        } else {
+            if (conf.GetCommSendData()==0) {
 #ifdef DEBUG
-            printf("no data to send\r\n");
+                printf("no data to send\r\n");
 #endif
-            res = kOkNoMsg;
-        } else {
-            const uint32_t nev = (conf.GetCommSendData()>0) ?
-                                  conf.GetCommSendData() // send N events
-                                  : 0u; // send all events in last file
+                res = kOkNoMsg;
+            } else {
+                const uint32_t nev = (conf.GetCommSendData()>0) ?
+                                      conf.GetCommSendData() // send N events
+                                      : 0u; // send all events in last file
 #ifdef DEBUG
-            printf("calling SendData. f=%x, nev=%u\r\n",SnSDUtils::GetCurFile(), nev);
+                printf("calling SendData. f=%x, nev=%u\r\n",SnSDUtils::GetCurFile(), nev);
 #endif
-            res = SendData(SnSDUtils::GetCurFile(), SnSDUtils::GetCurFileName(),
-                           conf, evt, pow, genBuf, bsize, nev, timeout, handshakeTimeout);
+                res = SendData(SnSDUtils::GetCurFile(), SnSDUtils::GetCurFileName(),
+                               conf, evt, pow, genBuf, bsize, nev, timeout, handshakeTimeout);
 #ifdef DEBUG
-            printf("after send data cur file, res=%d\r\n",(int)res);
+                printf("after send data cur file, res=%d\r\n",(int)res);
 #endif
+            }
         }
+    } else {
+        return kOkNoMsg;
     }
     return res;
 }
@@ -217,7 +224,7 @@
     int mlen = SendAll(genBuf, msiz, timeout_clock);
 #ifdef DEBUG
     printf("status frame:\r\n");
-    for (uint32_t i=0; i<msize; i++) {
+    for (uint32_t i=0; i<msiz; i++) {
         printf("%02X ",genBuf[i]);
     }
     printf("\r\n");