- Timestamp:
- 05/28/13 13:37:10 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/mcp.cc
r16197 r16375 223 223 Message(str); 224 224 225 // Strictly speaking, it is not necessary, but 226 // stopping the ratecontrol before we configure 227 // the FTM ensures that no threshold setting commands 228 // interfere with the configuration of the FTM. 229 if (fDimRC.state()!=RateControl::State::kConnected) 230 { 231 Dim::SendCommandNB("RATE_CONTROL/STOP"); 232 Message("Stopping ratecontrol"); 233 } 234 235 if (fDimLog.state()<30/*kSM_WaitForRun*/) 236 { 237 Dim::SendCommandNB("DATA_LOGGER/START_RUN_LOGGING"); 238 Message("Starting datalogger"); 239 } 240 225 241 Update(MCP::State::kConfiguring1); 226 227 242 return MCP::State::kConfiguring1; 228 243 } … … 264 279 Value *buf = GetBuffer(); 265 280 281 Dim::SendCommandNB("FAD_CONTROL/CONFIGURE", buf, sizeof(Value)+fRunType.length()+1); 266 282 Message("Configuring FAD"); 267 Dim::SendCommandNB("FAD_CONTROL/CONFIGURE", buf, sizeof(Value)+fRunType.length()+1);268 283 269 284 delete buf; … … 301 316 if (GetCurrentState()==MCP::State::kConfiguring1) 302 317 { 303 if (fDimLog.state()<30/*kSM_WaitForRun*/) 304 { 305 Message("Starting datalogger"); 306 Dim::SendCommandNB("DATA_LOGGER/START_RUN_LOGGING"); 307 } 308 318 if (fDimRC.state()!=RateControl::State::kConnected) 319 return MCP::State::kConfiguring1; 320 321 Dim::SendCommandNB("FTM_CONTROL/CONFIGURE", fRunType); 309 322 Message("Configuring Trigger (FTM)"); 310 Dim::SendCommandNB("FTM_CONTROL/CONFIGURE", fRunType);311 312 // That's a bit stupid, but we have to stop the ratecontrol313 // first, otherwise it might be detected to be314 // in a state larger than Connected in Configuring3315 // (because it still was) before the state change introduced316 // by the Configuring2 state is even received. If instead317 // we wait in Configuring2 for the rate control to be connected,318 // we can be sure that it works.319 Message("Stopping ratecontrol");320 Dim::SendCommandNB("RATE_CONTROL/STOP");321 323 322 324 Update(MCP::State::kConfiguring2); … … 328 330 if (GetCurrentState()==MCP::State::kConfiguring2) 329 331 { 330 // FIMXE: Reset in case of error 331 if ((/*fDimFTM.state() != FTM::State::kConfiguring2 &&*/ 332 fDimFTM.state() != FTM::State::kConfigured) || 332 if (fDimFTM.state() != FTM::State::kConfigured || 333 333 fDimLog.state()<30 || fDimLog.state()>0xff || 334 334 fDimRC.state()!=RateControl::State::kConnected) 335 335 return MCP::State::kConfiguring2; 336 336 337 // FIMXE: This is to make sure that the rate control 338 // has received the correct trigger setup already... 339 //usleep(1000000); 340 337 Dim::SendCommandNB("RATE_CONTROL/CALIBRATE_RUN", fRunType); 341 338 Message("Starting Rate Control"); 342 // State of RC is not reported back fast enough!343 Dim::SendCommandNB("RATE_CONTROL/CALIBRATE_RUN", fRunType);344 339 345 340 ConfigureFAD(); … … 375 370 return MCP::State::kConfiguring3; 376 371 372 Dim::SendCommandNB("FTM_CONTROL/START_TRIGGER"); 377 373 Message("Starting Trigger (FTM)"); 378 Dim::SendCommandNB("FTM_CONTROL/START_TRIGGER");379 374 380 375 Update(MCP::State::kConfigured); … … 553 548 "Waiting for next configuration command"); 554 549 AddStateName(MCP::State::kConfiguring1, "Configuring1", 555 "Starting configuration procedure, checking Dataloggerstate");550 "Starting configuration procedure, checking datalogger/ratecontrol state"); 556 551 AddStateName(MCP::State::kConfiguring2, "Configuring2", 557 " Waiting for FTMand Datalogger to get ready");552 "Starting ratecontrol, waiting for FTM to get configured and Datalogger to get ready"); 558 553 AddStateName(MCP::State::kConfiguring3, "Configuring3", 559 "Waiting for FADs and rate 554 "Waiting for FADs and ratecontrol to get ready"); 560 555 /* 561 556 AddStateName(MCP::State::kCrateReset0, "CrateReset0",
Note:
See TracChangeset
for help on using the changeset viewer.