Changeset 12347
- Timestamp:
- 10/31/11 18:53:01 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/feedback.cc
r12319 r12347 58 58 }; 59 59 60 enum control_t 61 { 62 kIdle, 63 kTemp, 64 kFeedback 65 }; 66 67 control_t fControlType; 68 60 69 PixelMap fMap; 61 70 … … 72 81 DimStampedInfo fBias; 73 82 74 DimStampedInfo *fBiasData;75 DimStampedInfo *fCameraTemp;83 DimStampedInfo fBiasData; 84 DimStampedInfo fCameraTemp; 76 85 77 86 DimDescribedService fDimReference; … … 164 173 } 165 174 166 if (curr== fCameraTemp)175 if (curr==&fCameraTemp) 167 176 { 168 177 if (curr->getSize()==0) … … 194 203 vec[i+416] = diff; 195 204 205 if (fControlType!=kTemp) 206 return; 207 196 208 fDimDeviation.Update(vec); 197 209 … … 206 218 } 207 219 208 if (curr== fBiasData)220 if (curr==&fBiasData && fControlType==kFeedback) 209 221 { 210 222 if (curr->getSize()==0) … … 400 412 401 413 for (int i=0; i<BIAS::kNumChannels; i++) 402 vec[i+416] = correction[i];414 vec[i+416] = avg[i]<5*2.5 ? 0 : correction[i]; 403 415 404 416 fDimDeviation.Update(vec); … … 529 541 int StartFeedback() 530 542 { 531 fBiasData = new DimStampedInfo("FAD_CONTROL/FEEDBACK_DATA", (void*)NULL, 0, this);532 533 543 ResetData(); 544 545 fControlType = kFeedback; 534 546 535 547 return GetCurrentState(); … … 540 552 if (!CheckEventSize(evt.GetSize(), "StartTempCtrl", 4)) 541 553 return kSM_FatalError; 542 543 fBiasOffset = evt.GetFloat();544 fCameraTemp = new DimStampedInfo("FSC_CONTROL/TEMPERATURE", (void*)NULL, 0, this);545 554 546 555 ostringstream out; … … 548 557 Message(out); 549 558 559 fBiasOffset = evt.GetFloat(); 560 fControlType = kTemp; 561 550 562 return GetCurrentState(); 551 563 } … … 553 565 int StopFeedback() 554 566 { 555 if (fBiasData) 556 { 557 delete fBiasData; 558 fBiasData = 0; 559 } 560 561 if (fCameraTemp) 562 { 563 delete fCameraTemp; 564 fCameraTemp = 0; 565 } 567 fControlType = kIdle; 566 568 567 569 return GetCurrentState(); … … 599 601 return kSM_FatalError; 600 602 603 /* 601 604 const float val = evt.GetFloat(); 602 605 if (!fPV[0].size() && !fPV[1].size() && !fPV[2].size()) … … 604 607 Warn("No values in memory. Take enough events first!"); 605 608 return GetCurrentState(); 606 } 609 }*/ 607 610 608 611 vector<float> vec(BIAS::kNumChannels); … … 641 644 // All subsystems are connected 642 645 643 if (f BiasData)646 if (fControlType==kFeedback) 644 647 return fOutputEnabled ? kStateFeedbackCtrlRunning : kStateFeedbackCtrlIdle; 645 648 646 if (fC ameraTemp)649 if (fControlType==kTemp) 647 650 return fOutputEnabled ? kStateTempCtrlRunning : kStateTempCtrlIdle; 648 651 … … 659 662 fFSC("FSC_CONTROL/STATE", (void*)NULL, 0, this), 660 663 fBias("BIAS_CONTROL/STATE", (void*)NULL, 0, this), 661 fBiasData(0), fCameraTemp(0), 664 fBiasData("FAD_CONTROL/FEEDBACK_DATA", (void*)NULL, 0, this), 665 fCameraTemp("FSC_CONTROL/TEMPERATURE", (void*)NULL, 0, this), 662 666 fDimReference("FEEDBACK/REFERENCE", "F:416", ""), 663 667 fDimDeviation("FEEDBACK/DEVIATION", "F:416;F:416", ""),
Note:
See TracChangeset
for help on using the changeset viewer.