Arianna autonomous DAQ firmware
Dependencies: mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW
Diff: main.cpp
- Revision:
- 76:f8383f0292c2
- Parent:
- 67:ec999336fcd1
- Child:
- 84:80b15993944e
--- a/main.cpp Tue Feb 10 23:31:10 2015 +0000 +++ b/main.cpp Sun Feb 22 20:42:44 2015 +0000 @@ -762,17 +762,23 @@ #ifdef DEBUG printf("initializing SD card..\r\n"); #endif - // initialize the SD card. this should prevent the issue with - // seq 0 being overwritten upon power up or the SD card first - // being insterted - int ret = sd.disk_initialize(); - // may need to try a bunch of times to get it to init - for (int i=0; i<25 && (ret!=0); ++i) { + int ret = 1; // always fail if ignoring the SD card (1==fail) + if (gConf.IsIgnoringSDcard()==false) { + // initialize the SD card. this should prevent the issue with + // seq 0 being overwritten upon power up or the SD card first + // being insterted ret = sd.disk_initialize(); + // may need to try a bunch of times to get it to init + for (int i=0; i<25 && (ret!=0); ++i) { + ret = sd.disk_initialize(); + #ifdef DEBUG + printf("called disk_initialize (ret=%d)\r\n",ret); + #endif + } + } #ifdef DEBUG - printf("called disk_initialize (ret=%d)\r\n",ret); + printf("init SD card %d..\r\n", ret); #endif - } return ret; } @@ -968,6 +974,7 @@ PIN_ResetChips = 0; #endif } + #if CHIPBOARD==ATWD4CH PIN_lockRegisters = 0; // allow data to come from DFPGA WaitTrigAndSendClock(); // wait for trigger and move data to MB. this returns immediately if cards are powered off @@ -1265,7 +1272,8 @@ } FILE* cf = SnSDUtils::OpenNewOutputFile(SnConfigFrame::GetMacAddress(), gConf.GetRun(), - gConf.GetFirstSeq()); + gConf.GetFirstSeq(), + gConf.IsSendingFilesRunSeqList()); // reset event, timers, trigger counters ResetCountersClearEvt(); if (cf!=0) { @@ -2313,13 +2321,13 @@ #ifdef DEBUG printf("calling SetConfigAndMakeOutputFile\r\n"); #endif + + if (gConf.IsRunSeqListOneCommWinOnly()) { + SnSDUtils::ClearRunSeqList(gConf.IsSendingFilesRunSeqList()); + } SetConfigAndMakeOutputFile(); - if (gConf.IsRunSeqListOneCommWinOnly()) { - SnSDUtils::ClearRunSeqList(); - } - // check power in case we should be in low power mode // but don't save this reading to the file // (there's already one near the beginning)