Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Revision:
122:c1b5023eac69
Parent:
119:b3d7699d0eb0
Child:
123:6267de54c8ba
--- a/main.cpp	Thu Nov 30 06:26:18 2017 +0000
+++ b/main.cpp	Fri Dec 01 16:29:10 2017 +0000
@@ -216,8 +216,7 @@
 bool                      SaveEvent(const int32_t etms);
 void                      WaitTrigAndSendClock();
 void                      SetConfigAndMakeOutputFile();
-SnCommWin::ECommWinResult OpenCommWin(const bool forceReconfig=false,
-                                      const bool isStartupWin=false);
+SnCommWin::ECommWinResult OpenCommWin(const bool isStartupWin=false);
 void                      MakeOutputFile(const bool stopRunning=false);
 bool                      IsPowerAllowedFor(const bool isCommWin,
                                             const uint8_t devicesInUse,
@@ -1050,8 +1049,15 @@
     printf("Free memory = %d\r\n", FreeMem());
 #endif
     led2 = led1 = 0; // back to "normal" for comm win
-    OpenCommWin(true, true); // alwasy configure, even if no new config
-    
+    SnCommWin::ECommWinResult firstRes = OpenCommWin(true); // is the startup config
+
+#if defined(USE_INTERFACE_CHIP) || defined(LOAD_DEFAULT_CONFIG_FROM_SD)
+    if (firstRes<=SnCommWin::kAllFails) {
+        // initial communication failed -- try to load default config from file
+        gConf.SetFromDefaultConfFile();
+    }
+#endif 
+   
     // get ready to trigger
     PIN_spi.format( 16, 1 ); // change to data readout format
     PIN_spi.frequency( 10000000 );  // Max is 12.5 MHz
@@ -2339,8 +2345,7 @@
 }
 
 
-SnCommWin::ECommWinResult OpenCommWin(const bool forceReconfig,
-                                      const bool isStartupWin) {
+SnCommWin::ECommWinResult OpenCommWin(const bool isStartupWin) {
     // loop through each comm mode:
     //  a) try to connect
     //  b) if connected, listen for config