Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Revision:
12:d472f9811262
Parent:
8:95a325df1f6b
Child:
13:7a1fb885a8e4
--- a/SnConfigFrame.h	Mon Aug 13 20:44:06 2012 +0000
+++ b/SnConfigFrame.h	Sat Aug 18 05:00:32 2012 +0000
@@ -39,7 +39,7 @@
         kAllFiles =  BIT(1), // if bit=0 => send most recent file
         kTimeout  =  BIT(2), // if bit=0 => ignore timeout
         kDelete   =  BIT(3), // if bit=0 => do not delete sent files
-        kUseBits  = -BIT(10) // useful to initialize fCommSendData as a bit word
+        kUseBits  = -BIT(15) // useful to initialize fCommSendData as a bit word
     };
     
     enum EPowerModeBit {
@@ -234,103 +234,181 @@
         
         uint8_t Rv=0;
         b               = SnBitUtils::ReadFrom(b, Rv); // i/o version
+#ifdef DEBUG
         printf("Rv=%hhu\r\n",Rv);
+#endif
         if (Rv>0) {
             uint32_t llen=kConfLblLen;
             b           = SnBitUtils::ReadFrom(b, llen);
+#ifdef DEBUG
             printf("llen=%u\r\n",llen);
+#endif
             b           = SnBitUtils::ReadFrom(b, fLabel, llen);
+#ifdef DEBUG
             printf("lbl=%s\r\n",fLabel);
+#endif
             b           = SnBitUtils::ReadFrom(b, fConfTime);
+#ifdef DEBUG
             printf("ct=%u\r\n",fConfTime);
+#endif
             b           = SnBitUtils::ReadFrom(b, fRun);
+#ifdef DEBUG
             printf("run=%u\r\n",fRun);
+#endif
             b           = SnBitUtils::ReadFrom(b, fFirstEvt);
+#ifdef DEBUG
             printf("fe=%u\r\n",fFirstEvt);
+#endif
             if (Rv>1) {
                 b       = SnBitUtils::ReadFrom(b, fEvtsPerSeq);
+#ifdef DEBUG
                 printf("eps=%u\r\n",fEvtsPerSeq);
+#endif
                 b       = SnBitUtils::ReadFrom(b, fRunMode);
+#ifdef DEBUG
                 printf("rm=%hhu\r\n",fRunMode);
+#endif
             }
             b           = SnBitUtils::ReadFrom(b, fStreamHiLoPlas);
+#ifdef DEBUG
             printf("shilo=%d\r\n",(int)fStreamHiLoPlas);
+#endif
             b           = SnBitUtils::ReadFrom(b, fWvLoseLSB);
+#ifdef DEBUG
             printf("lsb=%hhu\r\n",fWvLoseLSB);
+#endif
             b           = SnBitUtils::ReadFrom(b, fWvLoseMSB);
+#ifdef DEBUG
             printf("msb=%hhu\r\n",fWvLoseMSB);
+#endif
             b           = SnBitUtils::ReadFrom(b, fWvBaseline);
+#ifdef DEBUG
             printf("bl=%hu\r\n",fWvBaseline);
+#endif
             b           = SnBitUtils::ReadFrom(b, fDatPackType);
+#ifdef DEBUG
             printf("dp=%hhu\r\n",fDatPackType);
+#endif
             uint16_t* dc = &(fDAC[0][0]);
             for (uint16_t i=0; i<kTotDacs; i++, dc++) {
                 b       = SnBitUtils::ReadFrom(b, *dc);
+#ifdef DEBUG
                 printf("dac[%hu]=%hu\r\n",i,*dc);
+#endif
             }
             b           = SnBitUtils::ReadFrom(b, fNumPlas);
+#ifdef DEBUG
             printf("npla=%hhu\r\n",fNumPlas);
+#endif
             uint16_t* pl = &(fPLA[0]);
             for (uint8_t j=0; j<fNumPlas; j++, pl++) {
                 b       = SnBitUtils::ReadFrom(b, *pl);
+#ifdef DEBUG
                 printf("pla[%hhu]=%hu\r\n",j,*pl);
+#endif
             }
             b           = SnBitUtils::ReadFrom(b, fNumCardsMajLog);
+#ifdef DEBUG
             printf("mj=%hhu\r\n",fNumCardsMajLog);
+#endif
             b           = SnBitUtils::ReadFrom(b, fEnableThermTrig);
+#ifdef DEBUG
             printf("thm=%d\r\n",(int)fEnableThermTrig);
+#endif
             b           = SnBitUtils::ReadFrom(b, fForceTrigPeriod);
+#ifdef DEBUG
             printf("force=%hu\r\n",fForceTrigPeriod);
+#endif
             b           = SnBitUtils::ReadFrom(b, fHeartBeatPeriod);
+#ifdef DEBUG
             printf("heart=%hu\r\n",fHeartBeatPeriod);
+#endif
             b           = SnBitUtils::ReadFrom(b, fAmpsOn);
+#ifdef DEBUG
             printf("amps=%hhu\r\n",fAmpsOn);
+#endif
             b           = SnBitUtils::ReadFrom(b, fEvtThrtlPeriodMs);
+#ifdef DEBUG
             printf("throt=%hu\r\n",fEvtThrtlPeriodMs);
+#endif
             b           = SnBitUtils::ReadFrom(b, fPowerMode);
+#ifdef DEBUG
             printf("pow=%hhu\r\n",fPowerMode);
+#endif
             b           = SnBitUtils::ReadFrom(b, fBatVoltLowPwr);
+#ifdef DEBUG
             printf("batlow=%hd\r\n",fBatVoltLowPwr);
+#endif
             if (Rv>2) {
                 b       = SnBitUtils::ReadFrom(b, fVoltCheckPeriod);
+#ifdef DEBUG
                 printf("vltchk=%hu\r\n",fVoltCheckPeriod);
+#endif
             }
             b           = SnBitUtils::ReadFrom(b, fCommWinPeriod);
+#ifdef DEBUG
             printf("cmper=%u\r\n",fCommWinPeriod);
+#endif
             b           = SnBitUtils::ReadFrom(b, fCommWinDuration);
+#ifdef DEBUG
             printf("cmdur=%u\r\n",fCommWinDuration);
+#endif
             b           = SnBitUtils::ReadFrom(b, fCommSendData);
+#ifdef DEBUG
             printf("send=%d\r\n",fCommSendData);
+#endif
             b           = SnBitUtils::ReadFrom(b, fCommWinPrdLowPwr);
+#ifdef DEBUG
             printf("cmperlp=%u\r\n",fCommWinPrdLowPwr);
+#endif
             b           = SnBitUtils::ReadFrom(b, fCommWinDurLowPwr);
+#ifdef DEBUG
             printf("cmdurlp=%u\r\n",fCommWinDurLowPwr);
+#endif
             if (Rv>2) {
                 b       = SnBitUtils::ReadFrom(b, fRemoteServer, kIPLen);
+#ifdef DEBUG
                 printf("rserv=%s\r\n",fRemoteServer);
+#endif
                 b       = SnBitUtils::ReadFrom(b, fRemotePort);
+#ifdef DEBUG
                 printf("rport=%hu\r\n",fRemotePort);
+#endif
                 b       = SnBitUtils::ReadFrom(b, fMbedIP, kIPLen);
+#ifdef DEBUG
                 printf("mbedip=%s\r\n",fMbedIP);
+#endif
                 b       = SnBitUtils::ReadFrom(b, fMbedMask, kIPLen);
+#ifdef DEBUG
                 printf("mbedmask=%s\r\n",fMbedMask);
+#endif
                 b       = SnBitUtils::ReadFrom(b, fMbedGate, kIPLen);
+#ifdef DEBUG
                 printf("mbedgate=%s\r\n",fMbedGate);
+#endif
             }
             b           = SnBitUtils::ReadFrom(b, fWatchDogPeriod);
+#ifdef DEBUG
             printf("watch=%u\r\n",fWatchDogPeriod);
+#endif
             if (fStreamHiLoPlas!=0) {
                 uint16_t hi, lo;
                 for (uint8_t j=0; j<fNumPlas; j++) {
                     b   = SnBitUtils::ReadFrom(b, hi);
+#ifdef DEBUG
                     printf("hi=%hu\r\n",hi);
+#endif
                     b   = SnBitUtils::ReadFrom(b, lo);
+#ifdef DEBUG
                     printf("lo=%hu\r\n",lo);
+#endif
                     // don't save these
                 }
             }
         }
+#ifdef DEBUG
         printf("read from done\r\n");
+#endif
     }
     
     template <class T>