Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Revision:
76:f8383f0292c2
Parent:
65:2cb3e99ce466
Child:
84:80b15993944e
--- a/SnCommWin.cpp	Tue Feb 10 23:31:10 2015 +0000
+++ b/SnCommWin.cpp	Sun Feb 22 20:42:44 2015 +0000
@@ -291,7 +291,7 @@
 #ifdef DEBUG
         printf("clear run seq list requested\r\n");
 #endif
-        SnSDUtils::ClearRunSeqList();
+        SnSDUtils::ClearRunSeqList(curConf.IsSendingFilesRunSeqList());
     } else if ( hndshk==SnHeaderFrame::kHnShOkReqRnCode ) {
 #ifdef DEBUG
         printf("run %u requested\r\n",hndlen);
@@ -515,22 +515,24 @@
                 printf("fopen: %s\r\n",fnb);
 #endif
                 lf  = fopen(fnb,"rb");
-                fseek(lf, 0, SEEK_END);
-                int32_t fend = ftell(lf);
-                fseek(lf, 0, SEEK_SET);
-                char c;
-                for (int32_t i=0; i<fend; ++i) {
-                    
-                    Watchdog::kick(); // don't reset
-                    
-                    SnBitUtils::ReadFrom(lf, c);
-                    if (feof(lf)==0 && ferror(lf)==0) {
-                        crc = SnCRCUtils::update_crc32_xfer(crc, c);
-                    } else {
-                        break;
+                if (lf!=0) {
+                    fseek(lf, 0, SEEK_END);
+                    int32_t fend = ftell(lf);
+                    fseek(lf, 0, SEEK_SET);
+                    char c;
+                    for (int32_t i=0; i<fend; ++i) {
+                        
+                        Watchdog::kick(); // don't reset
+                        
+                        SnBitUtils::ReadFrom(lf, c);
+                        if (feof(lf)==0 && ferror(lf)==0) {
+                            crc = SnCRCUtils::update_crc32_xfer(crc, c);
+                        } else {
+                            break;
+                        }
                     }
+                    fclose(lf);
                 }
-                fclose(lf);
 #ifdef DEBUG
                 printf("closed file. crc = %u\r\n", crc);
 #endif