Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Revision:
11:de443350ec4a
Parent:
10:3c93db1cfb12
Child:
12:d472f9811262
--- a/main.cpp	Fri Aug 10 18:35:43 2012 +0000
+++ b/main.cpp	Mon Aug 13 20:44:06 2012 +0000
@@ -134,11 +134,7 @@
 //static const uint32_t gB64Bsize=BASE64ENC_LEN(gBufSize)+1;
 //static char           gB64Buf[gB64Bsize];
 static char           gGenBuf[gBufSize]; // must be big enough for event or status or config!
-//static SnCommWin*     gComms[kNcomms]   = { new SnCommAfar, new SnCommUsb(&gCpu) }; // order => priority
-//static SnCommWin*     gComms[kNcomms]   = { new SnCommUsb(&gCpu) }; // order => priority
-//static SnCommWin*     gComms[kNcomms]   = { new SnCommAfar(gB64Buf, gB64Bsize) }; // order => priority
-//static SnCommWin*     gComms[kNcomms]   = { new SnCommAfarTCP(false) }; // order => priority
-static SnCommWin*     gComms[kNcomms]   = { 0 }; // order => priority
+static SnCommWin*     gComms[kNcomms]   = { 0 }; // order => priority. afar uses RTOS, and must be made inside main
 
 void procForceTrigger() {
     led3=!led3;
@@ -223,6 +219,7 @@
     // save to disk
     FILE* cf = SnSDUtils::GetCurFile();
     if (cf!=0) {
+        PIN_lockRegisters = 0; // unlock so we can talk to SD card.
         printf("writing power. v1=%g, v2=%g, r1=%g, r2=%g, t=%u, pownum=%u\r\n",
             gPower.GetAveV1(), gPower.GetAveV2(), 
             gPower.GetRmsV1(), gPower.GetRmsV2(), gPower.GetTime(),
@@ -502,6 +499,7 @@
     gEvent.SetDTms(etms);
     
     // save to SD
+    PIN_lockRegisters = 0; // unlock so we can talk to SD card.
     SnSDUtils::WriteEventTo(SnSDUtils::GetCurFile(), gGenBuf, gEvent, gConf);
     
     // reset
@@ -843,8 +841,6 @@
             if (cfgres>=SnCommWin::kOkWithMsg) {
                 Watchdog::kick(); // don't reset!
                 printf("received config!\r\n");
-                char* b = gGenBuf;
-                gConf.WriteTo(b);
                 // send data if need be (files, some events, etc)
                 printf("send data = %d\r\n", gConf.GetCommSendData());
                 if (gConf.GetCommSendData()!=0) {