Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Revision:
122:c1b5023eac69
Parent:
119:b3d7699d0eb0
--- a/SnConfigFrame.h	Thu Nov 30 06:26:18 2017 +0000
+++ b/SnConfigFrame.h	Fri Dec 01 16:29:10 2017 +0000
@@ -19,7 +19,7 @@
     static const uint8_t     kConfLblLen=kConfLblLenNoStrTerm+1; // length of configuration label char array (63+'\0') (must not change!! used in i/o sizes)
     static const uint8_t     kIPLen=16;            // length of IP string (includes \0). matches MBED's Socket class (so no ipv6) (must not change!! used in i/o sizes)
     
-#ifdef USE_INTERFACE_CHIP
+#if defined(USE_INTERFACE_CHIP) || defined(LOAD_DEFAULT_CONFIG_FROM_SD)
     static const char* const kDefConfFile;  // default configuration file
     static const char* const kDefRemIpFilen;
     static const char* const kDefRemPortFilen;
@@ -989,17 +989,23 @@
     bool ReadFromFile(const char* cfile);
     bool WriteToFile(const char* cfile) const;
     
-    void Reset() {
-        memset(fLabel, 0, sizeof(char)*kConfLblLen);
-        SetHardDefaults();
-#ifdef USE_INTERFACE_CHIP
+#if defined(USE_INTERFACE_CHIP) || defined(LOAD_DEFAULT_CONFIG_FROM_SD)
+    void SetFromDefaultConfFile() {
         if (ReadFromFile(kDefConfFile)==false) {
             // couldn't get setharddefaults. use hardcoded version.
             // (reset in case a few parameters from the file
             // got assigned)
             SetHardDefaults();
         }
+    }
 #endif
+    
+    void Reset() {
+        memset(fLabel, 0, sizeof(char)*kConfLblLen);
+        SetHardDefaults();
+#ifdef LOAD_DEFAULT_CONFIG_IMMEDIATELY
+        SetFromDefaultConfFile();
+#endif        
 #ifdef DEBUG
         printf("config reset to %s\r\n",fLabel);
 #endif